~osomon/oxide/power-save-blocker

« back to all changes in this revision

Viewing changes to shared/browser/oxide_browser_context_impl.cc

  • Committer: Chris Coulson
  • Date: 2014-06-02 15:06:30 UTC
  • Revision ID: chris.coulson@canonical.com-20140602150630-pahmaxtqonhxvmuc
Stop using WebContents::SetUserAgentOverride to set the user agent string, as this is unreliable in some circumstances. Instead, have a child-process-global user agent string

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include "base/logging.h"
21
21
#include "base/strings/stringprintf.h"
22
22
#include "content/public/browser/browser_thread.h"
 
23
#include "content/public/browser/render_process_host.h"
23
24
#include "content/public/common/user_agent.h"
24
25
 
25
26
#include "shared/common/chrome_version.h"
26
27
#include "shared/common/oxide_content_client.h"
 
28
#include "shared/common/oxide_messages.h"
27
29
 
28
30
#include "oxide_off_the_record_browser_context_impl.h"
29
31
 
161
163
        user_agent);
162
164
  default_user_agent_string_ = user_agent.empty();
163
165
 
164
 
  OnUserAgentChanged();
 
166
  for (content::RenderProcessHost::iterator it =
 
167
          content::RenderProcessHost::AllHostsIterator();
 
168
       !it.IsAtEnd(); it.Advance()) {
 
169
    content::RenderProcessHost* host = it.GetCurrentValue();
 
170
    if (IsSameContext(
 
171
            BrowserContext::FromContent(host->GetBrowserContext()))) {
 
172
      host->Send(new OxideMsg_SetUserAgent(GetUserAgent()));
 
173
    }
 
174
  }
165
175
}
166
176
 
167
177
void BrowserContextImpl::SetCookiePolicy(net::StaticCookiePolicy::Type policy) {