Commit 1c05b7c7 authored by jam@chromium.org's avatar jam@chromium.org

Move TabContentsViewGtk's delegate to content\public\browser. Also name it a...

Move TabContentsViewGtk's delegate to content\public\browser. Also name it a delegate instead of a wrapper to match what Mac (and Win soon) call theirs.

BUG=98716
Review URL: https://chromiumcodereview.appspot.com/9586009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124695 0039d316-1c4b-4281-b951-d872f2087c98
parent df3bc522
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
#include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h"
#elif defined(TOOLKIT_USES_GTK) #elif defined(TOOLKIT_USES_GTK)
#include "chrome/browser/tab_contents/chrome_tab_contents_view_wrapper_gtk.h" #include "chrome/browser/tab_contents/chrome_web_contents_view_gtk_delegate.h"
#include "content/browser/tab_contents/tab_contents_view_gtk.h" #include "content/browser/tab_contents/tab_contents_view_gtk.h"
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
#include "chrome/browser/tab_contents/chrome_web_contents_view_mac_delegate.h" #include "chrome/browser/tab_contents/chrome_web_contents_view_mac_delegate.h"
...@@ -346,7 +346,7 @@ content::WebContentsView* ChromeContentBrowserClient::CreateWebContentsView( ...@@ -346,7 +346,7 @@ content::WebContentsView* ChromeContentBrowserClient::CreateWebContentsView(
return new TabContentsViewViews(web_contents); return new TabContentsViewViews(web_contents);
#elif defined(TOOLKIT_USES_GTK) #elif defined(TOOLKIT_USES_GTK)
return new content::TabContentsViewGtk(web_contents, return new content::TabContentsViewGtk(web_contents,
new ChromeTabContentsViewWrapperGtk); new ChromeWebContentsViewGtkDelegate);
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
return web_contents_view_mac::CreateWebContentsView( return web_contents_view_mac::CreateWebContentsView(
web_contents, web_contents,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/tab_contents/chrome_tab_contents_view_wrapper_gtk.h" #include "chrome/browser/tab_contents/chrome_web_contents_view_gtk_delegate.h"
#include "chrome/browser/browser_shutdown.h" #include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/tab_contents/render_view_context_menu_gtk.h" #include "chrome/browser/tab_contents/render_view_context_menu_gtk.h"
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "ui/base/gtk/gtk_floating_container.h" #include "ui/base/gtk/gtk_floating_container.h"
ChromeTabContentsViewWrapperGtk::ChromeTabContentsViewWrapperGtk() ChromeWebContentsViewGtkDelegate::ChromeWebContentsViewGtkDelegate()
: floating_(gtk_floating_container_new()), : floating_(gtk_floating_container_new()),
view_(NULL), view_(NULL),
constrained_window_(NULL) { constrained_window_(NULL) {
...@@ -24,11 +24,11 @@ ChromeTabContentsViewWrapperGtk::ChromeTabContentsViewWrapperGtk() ...@@ -24,11 +24,11 @@ ChromeTabContentsViewWrapperGtk::ChromeTabContentsViewWrapperGtk()
G_CALLBACK(OnSetFloatingPositionThunk), this); G_CALLBACK(OnSetFloatingPositionThunk), this);
} }
ChromeTabContentsViewWrapperGtk::~ChromeTabContentsViewWrapperGtk() { ChromeWebContentsViewGtkDelegate::~ChromeWebContentsViewGtkDelegate() {
floating_.Destroy(); floating_.Destroy();
} }
void ChromeTabContentsViewWrapperGtk::AttachConstrainedWindow( void ChromeWebContentsViewGtkDelegate::AttachConstrainedWindow(
ConstrainedWindowGtk* constrained_window) { ConstrainedWindowGtk* constrained_window) {
DCHECK(constrained_window_ == NULL); DCHECK(constrained_window_ == NULL);
...@@ -37,7 +37,7 @@ void ChromeTabContentsViewWrapperGtk::AttachConstrainedWindow( ...@@ -37,7 +37,7 @@ void ChromeTabContentsViewWrapperGtk::AttachConstrainedWindow(
constrained_window->widget()); constrained_window->widget());
} }
void ChromeTabContentsViewWrapperGtk::RemoveConstrainedWindow( void ChromeWebContentsViewGtkDelegate::RemoveConstrainedWindow(
ConstrainedWindowGtk* constrained_window) { ConstrainedWindowGtk* constrained_window) {
DCHECK(constrained_window == constrained_window_); DCHECK(constrained_window == constrained_window_);
...@@ -46,7 +46,7 @@ void ChromeTabContentsViewWrapperGtk::RemoveConstrainedWindow( ...@@ -46,7 +46,7 @@ void ChromeTabContentsViewWrapperGtk::RemoveConstrainedWindow(
constrained_window->widget()); constrained_window->widget());
} }
void ChromeTabContentsViewWrapperGtk::WrapView( void ChromeWebContentsViewGtkDelegate::WrapView(
content::TabContentsViewGtk* view) { content::TabContentsViewGtk* view) {
view_ = view; view_ = view;
...@@ -55,18 +55,18 @@ void ChromeTabContentsViewWrapperGtk::WrapView( ...@@ -55,18 +55,18 @@ void ChromeTabContentsViewWrapperGtk::WrapView(
gtk_widget_show(floating_.get()); gtk_widget_show(floating_.get());
} }
gfx::NativeView ChromeTabContentsViewWrapperGtk::GetNativeView() const { gfx::NativeView ChromeWebContentsViewGtkDelegate::GetNativeView() const {
return floating_.get(); return floating_.get();
} }
void ChromeTabContentsViewWrapperGtk::OnCreateViewForWidget() { void ChromeWebContentsViewGtkDelegate::OnCreateViewForWidget() {
// We install a chrome specific handler to intercept bookmark drags for the // We install a chrome specific handler to intercept bookmark drags for the
// bookmark manager/extension API. // bookmark manager/extension API.
bookmark_handler_gtk_.reset(new WebDragBookmarkHandlerGtk); bookmark_handler_gtk_.reset(new WebDragBookmarkHandlerGtk);
view_->SetDragDestDelegate(bookmark_handler_gtk_.get()); view_->SetDragDestDelegate(bookmark_handler_gtk_.get());
} }
void ChromeTabContentsViewWrapperGtk::Focus() { void ChromeWebContentsViewGtkDelegate::Focus() {
if (!constrained_window_) { if (!constrained_window_) {
GtkWidget* widget = view_->GetContentNativeView(); GtkWidget* widget = view_->GetContentNativeView();
if (widget) if (widget)
...@@ -74,7 +74,7 @@ void ChromeTabContentsViewWrapperGtk::Focus() { ...@@ -74,7 +74,7 @@ void ChromeTabContentsViewWrapperGtk::Focus() {
} }
} }
gboolean ChromeTabContentsViewWrapperGtk::OnNativeViewFocusEvent( gboolean ChromeWebContentsViewGtkDelegate::OnNativeViewFocusEvent(
GtkWidget* widget, GtkWidget* widget,
GtkDirectionType type, GtkDirectionType type,
gboolean* return_value) { gboolean* return_value) {
...@@ -96,7 +96,7 @@ gboolean ChromeTabContentsViewWrapperGtk::OnNativeViewFocusEvent( ...@@ -96,7 +96,7 @@ gboolean ChromeTabContentsViewWrapperGtk::OnNativeViewFocusEvent(
return FALSE; return FALSE;
} }
void ChromeTabContentsViewWrapperGtk::ShowContextMenu( void ChromeWebContentsViewGtkDelegate::ShowContextMenu(
const content::ContextMenuParams& params) { const content::ContextMenuParams& params) {
// Find out the RenderWidgetHostView that corresponds to the render widget on // Find out the RenderWidgetHostView that corresponds to the render widget on
// which this context menu is showed, so that we can retrieve the last mouse // which this context menu is showed, so that we can retrieve the last mouse
...@@ -128,7 +128,7 @@ void ChromeTabContentsViewWrapperGtk::ShowContextMenu( ...@@ -128,7 +128,7 @@ void ChromeTabContentsViewWrapperGtk::ShowContextMenu(
context_menu_->Popup(point); context_menu_->Popup(point);
} }
void ChromeTabContentsViewWrapperGtk::OnSetFloatingPosition( void ChromeWebContentsViewGtkDelegate::OnSetFloatingPosition(
GtkWidget* floating_container, GtkAllocation* allocation) { GtkWidget* floating_container, GtkAllocation* allocation) {
if (!constrained_window_) if (!constrained_window_)
return; return;
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_TAB_CONTENTS_CHROME_TAB_CONTENTS_VIEW_WRAPPER_GTK_H_ #ifndef CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_GTK_DELEGATE_H_
#define CHROME_BROWSER_TAB_CONTENTS_CHROME_TAB_CONTENTS_VIEW_WRAPPER_GTK_H_ #define CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_GTK_DELEGATE_H_
#pragma once #pragma once
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "content/browser/tab_contents/tab_contents_view_wrapper_gtk.h" #include "content/public/browser/web_contents_view_gtk_delegate.h"
#include "ui/base/gtk/gtk_signal.h" #include "ui/base/gtk/gtk_signal.h"
#include "ui/base/gtk/owned_widget_gtk.h" #include "ui/base/gtk/owned_widget_gtk.h"
...@@ -19,18 +19,18 @@ class WebDragBookmarkHandlerGtk; ...@@ -19,18 +19,18 @@ class WebDragBookmarkHandlerGtk;
// A chrome/ specific class that extends TabContentsViewGtk with features like // A chrome/ specific class that extends TabContentsViewGtk with features like
// constrained windows, which live in chrome/. // constrained windows, which live in chrome/.
class ChromeTabContentsViewWrapperGtk class ChromeWebContentsViewGtkDelegate
: public content::TabContentsViewWrapperGtk { : public content::WebContentsViewGtkDelegate {
public: public:
ChromeTabContentsViewWrapperGtk(); ChromeWebContentsViewGtkDelegate();
virtual ~ChromeTabContentsViewWrapperGtk(); virtual ~ChromeWebContentsViewGtkDelegate();
// Unlike Windows, ConstrainedWindows need to collaborate with the // Unlike Windows, ConstrainedWindows need to collaborate with the
// TabContentsViewGtk to position the dialogs. // TabContentsViewGtk to position the dialogs.
void AttachConstrainedWindow(ConstrainedWindowGtk* constrained_window); void AttachConstrainedWindow(ConstrainedWindowGtk* constrained_window);
void RemoveConstrainedWindow(ConstrainedWindowGtk* constrained_window); void RemoveConstrainedWindow(ConstrainedWindowGtk* constrained_window);
// Overridden from TabContentsViewGtkWrapper: // Overridden from WebContentsViewGtkDelegate:
virtual void WrapView(content::TabContentsViewGtk* view) OVERRIDE; virtual void WrapView(content::TabContentsViewGtk* view) OVERRIDE;
virtual gfx::NativeView GetNativeView() const OVERRIDE; virtual gfx::NativeView GetNativeView() const OVERRIDE;
virtual void OnCreateViewForWidget() OVERRIDE; virtual void OnCreateViewForWidget() OVERRIDE;
...@@ -43,7 +43,7 @@ class ChromeTabContentsViewWrapperGtk ...@@ -43,7 +43,7 @@ class ChromeTabContentsViewWrapperGtk
private: private:
// Sets the location of the constrained windows. // Sets the location of the constrained windows.
CHROMEGTK_CALLBACK_1(ChromeTabContentsViewWrapperGtk, void, CHROMEGTK_CALLBACK_1(ChromeWebContentsViewGtkDelegate, void,
OnSetFloatingPosition, OnSetFloatingPosition,
GtkAllocation*); GtkAllocation*);
...@@ -65,4 +65,4 @@ class ChromeTabContentsViewWrapperGtk ...@@ -65,4 +65,4 @@ class ChromeTabContentsViewWrapperGtk
scoped_ptr<WebDragBookmarkHandlerGtk> bookmark_handler_gtk_; scoped_ptr<WebDragBookmarkHandlerGtk> bookmark_handler_gtk_;
}; };
#endif // CHROME_BROWSER_TAB_CONTENTS_CHROME_TAB_CONTENTS_VIEW_WRAPPER_GTK_H_ #endif // CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_GTK_DELEGATE_H_
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.h" #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.h"
#include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h"
#else #else
#include "chrome/browser/tab_contents/chrome_tab_contents_view_wrapper_gtk.h" #include "chrome/browser/tab_contents/chrome_web_contents_view_gtk_delegate.h"
#include "content/browser/tab_contents/tab_contents_view_gtk.h" #include "content/browser/tab_contents/tab_contents_view_gtk.h"
#endif #endif
...@@ -141,7 +141,7 @@ ConstrainedWindowGtk::TabContentsViewType* ...@@ -141,7 +141,7 @@ ConstrainedWindowGtk::TabContentsViewType*
#else #else
return static_cast<TabContentsViewType*>( return static_cast<TabContentsViewType*>(
static_cast<content::TabContentsViewGtk*>( static_cast<content::TabContentsViewGtk*>(
wrapper_->web_contents()->GetView())->wrapper()); wrapper_->web_contents()->GetView())->delegate());
#endif #endif
} }
......
...@@ -20,7 +20,7 @@ typedef struct _GdkColor GdkColor; ...@@ -20,7 +20,7 @@ typedef struct _GdkColor GdkColor;
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
class NativeTabContentsViewGtk; class NativeTabContentsViewGtk;
#else #else
class ChromeTabContentsViewWrapperGtk; class ChromeWebContentsViewGtkDelegate;
#endif #endif
class ConstrainedWindowGtkDelegate { class ConstrainedWindowGtkDelegate {
...@@ -52,7 +52,7 @@ class ConstrainedWindowGtk : public ConstrainedWindow { ...@@ -52,7 +52,7 @@ class ConstrainedWindowGtk : public ConstrainedWindow {
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
typedef NativeTabContentsViewGtk TabContentsViewType; typedef NativeTabContentsViewGtk TabContentsViewType;
#else #else
typedef ChromeTabContentsViewWrapperGtk TabContentsViewType; typedef ChromeWebContentsViewGtkDelegate TabContentsViewType;
#endif #endif
ConstrainedWindowGtk(TabContentsWrapper* wrapper, ConstrainedWindowGtk(TabContentsWrapper* wrapper,
......
...@@ -2507,8 +2507,8 @@ ...@@ -2507,8 +2507,8 @@
'browser/tab_first_render_watcher.h', 'browser/tab_first_render_watcher.h',
'browser/tab_contents/background_contents.cc', 'browser/tab_contents/background_contents.cc',
'browser/tab_contents/background_contents.h', 'browser/tab_contents/background_contents.h',
'browser/tab_contents/chrome_tab_contents_view_wrapper_gtk.cc', 'browser/tab_contents/chrome_web_contents_view_gtk_delegate.cc',
'browser/tab_contents/chrome_tab_contents_view_wrapper_gtk.h', 'browser/tab_contents/chrome_web_contents_view_gtk_delegate.h',
'browser/tab_contents/chrome_web_contents_view_mac_delegate.h', 'browser/tab_contents/chrome_web_contents_view_mac_delegate.h',
'browser/tab_contents/chrome_web_contents_view_mac_delegate.mm', 'browser/tab_contents/chrome_web_contents_view_mac_delegate.mm',
'browser/tab_contents/confirm_infobar_delegate.cc', 'browser/tab_contents/confirm_infobar_delegate.cc',
...@@ -4723,7 +4723,14 @@ ...@@ -4723,7 +4723,14 @@
], ],
}], }],
], ],
}], }, {
'sources!': [
# The rules only catch files that start or end with gtk, but these
# files would be incorrectly named if we forced the gtk at the end.
'browser/tab_contents/chrome_web_contents_view_gtk_delegate.cc',
'browser/tab_contents/chrome_web_contents_view_gtk_delegate.h',
],
}],
['input_speech==0', { ['input_speech==0', {
'sources/': [ 'sources/': [
['exclude', '^browser/speech/'], ['exclude', '^browser/speech/'],
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
#include "content/browser/renderer_host/render_widget_host_view_gtk.h" #include "content/browser/renderer_host/render_widget_host_view_gtk.h"
#include "content/browser/tab_contents/interstitial_page_impl.h" #include "content/browser/tab_contents/interstitial_page_impl.h"
#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_view_wrapper_gtk.h"
#include "content/browser/tab_contents/web_drag_dest_gtk.h" #include "content/browser/tab_contents/web_drag_dest_gtk.h"
#include "content/browser/tab_contents/web_drag_source_gtk.h" #include "content/browser/tab_contents/web_drag_source_gtk.h"
#include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_view_gtk_delegate.h"
#include "ui/base/gtk/gtk_expanded_container.h" #include "ui/base/gtk/gtk_expanded_container.h"
#include "ui/gfx/point.h" #include "ui/gfx/point.h"
#include "ui/gfx/rect.h" #include "ui/gfx/rect.h"
...@@ -79,10 +79,10 @@ namespace content { ...@@ -79,10 +79,10 @@ namespace content {
TabContentsViewGtk::TabContentsViewGtk( TabContentsViewGtk::TabContentsViewGtk(
content::WebContents* web_contents, content::WebContents* web_contents,
content::TabContentsViewWrapperGtk* view_wrapper) content::WebContentsViewGtkDelegate* delegate)
: tab_contents_(static_cast<TabContents*>(web_contents)), : tab_contents_(static_cast<TabContents*>(web_contents)),
expanded_(gtk_expanded_container_new()), expanded_(gtk_expanded_container_new()),
view_wrapper_(view_wrapper), delegate_(delegate),
overlaid_view_(NULL) { overlaid_view_(NULL) {
gtk_widget_set_name(expanded_.get(), "chrome-tab-contents-view"); gtk_widget_set_name(expanded_.get(), "chrome-tab-contents-view");
g_signal_connect(expanded_.get(), "size-allocate", g_signal_connect(expanded_.get(), "size-allocate",
...@@ -93,8 +93,8 @@ TabContentsViewGtk::TabContentsViewGtk( ...@@ -93,8 +93,8 @@ TabContentsViewGtk::TabContentsViewGtk(
gtk_widget_show(expanded_.get()); gtk_widget_show(expanded_.get());
drag_source_.reset(new content::WebDragSourceGtk(web_contents)); drag_source_.reset(new content::WebDragSourceGtk(web_contents));
if (view_wrapper_.get()) if (delegate_.get())
view_wrapper_->WrapView(this); delegate_->WrapView(this);
} }
TabContentsViewGtk::~TabContentsViewGtk() { TabContentsViewGtk::~TabContentsViewGtk() {
...@@ -135,15 +135,15 @@ RenderWidgetHostView* TabContentsViewGtk::CreateViewForWidget( ...@@ -135,15 +135,15 @@ RenderWidgetHostView* TabContentsViewGtk::CreateViewForWidget(
// Renderer target DnD. // Renderer target DnD.
drag_dest_.reset(new content::WebDragDestGtk(tab_contents_, content_view)); drag_dest_.reset(new content::WebDragDestGtk(tab_contents_, content_view));
if (view_wrapper_.get()) if (delegate_.get())
view_wrapper_->OnCreateViewForWidget(); delegate_->OnCreateViewForWidget();
return view; return view;
} }
gfx::NativeView TabContentsViewGtk::GetNativeView() const { gfx::NativeView TabContentsViewGtk::GetNativeView() const {
if (view_wrapper_.get()) if (delegate_.get())
return view_wrapper_->GetNativeView(); return delegate_->GetNativeView();
return expanded_.get(); return expanded_.get();
} }
...@@ -209,8 +209,8 @@ void TabContentsViewGtk::RenderViewCreated(RenderViewHost* host) { ...@@ -209,8 +209,8 @@ void TabContentsViewGtk::RenderViewCreated(RenderViewHost* host) {
void TabContentsViewGtk::Focus() { void TabContentsViewGtk::Focus() {
if (tab_contents_->ShowingInterstitialPage()) { if (tab_contents_->ShowingInterstitialPage()) {
tab_contents_->GetInterstitialPage()->Focus(); tab_contents_->GetInterstitialPage()->Focus();
} else if (wrapper()) { } else if (delegate_.get()) {
wrapper()->Focus(); delegate_->Focus();
} }
} }
...@@ -315,9 +315,9 @@ void TabContentsViewGtk::InsertIntoContentArea(GtkWidget* widget) { ...@@ -315,9 +315,9 @@ void TabContentsViewGtk::InsertIntoContentArea(GtkWidget* widget) {
gboolean TabContentsViewGtk::OnFocus(GtkWidget* widget, gboolean TabContentsViewGtk::OnFocus(GtkWidget* widget,
GtkDirectionType focus) { GtkDirectionType focus) {
// Give our view wrapper first chance at this event. // Give our view wrapper first chance at this event.
if (view_wrapper_.get()) { if (delegate_.get()) {
gboolean return_value = FALSE; gboolean return_value = FALSE;
if (view_wrapper_->OnNativeViewFocusEvent(widget, focus, &return_value)) if (delegate_->OnNativeViewFocusEvent(widget, focus, &return_value))
return return_value; return return_value;
} }
...@@ -385,8 +385,8 @@ void TabContentsViewGtk::ShowContextMenu( ...@@ -385,8 +385,8 @@ void TabContentsViewGtk::ShowContextMenu(
return; return;
} }
if (wrapper()) if (delegate_.get())
wrapper()->ShowContextMenu(params); delegate_->ShowContextMenu(params);
else else
DLOG(ERROR) << "Cannot show context menus without a delegate."; DLOG(ERROR) << "Cannot show context menus without a delegate.";
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
namespace content { namespace content {
class TabContentsViewWrapperGtk; class WebContentsViewGtkDelegate;
class WebDragDestDelegate; class WebDragDestDelegate;
class WebDragDestGtk; class WebDragDestGtk;
class WebDragSourceGtk; class WebDragSourceGtk;
...@@ -33,15 +33,15 @@ class CONTENT_EXPORT TabContentsViewGtk : public WebContentsView { ...@@ -33,15 +33,15 @@ class CONTENT_EXPORT TabContentsViewGtk : public WebContentsView {
// |wrapper| which creates an intermediary widget layer for features from the // |wrapper| which creates an intermediary widget layer for features from the
// Embedding layer that lives with the WebContentsView. // Embedding layer that lives with the WebContentsView.
// TODO(jam): make this take a WebContents once it's created from content. // TODO(jam): make this take a WebContents once it's created from content.
explicit TabContentsViewGtk(content::WebContents* web_contents, TabContentsViewGtk(content::WebContents* web_contents,
TabContentsViewWrapperGtk* wrapper); WebContentsViewGtkDelegate* delegate);
virtual ~TabContentsViewGtk(); virtual ~TabContentsViewGtk();
// Override the stored focus widget. This call only makes sense when the // Override the stored focus widget. This call only makes sense when the
// tab contents is not focused. // tab contents is not focused.
void SetFocusedWidget(GtkWidget* widget); void SetFocusedWidget(GtkWidget* widget);
TabContentsViewWrapperGtk* wrapper() const { return view_wrapper_.get(); } WebContentsViewGtkDelegate* delegate() const { return delegate_.get(); }
TabContents* tab_contents() { return tab_contents_; } TabContents* tab_contents() { return tab_contents_; }
GtkWidget* expanded_container() { return expanded_.get(); } GtkWidget* expanded_container() { return expanded_.get(); }
WebContents* web_contents(); WebContents* web_contents();
...@@ -149,7 +149,7 @@ class CONTENT_EXPORT TabContentsViewGtk : public WebContentsView { ...@@ -149,7 +149,7 @@ class CONTENT_EXPORT TabContentsViewGtk : public WebContentsView {
// Our optional views wrapper. If non-NULL, we return this widget as our // Our optional views wrapper. If non-NULL, we return this widget as our
// GetNativeView() and insert |expanded_| as its child in the GtkWidget // GetNativeView() and insert |expanded_| as its child in the GtkWidget
// hierarchy. // hierarchy.
scoped_ptr<TabContentsViewWrapperGtk> view_wrapper_; scoped_ptr<WebContentsViewGtkDelegate> delegate_;
// The size we want the tab contents view to be. We keep this in a separate // The size we want the tab contents view to be. We keep this in a separate
// variable because resizing in GTK+ is async. // variable because resizing in GTK+ is async.
......
...@@ -124,6 +124,7 @@ ...@@ -124,6 +124,7 @@
'public/browser/web_contents_observer.cc', 'public/browser/web_contents_observer.cc',
'public/browser/web_contents_observer.h', 'public/browser/web_contents_observer.h',
'public/browser/web_contents_view.h', 'public/browser/web_contents_view.h',
'public/browser/web_contents_view_gtk_delegate.h',
'public/browser/web_contents_view_mac_delegate.h', 'public/browser/web_contents_view_mac_delegate.h',
'public/browser/web_intents_dispatcher.h', 'public/browser/web_intents_dispatcher.h',
'public/browser/web_ui.h', 'public/browser/web_ui.h',
...@@ -647,7 +648,6 @@ ...@@ -647,7 +648,6 @@
'browser/tab_contents/tab_contents_view_gtk.h', 'browser/tab_contents/tab_contents_view_gtk.h',
'browser/tab_contents/tab_contents_view_helper.cc', 'browser/tab_contents/tab_contents_view_helper.cc',
'browser/tab_contents/tab_contents_view_helper.h', 'browser/tab_contents/tab_contents_view_helper.h',
'browser/tab_contents/tab_contents_view_wrapper_gtk.h',
'browser/tab_contents/title_updated_details.h', 'browser/tab_contents/title_updated_details.h',
'browser/tab_contents/web_contents_view_android.cc', 'browser/tab_contents/web_contents_view_android.cc',
'browser/tab_contents/web_contents_view_android.h', 'browser/tab_contents/web_contents_view_android.h',
...@@ -749,6 +749,12 @@ ...@@ -749,6 +749,12 @@
'../build/linux/system.gyp:x11', '../build/linux/system.gyp:x11',
'../dbus/dbus.gyp:dbus', '../dbus/dbus.gyp:dbus',
], ],
}, {
'sources!': [
# The rules only catch files that start or end with gtk, but this file
# would be incorrectly named if we forced the gtk at the end.
'public/browser/web_contents_view_gtk_delegate.h',
],
}], }],
['OS=="linux"', { ['OS=="linux"', {
'dependencies': [ 'dependencies': [
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_WRAPPER_GTK_H_ #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_GTK_DELEGATE_H_
#define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_WRAPPER_GTK_H_ #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_GTK_DELEGATE_H_
#pragma once #pragma once
#include <gtk/gtk.h> #include <gtk/gtk.h>
...@@ -20,9 +20,9 @@ struct ContextMenuParams; ...@@ -20,9 +20,9 @@ struct ContextMenuParams;
// An object that supplies the Gtk parent of TabContentsViewGtk. Embedders may // An object that supplies the Gtk parent of TabContentsViewGtk. Embedders may
// want to insert widgets that provide features that live with the // want to insert widgets that provide features that live with the
// TabContentsViewGtk. // TabContentsViewGtk.
class CONTENT_EXPORT TabContentsViewWrapperGtk { class CONTENT_EXPORT WebContentsViewGtkDelegate {
public: public:
// Initializes the TabContentsViewGtkWrapper by taking |view| and adding it // Initializes the WebContentsViewGtkDelegate by taking |view| and adding it
// this object's GtkContainer. // this object's GtkContainer.
virtual void WrapView(TabContentsViewGtk* view) = 0; virtual void WrapView(TabContentsViewGtk* view) = 0;
...@@ -37,7 +37,7 @@ class CONTENT_EXPORT TabContentsViewWrapperGtk { ...@@ -37,7 +37,7 @@ class CONTENT_EXPORT TabContentsViewWrapperGtk {
// Handles a focus event from the renderer process. // Handles a focus event from the renderer process.
virtual void Focus() = 0; virtual void Focus() = 0;
// Gives TabContentsViewGtkWrapper a first chance at focus events from our // Gives WebContentsViewGtkDelegate a first chance at focus events from our
// render widget host, before the main view invokes its default // render widget host, before the main view invokes its default
// behaviour. Returns TRUE if |return_value| has been set and that value // behaviour. Returns TRUE if |return_value| has been set and that value
// should be returned to GTK+. // should be returned to GTK+.
...@@ -49,9 +49,9 @@ class CONTENT_EXPORT TabContentsViewWrapperGtk { ...@@ -49,9 +49,9 @@ class CONTENT_EXPORT TabContentsViewWrapperGtk {
// specific crud. // specific crud.
virtual void ShowContextMenu(const content::ContextMenuParams& params) = 0; virtual void ShowContextMenu(const content::ContextMenuParams& params) = 0;
virtual ~TabContentsViewWrapperGtk() {} virtual ~WebContentsViewGtkDelegate() {}
}; };
} // namespace content } // namespace content
#endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_WRAPPER_GTK_H_ #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_GTK_DELEGATE_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment