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

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

Issue 10411033: Browser Plugin: WebContents should notify when it's restored (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed a test DCHECK Created 8 years, 7 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 | Annotate | Revision Log
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 29 matching lines...) Expand all
40 #include "content/public/browser/color_chooser.h" 40 #include "content/public/browser/color_chooser.h"
41 #include "content/public/browser/content_browser_client.h" 41 #include "content/public/browser/content_browser_client.h"
42 #include "content/public/browser/devtools_agent_host_registry.h" 42 #include "content/public/browser/devtools_agent_host_registry.h"
43 #include "content/public/browser/download_manager.h" 43 #include "content/public/browser/download_manager.h"
44 #include "content/public/browser/download_url_parameters.h" 44 #include "content/public/browser/download_url_parameters.h"
45 #include "content/public/browser/invalidate_type.h" 45 #include "content/public/browser/invalidate_type.h"
46 #include "content/public/browser/javascript_dialogs.h" 46 #include "content/public/browser/javascript_dialogs.h"
47 #include "content/public/browser/load_notification_details.h" 47 #include "content/public/browser/load_notification_details.h"
48 #include "content/public/browser/navigation_details.h" 48 #include "content/public/browser/navigation_details.h"
49 #include "content/public/browser/notification_service.h" 49 #include "content/public/browser/notification_service.h"
50 #include "content/public/browser/notification_details.h"
50 #include "content/public/browser/resource_request_details.h" 51 #include "content/public/browser/resource_request_details.h"
51 #include "content/public/browser/user_metrics.h" 52 #include "content/public/browser/user_metrics.h"
52 #include "content/public/browser/web_contents_delegate.h" 53 #include "content/public/browser/web_contents_delegate.h"
53 #include "content/public/browser/web_contents_observer.h" 54 #include "content/public/browser/web_contents_observer.h"
54 #include "content/public/browser/web_contents_view.h" 55 #include "content/public/browser/web_contents_view.h"
55 #include "content/public/browser/web_ui_controller_factory.h" 56 #include "content/public/browser/web_ui_controller_factory.h"
56 #include "content/public/common/bindings_policy.h" 57 #include "content/public/common/bindings_policy.h"
57 #include "content/public/common/content_constants.h" 58 #include "content/public/common/content_constants.h"
58 #include "content/public/common/content_restriction.h" 59 #include "content/public/common/content_restriction.h"
59 #include "content/public/common/content_switches.h" 60 #include "content/public/common/content_switches.h"
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 // This is because closing the tab calls WebContentsImpl::Destroy(), which 889 // This is because closing the tab calls WebContentsImpl::Destroy(), which
889 // removes the |GetRenderViewHost()|; then when we actually destroy the 890 // removes the |GetRenderViewHost()|; then when we actually destroy the
890 // window, OnWindowPosChanged() notices and calls HideContents() (which 891 // window, OnWindowPosChanged() notices and calls HideContents() (which
891 // calls us). 892 // calls us).
892 RenderWidgetHostViewPort* rwhv = 893 RenderWidgetHostViewPort* rwhv =
893 RenderWidgetHostViewPort::FromRWHV(GetRenderWidgetHostView()); 894 RenderWidgetHostViewPort::FromRWHV(GetRenderWidgetHostView());
894 if (rwhv) 895 if (rwhv)
895 rwhv->WasHidden(); 896 rwhv->WasHidden();
896 } 897 }
897 898
899 bool is_visible = false;
898 content::NotificationService::current()->Notify( 900 content::NotificationService::current()->Notify(
899 content::NOTIFICATION_WEB_CONTENTS_HIDDEN, 901 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED,
900 content::Source<WebContents>(this), 902 content::Source<WebContents>(this),
901 content::NotificationService::NoDetails()); 903 content::Details<bool>(&is_visible));
904 }
905
906 void WebContentsImpl::WasRestored() {
907 bool is_visible = true;
908 content::NotificationService::current()->Notify(
909 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED,
910 content::Source<WebContents>(this),
911 content::Details<bool>(&is_visible));
902 } 912 }
903 913
904 void WebContentsImpl::ShowContents() { 914 void WebContentsImpl::ShowContents() {
905 RenderWidgetHostViewPort* rwhv = 915 RenderWidgetHostViewPort* rwhv =
906 RenderWidgetHostViewPort::FromRWHV(GetRenderWidgetHostView()); 916 RenderWidgetHostViewPort::FromRWHV(GetRenderWidgetHostView());
907 if (rwhv) 917 if (rwhv)
908 rwhv->DidBecomeSelected(); 918 rwhv->DidBecomeSelected();
919 WasRestored();
909 } 920 }
910 921
911 void WebContentsImpl::HideContents() { 922 void WebContentsImpl::HideContents() {
912 // TODO(pkasting): http://b/1239839 Right now we purposefully don't call 923 // TODO(pkasting): http://b/1239839 Right now we purposefully don't call
913 // our superclass HideContents(), because some callers want to be very picky 924 // our superclass HideContents(), because some callers want to be very picky
914 // about the order in which these get called. In addition to making the code 925 // about the order in which these get called. In addition to making the code
915 // here practically impossible to understand, this also means we end up 926 // here practically impossible to understand, this also means we end up
916 // calling WebContentsImpl::WasHidden() twice if callers call both versions of 927 // calling WebContentsImpl::WasHidden() twice if callers call both versions of
917 // HideContents() on a WebContentsImpl. 928 // HideContents() on a WebContentsImpl.
918 WasHidden(); 929 WasHidden();
(...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after
2782 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2793 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2783 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2794 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2784 // Can be NULL during tests. 2795 // Can be NULL during tests.
2785 if (rwh_view) 2796 if (rwh_view)
2786 rwh_view->SetSize(GetView()->GetContainerSize()); 2797 rwh_view->SetSize(GetView()->GetContainerSize());
2787 } 2798 }
2788 2799
2789 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { 2800 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() {
2790 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); 2801 return static_cast<RenderViewHostImpl*>(GetRenderViewHost());
2791 } 2802 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698