diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/tab_contents/tab_contents_view_gtk.cc index ece4546781f7ec..08d04636740f5b 100644 --- a/chrome/browser/tab_contents/tab_contents_view_gtk.cc +++ b/chrome/browser/tab_contents/tab_contents_view_gtk.cc @@ -333,45 +333,45 @@ gboolean TabContentsViewGtk::OnFocus(GtkWidget* widget, void TabContentsViewGtk::CreateNewWindow( int route_id, const ViewHostMsg_CreateWindow_Params& params) { - delegate_view_helper_.CreateNewWindow(tab_contents_, route_id, params); + tab_contents_view_helper_.CreateNewWindow(tab_contents_, route_id, params); } void TabContentsViewGtk::CreateNewWidget( int route_id, WebKit::WebPopupType popup_type) { - delegate_view_helper_.CreateNewWidget(tab_contents_, - route_id, - false, - popup_type); + tab_contents_view_helper_.CreateNewWidget(tab_contents_, + route_id, + false, + popup_type); } void TabContentsViewGtk::CreateNewFullscreenWidget(int route_id) { - delegate_view_helper_.CreateNewWidget(tab_contents_, - route_id, - true, - WebKit::WebPopupTypeNone); + tab_contents_view_helper_.CreateNewWidget(tab_contents_, + route_id, + true, + WebKit::WebPopupTypeNone); } void TabContentsViewGtk::ShowCreatedWindow(int route_id, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { - delegate_view_helper_.ShowCreatedWindow( + tab_contents_view_helper_.ShowCreatedWindow( tab_contents_, route_id, disposition, initial_pos, user_gesture); } void TabContentsViewGtk::ShowCreatedWidget( int route_id, const gfx::Rect& initial_pos) { - delegate_view_helper_.ShowCreatedWidget(tab_contents_, - route_id, - false, - initial_pos); + tab_contents_view_helper_.ShowCreatedWidget(tab_contents_, + route_id, + false, + initial_pos); } void TabContentsViewGtk::ShowCreatedFullscreenWidget(int route_id) { - delegate_view_helper_.ShowCreatedWidget(tab_contents_, - route_id, - true, - gfx::Rect()); + tab_contents_view_helper_.ShowCreatedWidget(tab_contents_, + route_id, + true, + gfx::Rect()); } void TabContentsViewGtk::ShowContextMenu(const ContextMenuParams& params) { diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.h b/chrome/browser/tab_contents/tab_contents_view_gtk.h index 9d5506c430e283..5856d24f5556ac 100644 --- a/chrome/browser/tab_contents/tab_contents_view_gtk.h +++ b/chrome/browser/tab_contents/tab_contents_view_gtk.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,8 +11,8 @@ #include #include "base/memory/scoped_ptr.h" -#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" #include "content/browser/tab_contents/tab_contents_view.h" +#include "content/browser/tab_contents/tab_contents_view_helper.h" #include "ui/base/gtk/focus_store_gtk.h" #include "ui/base/gtk/gtk_signal.h" #include "ui/base/gtk/owned_widget_gtk.h" @@ -128,8 +128,8 @@ class TabContentsViewGtk : public TabContentsView { // The TabContents whose contents we display. TabContents* tab_contents_; - // Common implementations of some RenderViewHostDelegate::View methods. - RenderViewHostDelegateViewHelper delegate_view_helper_; + // Common implementations of some TabContentsView methods. + TabContentsViewHelper tab_contents_view_helper_; // This container holds the tab's web page views. It is a GtkExpandedContainer // so that we can control the size of the web pages. diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.h b/chrome/browser/tab_contents/tab_contents_view_mac.h index 1da5a8cd5dbdab..3e5b0384acd788 100644 --- a/chrome/browser/tab_contents/tab_contents_view_mac.h +++ b/chrome/browser/tab_contents/tab_contents_view_mac.h @@ -15,8 +15,8 @@ #include "base/memory/scoped_nsobject.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" #include "content/browser/tab_contents/tab_contents_view.h" +#include "content/browser/tab_contents/tab_contents_view_helper.h" #include "ui/base/cocoa/base_view.h" #include "ui/gfx/size.h" @@ -128,8 +128,8 @@ class TabContentsViewMac : public TabContentsView { // The TabContents whose contents we display. TabContents* tab_contents_; - // Common implementations of some RenderViewHostDelegate::View methods. - RenderViewHostDelegateViewHelper delegate_view_helper_; + // Common implementations of some TabContentsView methods. + TabContentsViewHelper tab_contents_view_helper_; // The Cocoa NSView that lives in the view hierarchy. scoped_nsobject cocoa_view_; diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm index 40e005773b44e2..51674676056327 100644 --- a/chrome/browser/tab_contents/tab_contents_view_mac.mm +++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm @@ -272,16 +272,16 @@ - (void)renderWidgetHostWasResized; void TabContentsViewMac::CreateNewWindow( int route_id, const ViewHostMsg_CreateWindow_Params& params) { - delegate_view_helper_.CreateNewWindow(tab_contents_, route_id, params); + tab_contents_view_helper_.CreateNewWindow(tab_contents_, route_id, params); } void TabContentsViewMac::CreateNewWidget( int route_id, WebKit::WebPopupType popup_type) { RenderWidgetHostView* widget_view = - delegate_view_helper_.CreateNewWidget(tab_contents_, - route_id, - false, - popup_type); + tab_contents_view_helper_.CreateNewWidget(tab_contents_, + route_id, + false, + popup_type); // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it // to allow it to survive the trip without being hosted. @@ -292,10 +292,10 @@ - (void)renderWidgetHostWasResized; void TabContentsViewMac::CreateNewFullscreenWidget(int route_id) { RenderWidgetHostView* widget_view = - delegate_view_helper_.CreateNewWidget(tab_contents_, - route_id, - true, - WebKit::WebPopupTypeNone); + tab_contents_view_helper_.CreateNewWidget(tab_contents_, + route_id, + true, + WebKit::WebPopupTypeNone); // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it // to allow it to survive the trip without being hosted. @@ -308,17 +308,17 @@ - (void)renderWidgetHostWasResized; WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { - delegate_view_helper_.ShowCreatedWindow( + tab_contents_view_helper_.ShowCreatedWindow( tab_contents_, route_id, disposition, initial_pos, user_gesture); } void TabContentsViewMac::ShowCreatedWidget( int route_id, const gfx::Rect& initial_pos) { RenderWidgetHostView* widget_host_view = - delegate_view_helper_.ShowCreatedWidget(tab_contents_, - route_id, - false, - initial_pos); + tab_contents_view_helper_.ShowCreatedWidget(tab_contents_, + route_id, + false, + initial_pos); // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's // properly embedded (or purposefully ignored) we can release the retain we @@ -330,10 +330,10 @@ - (void)renderWidgetHostWasResized; void TabContentsViewMac::ShowCreatedFullscreenWidget(int route_id) { RenderWidgetHostView* widget_host_view = - delegate_view_helper_.ShowCreatedWidget(tab_contents_, - route_id, - true, - gfx::Rect()); + tab_contents_view_helper_.ShowCreatedWidget(tab_contents_, + route_id, + true, + gfx::Rect()); // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's // properly embedded (or purposely ignored) we can release the retain we took diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc b/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc index 454117386a63a7..2e61ffaeec82e1 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc +++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc @@ -301,45 +301,45 @@ void TabContentsViewViews::CloseTab() { void TabContentsViewViews::CreateNewWindow( int route_id, const ViewHostMsg_CreateWindow_Params& params) { - delegate_view_helper_.CreateNewWindow(web_contents_, route_id, params); + tab_contents_view_helper_.CreateNewWindow(web_contents_, route_id, params); } void TabContentsViewViews::CreateNewWidget( int route_id, WebKit::WebPopupType popup_type) { - delegate_view_helper_.CreateNewWidget(web_contents_, - route_id, - false, - popup_type); + tab_contents_view_helper_.CreateNewWidget(web_contents_, + route_id, + false, + popup_type); } void TabContentsViewViews::CreateNewFullscreenWidget(int route_id) { - delegate_view_helper_.CreateNewWidget(web_contents_, - route_id, - true, - WebKit::WebPopupTypeNone); + tab_contents_view_helper_.CreateNewWidget(web_contents_, + route_id, + true, + WebKit::WebPopupTypeNone); } void TabContentsViewViews::ShowCreatedWindow(int route_id, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { - delegate_view_helper_.ShowCreatedWindow( + tab_contents_view_helper_.ShowCreatedWindow( web_contents_, route_id, disposition, initial_pos, user_gesture); } void TabContentsViewViews::ShowCreatedWidget( int route_id, const gfx::Rect& initial_pos) { - delegate_view_helper_.ShowCreatedWidget(web_contents_, - route_id, - false, - initial_pos); + tab_contents_view_helper_.ShowCreatedWidget(web_contents_, + route_id, + false, + initial_pos); } void TabContentsViewViews::ShowCreatedFullscreenWidget(int route_id) { - delegate_view_helper_.ShowCreatedWidget(web_contents_, - route_id, - true, - gfx::Rect()); + tab_contents_view_helper_.ShowCreatedWidget(web_contents_, + route_id, + true, + gfx::Rect()); } void TabContentsViewViews::ShowContextMenu(const ContextMenuParams& params) { diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_view_views.h b/chrome/browser/ui/views/tab_contents/tab_contents_view_views.h index b8eae83d9d5a12..d3130d080d99ff 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_view_views.h +++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_views.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,9 +9,9 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "base/timer.h" -#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate.h" #include "content/browser/tab_contents/tab_contents_view.h" +#include "content/browser/tab_contents/tab_contents_view_helper.h" #include "ui/views/widget/widget.h" class ConstrainedWindowGtk; @@ -147,8 +147,8 @@ class TabContentsViewViews : public views::Widget, // The WebContents whose contents we display. content::WebContents* web_contents_; - // Common implementations of some RenderViewHostDelegate::View methods. - RenderViewHostDelegateViewHelper delegate_view_helper_; + // Common implementations of some TabContentsView methods. + TabContentsViewHelper tab_contents_view_helper_; NativeTabContentsView* native_tab_contents_view_; diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 8f7542bf528668..5a86fc414a7892 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2365,8 +2365,6 @@ 'browser/tab_contents/render_view_context_menu_mac.mm', 'browser/tab_contents/render_view_context_menu_observer.cc', 'browser/tab_contents/render_view_context_menu_observer.h', - 'browser/tab_contents/render_view_host_delegate_helper.cc', - 'browser/tab_contents/render_view_host_delegate_helper.h', 'browser/tab_contents/retargeting_details.h', 'browser/tab_contents/tab_contents_ssl_helper.cc', 'browser/tab_contents/tab_contents_ssl_helper.h', diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/content/browser/tab_contents/tab_contents_view_helper.cc similarity index 89% rename from chrome/browser/tab_contents/render_view_host_delegate_helper.cc rename to content/browser/tab_contents/tab_contents_view_helper.cc index 451e7b9c7563e3..3d434d44e5a28d 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc +++ b/content/browser/tab_contents/tab_contents_view_helper.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" +#include "content/browser/tab_contents/tab_contents_view_helper.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host.h" @@ -18,15 +18,15 @@ using content::WebContents; -RenderViewHostDelegateViewHelper::RenderViewHostDelegateViewHelper() { +TabContentsViewHelper::TabContentsViewHelper() { registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, content::NotificationService::AllBrowserContextsAndSources()); } -RenderViewHostDelegateViewHelper::~RenderViewHostDelegateViewHelper() {} +TabContentsViewHelper::~TabContentsViewHelper() {} -void RenderViewHostDelegateViewHelper::Observe( +void TabContentsViewHelper::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { @@ -41,7 +41,7 @@ void RenderViewHostDelegateViewHelper::Observe( } } -TabContents* RenderViewHostDelegateViewHelper::CreateNewWindow( +TabContents* TabContentsViewHelper::CreateNewWindow( WebContents* web_contents, int route_id, const ViewHostMsg_CreateWindow_Params& params) { @@ -85,7 +85,7 @@ TabContents* RenderViewHostDelegateViewHelper::CreateNewWindow( return new_contents; } -RenderWidgetHostView* RenderViewHostDelegateViewHelper::CreateNewWidget( +RenderWidgetHostView* TabContentsViewHelper::CreateNewWidget( WebContents* web_contents, int route_id, bool is_fullscreen, @@ -103,7 +103,7 @@ RenderWidgetHostView* RenderViewHostDelegateViewHelper::CreateNewWidget( return widget_view; } -TabContents* RenderViewHostDelegateViewHelper::GetCreatedWindow(int route_id) { +TabContents* TabContentsViewHelper::GetCreatedWindow(int route_id) { PendingContents::iterator iter = pending_contents_.find(route_id); // Certain systems can block the creation of new windows. If we didn't succeed @@ -124,8 +124,7 @@ TabContents* RenderViewHostDelegateViewHelper::GetCreatedWindow(int route_id) { return new_contents; } -RenderWidgetHostView* RenderViewHostDelegateViewHelper::GetCreatedWidget( - int route_id) { +RenderWidgetHostView* TabContentsViewHelper::GetCreatedWidget(int route_id) { PendingWidgetViews::iterator iter = pending_widget_views_.find(route_id); if (iter == pending_widget_views_.end()) { DCHECK(false); @@ -144,7 +143,7 @@ RenderWidgetHostView* RenderViewHostDelegateViewHelper::GetCreatedWidget( return widget_host_view; } -TabContents* RenderViewHostDelegateViewHelper::ShowCreatedWindow( +TabContents* TabContentsViewHelper::ShowCreatedWindow( WebContents* web_contents, int route_id, WindowOpenDisposition disposition, @@ -160,7 +159,7 @@ TabContents* RenderViewHostDelegateViewHelper::ShowCreatedWindow( return contents; } -RenderWidgetHostView* RenderViewHostDelegateViewHelper::ShowCreatedWidget( +RenderWidgetHostView* TabContentsViewHelper::ShowCreatedWidget( WebContents* web_contents, int route_id, bool is_fullscreen, diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.h b/content/browser/tab_contents/tab_contents_view_helper.h similarity index 84% rename from chrome/browser/tab_contents/render_view_host_delegate_helper.h rename to content/browser/tab_contents/tab_contents_view_helper.h index 1d38de47e2b064..cf73b8b8067c5b 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.h +++ b/content/browser/tab_contents/tab_contents_view_helper.h @@ -2,14 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_DELEGATE_HELPER_H_ -#define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_DELEGATE_HELPER_H_ +#ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_HELPER_H_ +#define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_HELPER_H_ #pragma once #include #include "base/basictypes.h" #include "base/compiler_specific.h" +#include "content/common/content_export.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" @@ -33,10 +34,11 @@ class Rect; // Provides helper methods that provide common implementations of some // TabContentsView methods. -class RenderViewHostDelegateViewHelper : public content::NotificationObserver { +class CONTENT_EXPORT TabContentsViewHelper + : public content::NotificationObserver { public: - RenderViewHostDelegateViewHelper(); - virtual ~RenderViewHostDelegateViewHelper(); + TabContentsViewHelper(); + virtual ~TabContentsViewHelper(); // Creates a new window; call |ShowCreatedWindow| below to show it. TabContents* CreateNewWindow(content::WebContents* web_contents, @@ -80,20 +82,20 @@ class RenderViewHostDelegateViewHelper : public content::NotificationObserver { // called once as this call also removes it from the internal map. TabContents* GetCreatedWindow(int route_id); - // Tracks created RenderViewHost objects that have not been shown yet. - // They are identified by the route ID passed to CreateNewWindow. + // Tracks created TabContents objects that have not been shown yet. They are + // identified by the route ID passed to CreateNewWindow. typedef std::map PendingContents; PendingContents pending_contents_; - // These maps hold on to the widgets that we created on behalf of the - // renderer that haven't shown yet. + // These maps hold on to the widgets that we created on behalf of the renderer + // that haven't shown yet. typedef std::map PendingWidgetViews; PendingWidgetViews pending_widget_views_; // Registers and unregisters us for notifications. content::NotificationRegistrar registrar_; - DISALLOW_COPY_AND_ASSIGN(RenderViewHostDelegateViewHelper); + DISALLOW_COPY_AND_ASSIGN(TabContentsViewHelper); }; -#endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_DELEGATE_HELPER_H_ +#endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_HELPER_H_ diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 2c1f174e8af126..f6677298274f6d 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -614,6 +614,8 @@ 'browser/tab_contents/tab_contents.h', 'browser/tab_contents/tab_contents_view.cc', 'browser/tab_contents/tab_contents_view.h', + 'browser/tab_contents/tab_contents_view_helper.cc', + 'browser/tab_contents/tab_contents_view_helper.h', 'browser/tab_contents/title_updated_details.h', 'browser/tab_contents/web_drag_dest_delegate.h', 'browser/tab_contents/web_drag_dest_gtk.cc',