Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 13467038: Browser Plugin: Expose frame name changes to the content API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 controller_.ReloadIgnoringCache(true); 831 controller_.ReloadIgnoringCache(true);
832 832
833 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 833 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
834 UserAgentOverrideSet(override)); 834 UserAgentOverrideSet(override));
835 } 835 }
836 836
837 const std::string& WebContentsImpl::GetUserAgentOverride() const { 837 const std::string& WebContentsImpl::GetUserAgentOverride() const {
838 return renderer_preferences_.user_agent_override; 838 return renderer_preferences_.user_agent_override;
839 } 839 }
840 840
841 void WebContentsImpl::SetWindowName(const std::string& name) {
842 if (window_name_ == name)
843 return;
844
845 window_name_ = name;
846 RenderViewHost* rvh = GetRenderViewHost();
847 if (rvh)
848 rvh->SetWindowName(name);
849 }
850
851 const std::string& WebContentsImpl::GetWindowName() const {
852 return window_name_;
853 }
854
841 const string16& WebContentsImpl::GetTitle() const { 855 const string16& WebContentsImpl::GetTitle() const {
842 // Transient entries take precedence. They are used for interstitial pages 856 // Transient entries take precedence. They are used for interstitial pages
843 // that are shown on top of existing pages. 857 // that are shown on top of existing pages.
844 NavigationEntry* entry = controller_.GetTransientEntry(); 858 NavigationEntry* entry = controller_.GetTransientEntry();
845 std::string accept_languages = 859 std::string accept_languages =
846 GetContentClient()->browser()->GetAcceptLangs( 860 GetContentClient()->browser()->GetAcceptLangs(
847 GetBrowserContext()); 861 GetBrowserContext());
848 if (entry) { 862 if (entry) {
849 return entry->GetTitleForDisplay(accept_languages); 863 return entry->GetTitleForDisplay(accept_languages);
850 } 864 }
(...skipping 1776 matching lines...) Expand 10 before | Expand all | Expand 10 after
2627 bool was_crashed = IsCrashed(); 2641 bool was_crashed = IsCrashed();
2628 SetIsCrashed(base::TERMINATION_STATUS_STILL_RUNNING, 0); 2642 SetIsCrashed(base::TERMINATION_STATUS_STILL_RUNNING, 0);
2629 2643
2630 // Restore the focus to the tab (otherwise the focus will be on the top 2644 // Restore the focus to the tab (otherwise the focus will be on the top
2631 // window). 2645 // window).
2632 if (was_crashed && !FocusLocationBarByDefault() && 2646 if (was_crashed && !FocusLocationBarByDefault() &&
2633 (!delegate_ || delegate_->ShouldFocusPageAfterCrash())) { 2647 (!delegate_ || delegate_->ShouldFocusPageAfterCrash())) {
2634 view_->Focus(); 2648 view_->Focus();
2635 } 2649 }
2636 2650
2651 if (!window_name_.empty())
2652 rvh->SetWindowName(window_name_);
2653
2637 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewReady()); 2654 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewReady());
2638 } 2655 }
2639 2656
2640 void WebContentsImpl::RenderViewGone(RenderViewHost* rvh, 2657 void WebContentsImpl::RenderViewGone(RenderViewHost* rvh,
2641 base::TerminationStatus status, 2658 base::TerminationStatus status,
2642 int error_code) { 2659 int error_code) {
2643 if (rvh != GetRenderViewHost()) { 2660 if (rvh != GetRenderViewHost()) {
2644 // The pending page's RenderViewHost is gone. 2661 // The pending page's RenderViewHost is gone.
2645 return; 2662 return;
2646 } 2663 }
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
2896 // Notify all swapped out RenderViewHosts for this tab. This is important 2913 // Notify all swapped out RenderViewHosts for this tab. This is important
2897 // in case we go back to them, or if another window in those processes tries 2914 // in case we go back to them, or if another window in those processes tries
2898 // to access window.opener. 2915 // to access window.opener.
2899 render_manager_.DidDisownOpener(rvh); 2916 render_manager_.DidDisownOpener(rvh);
2900 } 2917 }
2901 2918
2902 void WebContentsImpl::DidUpdateFrameTree(RenderViewHost* rvh) { 2919 void WebContentsImpl::DidUpdateFrameTree(RenderViewHost* rvh) {
2903 render_manager_.DidUpdateFrameTree(rvh); 2920 render_manager_.DidUpdateFrameTree(rvh);
2904 } 2921 }
2905 2922
2923 void WebContentsImpl::DidUpdateFrameName(RenderViewHost* rvh,
2924 int frame_id,
2925 bool is_top_level,
2926 const std::string& name) {
2927 if (is_top_level)
2928 window_name_ = name;
2929 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2930 DidUpdateFrameName(frame_id,
2931 is_top_level,
2932 name,
2933 rvh));
2934 }
2935
2906 void WebContentsImpl::DocumentAvailableInMainFrame( 2936 void WebContentsImpl::DocumentAvailableInMainFrame(
2907 RenderViewHost* render_view_host) { 2937 RenderViewHost* render_view_host) {
2908 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2938 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2909 DocumentAvailableInMainFrame()); 2939 DocumentAvailableInMainFrame());
2910 } 2940 }
2911 2941
2912 void WebContentsImpl::DocumentOnLoadCompletedInMainFrame( 2942 void WebContentsImpl::DocumentOnLoadCompletedInMainFrame(
2913 RenderViewHost* render_view_host, 2943 RenderViewHost* render_view_host,
2914 int32 page_id) { 2944 int32 page_id) {
2915 NotificationService::current()->Notify( 2945 NotificationService::current()->Notify(
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
3406 } 3436 }
3407 3437
3408 BrowserPluginGuestManager* 3438 BrowserPluginGuestManager*
3409 WebContentsImpl::GetBrowserPluginGuestManager() const { 3439 WebContentsImpl::GetBrowserPluginGuestManager() const {
3410 return static_cast<BrowserPluginGuestManager*>( 3440 return static_cast<BrowserPluginGuestManager*>(
3411 GetBrowserContext()->GetUserData( 3441 GetBrowserContext()->GetUserData(
3412 browser_plugin::kBrowserPluginGuestManagerKeyName)); 3442 browser_plugin::kBrowserPluginGuestManagerKeyName));
3413 } 3443 }
3414 3444
3415 } // namespace content 3445 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698