OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 // Send the new override string to the renderer. | 786 // Send the new override string to the renderer. |
787 RenderViewHost* host = GetRenderViewHost(); | 787 RenderViewHost* host = GetRenderViewHost(); |
788 if (host) | 788 if (host) |
789 host->SyncRendererPrefs(); | 789 host->SyncRendererPrefs(); |
790 | 790 |
791 // Reload the page if a load is currently in progress to avoid having | 791 // Reload the page if a load is currently in progress to avoid having |
792 // different parts of the page loaded using different user agents. | 792 // different parts of the page loaded using different user agents. |
793 NavigationEntry* entry = controller_.GetActiveEntry(); | 793 NavigationEntry* entry = controller_.GetActiveEntry(); |
794 if (is_loading_ && entry != NULL && entry->GetIsOverridingUserAgent()) | 794 if (is_loading_ && entry != NULL && entry->GetIsOverridingUserAgent()) |
795 controller_.ReloadIgnoringCache(true); | 795 controller_.ReloadIgnoringCache(true); |
| 796 |
| 797 // Send out a notification that the user agent override was changed. |
| 798 content::NotificationService::current()->Notify( |
| 799 content::NOTIFICATION_WEB_CONTENTS_USER_AGENT_OVERRIDE_CHANGED, |
| 800 content::Source<WebContents>(this), |
| 801 content::NotificationService::NoDetails()); |
796 } | 802 } |
797 | 803 |
798 const std::string& WebContentsImpl::GetUserAgentOverride() const { | 804 const std::string& WebContentsImpl::GetUserAgentOverride() const { |
799 return renderer_preferences_.user_agent_override; | 805 return renderer_preferences_.user_agent_override; |
800 } | 806 } |
801 | 807 |
802 const string16& WebContentsImpl::GetTitle() const { | 808 const string16& WebContentsImpl::GetTitle() const { |
803 // Transient entries take precedence. They are used for interstitial pages | 809 // Transient entries take precedence. They are used for interstitial pages |
804 // that are shown on top of existing pages. | 810 // that are shown on top of existing pages. |
805 NavigationEntry* entry = controller_.GetTransientEntry(); | 811 NavigationEntry* entry = controller_.GetTransientEntry(); |
(...skipping 2378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3184 old_browser_plugin_host()->embedder_render_process_host(); | 3190 old_browser_plugin_host()->embedder_render_process_host(); |
3185 *embedder_container_id = old_browser_plugin_host()->instance_id(); | 3191 *embedder_container_id = old_browser_plugin_host()->instance_id(); |
3186 int embedder_process_id = | 3192 int embedder_process_id = |
3187 embedder_render_process_host ? embedder_render_process_host->GetID() : -1; | 3193 embedder_render_process_host ? embedder_render_process_host->GetID() : -1; |
3188 if (embedder_process_id != -1) { | 3194 if (embedder_process_id != -1) { |
3189 *embedder_channel_name = | 3195 *embedder_channel_name = |
3190 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(), | 3196 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(), |
3191 embedder_process_id); | 3197 embedder_process_id); |
3192 } | 3198 } |
3193 } | 3199 } |
OLD | NEW |