summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-12 19:26:36 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-12 19:26:36 +0000
commit181a95ee9b85a31aec5521beb6b0bf25b71ac508 (patch)
tree65acadcf3545dbab11b907c890f5b33b1ed1d45e /chrome/browser
parent77826e7acb3517bf311f0b0f22e1ba1a759b1cd9 (diff)
downloadchromium_src-181a95ee9b85a31aec5521beb6b0bf25b71ac508.zip
chromium_src-181a95ee9b85a31aec5521beb6b0bf25b71ac508.tar.gz
chromium_src-181a95ee9b85a31aec5521beb6b0bf25b71ac508.tar.bz2
Get rid of the remaining implementation in TabContentsView and make all the methods be pure. This removes the dependency on RenderViewHostDelegateHelper, which is Chrome specific.
BUG=87702 Review URL: http://codereview.chromium.org/7285050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92217 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/chrome_content_browser_client.cc17
-rw-r--r--chrome/browser/chrome_content_browser_client.h6
-rw-r--r--chrome/browser/extensions/extension_host.cc9
-rw-r--r--chrome/browser/extensions/extension_host.h3
-rw-r--r--chrome/browser/notifications/balloon_host.cc10
-rw-r--r--chrome/browser/notifications/balloon_host.h4
-rw-r--r--chrome/browser/prerender/prerender_contents.h6
-rw-r--r--chrome/browser/tab_contents/background_contents.cc11
-rw-r--r--chrome/browser/tab_contents/background_contents.h4
-rw-r--r--chrome/browser/tab_contents/render_view_host_delegate_helper.cc71
-rw-r--r--chrome/browser/tab_contents/render_view_host_delegate_helper.h33
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_gtk.cc111
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_gtk.h25
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_mac.h30
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_mac.mm120
-rw-r--r--chrome/browser/ui/gtk/tab_contents_drag_source.cc36
-rw-r--r--chrome/browser/ui/gtk/tab_contents_drag_source.h9
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc2
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_view_touch.cc103
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h24
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc113
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_view_views.h24
22 files changed, 550 insertions, 221 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 51177de..3cc99b8 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -31,6 +31,7 @@
#include "chrome/browser/spellcheck_message_filter.h"
#include "chrome/browser/ssl/ssl_add_cert_handler.h"
#include "chrome/browser/ssl/ssl_blocking_page.h"
+#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
#include "chrome/browser/tab_contents/tab_contents_ssl_helper.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
@@ -634,6 +635,22 @@ bool ChromeContentBrowserClient::IsFastShutdownPossible() {
return !browser_command_line.HasSwitch(switches::kChromeFrame);
}
+WebPreferences ChromeContentBrowserClient::GetWebkitPrefs(Profile* profile,
+ bool is_web_ui) {
+ return RenderViewHostDelegateHelper::GetWebkitPrefs(profile, is_web_ui);
+}
+
+void ChromeContentBrowserClient::UpdateInspectorSetting(
+ RenderViewHost* rvh, const std::string& key, const std::string& value) {
+ RenderViewHostDelegateHelper::UpdateInspectorSetting(
+ rvh->process()->profile(), key, value);
+}
+
+void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) {
+ RenderViewHostDelegateHelper::ClearInspectorSettings(
+ rvh->process()->profile());
+}
+
#if defined(OS_LINUX)
int ChromeContentBrowserClient::GetCrashSignalFD(
const std::string& process_type) {
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index 8ab60c9..f03d7b7d 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -93,6 +93,12 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
virtual ResourceDispatcherHost* GetResourceDispatcherHost() OVERRIDE;
virtual ui::Clipboard* GetClipboard() OVERRIDE;
virtual bool IsFastShutdownPossible() OVERRIDE;
+ virtual WebPreferences GetWebkitPrefs(Profile* profile,
+ bool is_web_ui) OVERRIDE;
+ virtual void UpdateInspectorSetting(RenderViewHost* rvh,
+ const std::string& key,
+ const std::string& value) OVERRIDE;
+ virtual void ClearInspectorSettings(RenderViewHost* rvh) OVERRIDE;
#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Can return an optional fd for crash handling, otherwise returns -1.
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index 274ecbc..a09b1b1 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -301,15 +301,6 @@ void ExtensionHost::UpdatePreferredSize(const gfx::Size& new_size) {
view_->UpdatePreferredSize(new_size);
}
-void ExtensionHost::UpdateInspectorSetting(const std::string& key,
- const std::string& value) {
- RenderViewHostDelegateHelper::UpdateInspectorSetting(profile(), key, value);
-}
-
-void ExtensionHost::ClearInspectorSettings() {
- RenderViewHostDelegateHelper::ClearInspectorSettings(profile());
-}
-
void ExtensionHost::RenderViewGone(RenderViewHost* render_view_host,
base::TerminationStatus status,
int error_code) {
diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h
index 050001dc..2f66a1f 100644
--- a/chrome/browser/extensions/extension_host.h
+++ b/chrome/browser/extensions/extension_host.h
@@ -175,9 +175,6 @@ class ExtensionHost : public RenderViewHostDelegate,
virtual void GotFocus();
virtual void TakeFocus(bool reverse);
virtual void UpdatePreferredSize(const gfx::Size& new_size);
- virtual void UpdateInspectorSetting(const std::string& key,
- const std::string& value);
- virtual void ClearInspectorSettings();
// NotificationObserver
virtual void Observe(int type,
diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc
index 2728062..0c840a9 100644
--- a/chrome/browser/notifications/balloon_host.cc
+++ b/chrome/browser/notifications/balloon_host.cc
@@ -204,16 +204,6 @@ void BalloonHost::EnableWebUI() {
enable_web_ui_ = true;
}
-void BalloonHost::UpdateInspectorSetting(const std::string& key,
- const std::string& value) {
- RenderViewHostDelegateHelper::UpdateInspectorSetting(
- GetProfile(), key, value);
-}
-
-void BalloonHost::ClearInspectorSettings() {
- RenderViewHostDelegateHelper::ClearInspectorSettings(GetProfile());
-}
-
BalloonHost::~BalloonHost() {
DCHECK(!render_view_host_);
}
diff --git a/chrome/browser/notifications/balloon_host.h b/chrome/browser/notifications/balloon_host.h
index 849a550..4393665 100644
--- a/chrome/browser/notifications/balloon_host.h
+++ b/chrome/browser/notifications/balloon_host.h
@@ -102,10 +102,6 @@ class BalloonHost : public RenderViewHostDelegate,
// Enable Web UI. This has to be called before renderer is created.
void EnableWebUI();
- virtual void UpdateInspectorSetting(const std::string& key,
- const std::string& value);
- virtual void ClearInspectorSettings();
-
// Returns whether the associated render view is ready. Used only for testing.
bool IsRenderViewReady() const;
diff --git a/chrome/browser/prerender/prerender_contents.h b/chrome/browser/prerender/prerender_contents.h
index 97a6fce..0f40e4d 100644
--- a/chrome/browser/prerender/prerender_contents.h
+++ b/chrome/browser/prerender/prerender_contents.h
@@ -11,10 +11,11 @@
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
+#include "base/values.h"
#include "chrome/browser/prerender/prerender_final_status.h"
-#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
#include "chrome/browser/ui/download/download_tab_helper_delegate.h"
#include "content/browser/tab_contents/tab_contents_observer.h"
+#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/common/notification_registrar.h"
class RenderViewHost;
@@ -210,9 +211,6 @@ class PrerenderContents : public NotificationObserver,
// The prerender tracker tracking prerenders.
PrerenderTracker* prerender_tracker_;
- // Common implementations of some RenderViewHostDelegate::View methods.
- RenderViewHostDelegateViewHelper delegate_view_helper_;
-
// The URL being prerendered.
GURL prerender_url_;
diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc
index 2def274..dbd0dfb 100644
--- a/chrome/browser/tab_contents/background_contents.cc
+++ b/chrome/browser/tab_contents/background_contents.cc
@@ -145,17 +145,6 @@ gfx::NativeWindow BackgroundContents::GetDialogRootWindow() {
return NULL;
}
-void BackgroundContents::UpdateInspectorSetting(const std::string& key,
- const std::string& value) {
- Profile* profile = render_view_host_->process()->profile();
- RenderViewHostDelegateHelper::UpdateInspectorSetting(profile, key, value);
-}
-
-void BackgroundContents::ClearInspectorSettings() {
- Profile* profile = render_view_host_->process()->profile();
- RenderViewHostDelegateHelper::ClearInspectorSettings(profile);
-}
-
void BackgroundContents::Close(RenderViewHost* render_view_host) {
Profile* profile = render_view_host->process()->profile();
NotificationService::current()->Notify(
diff --git a/chrome/browser/tab_contents/background_contents.h b/chrome/browser/tab_contents/background_contents.h
index 05e59cf..70085f2 100644
--- a/chrome/browser/tab_contents/background_contents.h
+++ b/chrome/browser/tab_contents/background_contents.h
@@ -119,10 +119,6 @@ class BackgroundContents : public RenderViewHostDelegate,
const string16& user_input) OVERRIDE;
virtual gfx::NativeWindow GetDialogRootWindow() OVERRIDE;
- virtual void UpdateInspectorSetting(const std::string& key,
- const std::string& value);
- virtual void ClearInspectorSettings();
-
// Helper to find the BackgroundContents that originated the given request.
// Can be NULL if the page has been closed or some other error occurs.
// Should only be called from the UI thread, since it accesses
diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
index e2e2bc3..6d76c21 100644
--- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
+++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
@@ -30,9 +30,11 @@
#include "content/browser/renderer_host/render_widget_host_view.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/tab_contents.h"
+#include "content/browser/tab_contents/tab_contents_delegate.h"
#include "content/browser/tab_contents/tab_contents_view.h"
#include "content/browser/webui/web_ui.h"
#include "content/common/notification_service.h"
+#include "content/common/view_messages.h"
#include "net/base/network_change_notifier.h"
RenderViewHostDelegateViewHelper::RenderViewHostDelegateViewHelper() {
@@ -222,6 +224,75 @@ RenderWidgetHostView* RenderViewHostDelegateViewHelper::GetCreatedWidget(
return widget_host_view;
}
+TabContents* RenderViewHostDelegateViewHelper::CreateNewWindowFromTabContents(
+ TabContents* tab_contents,
+ int route_id,
+ const ViewHostMsg_CreateWindow_Params& params) {
+ TabContents* new_contents = CreateNewWindow(
+ route_id,
+ tab_contents->profile(),
+ tab_contents->GetSiteInstance(),
+ tab_contents->GetWebUITypeForCurrentState(),
+ tab_contents,
+ params.window_container_type,
+ params.frame_name);
+
+ if (new_contents) {
+ NotificationService::current()->Notify(
+ content::NOTIFICATION_CREATING_NEW_WINDOW,
+ Source<TabContents>(tab_contents),
+ Details<const ViewHostMsg_CreateWindow_Params>(&params));
+
+ if (tab_contents->delegate())
+ tab_contents->delegate()->TabContentsCreated(new_contents);
+ } else {
+ NotificationService::current()->Notify(
+ content::NOTIFICATION_CREATING_NEW_WINDOW_CANCELLED,
+ Source<TabContents>(tab_contents),
+ Details<const ViewHostMsg_CreateWindow_Params>(&params));
+ }
+
+ return new_contents;
+}
+
+TabContents* RenderViewHostDelegateViewHelper::ShowCreatedWindow(
+ TabContents* tab_contents,
+ int route_id,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture) {
+ TabContents* contents = GetCreatedWindow(route_id);
+ if (contents) {
+ tab_contents->AddNewContents(
+ contents, disposition, initial_pos, user_gesture);
+ }
+ return contents;
+}
+
+RenderWidgetHostView* RenderViewHostDelegateViewHelper::ShowCreatedWidget(
+ TabContents* tab_contents, int route_id, const gfx::Rect& initial_pos) {
+ if (tab_contents->delegate())
+ tab_contents->delegate()->RenderWidgetShowing();
+
+ RenderWidgetHostView* widget_host_view = GetCreatedWidget(route_id);
+ widget_host_view->InitAsPopup(tab_contents->GetRenderWidgetHostView(),
+ initial_pos);
+ widget_host_view->GetRenderWidgetHost()->Init();
+ return widget_host_view;
+}
+
+RenderWidgetHostView*
+ RenderViewHostDelegateViewHelper::ShowCreatedFullscreenWidget(
+ TabContents* tab_contents, int route_id) {
+ if (tab_contents->delegate())
+ tab_contents->delegate()->RenderWidgetShowing();
+
+ RenderWidgetHostView* widget_host_view = GetCreatedWidget(route_id);
+ widget_host_view->InitAsFullscreen();
+ widget_host_view->GetRenderWidgetHost()->Init();
+ return widget_host_view;
+}
+
// static
WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs(
Profile* profile, bool is_web_ui) {
diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.h b/chrome/browser/tab_contents/render_view_host_delegate_helper.h
index a2b2bf6..a5d37f1 100644
--- a/chrome/browser/tab_contents/render_view_host_delegate_helper.h
+++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.h
@@ -27,6 +27,7 @@ class RenderWidgetHost;
class RenderWidgetHostView;
class SiteInstance;
class TabContents;
+struct ViewHostMsg_CreateWindow_Params;
// Provides helper methods that provide common implementations of some
// RenderViewHostDelegate::View methods.
@@ -39,7 +40,7 @@ class RenderViewHostDelegateViewHelper : public NotificationObserver {
// BackgroundContents (if the window_container_type ==
// WINDOW_CONTAINER_TYPE_BACKGROUND and permissions allow) or a TabContents.
// If a TabContents is created, it is returned. Otherwise NULL is returned.
- virtual TabContents* CreateNewWindow(
+ TabContents* CreateNewWindow(
int route_id,
Profile* profile,
SiteInstance* site,
@@ -50,23 +51,41 @@ class RenderViewHostDelegateViewHelper : public NotificationObserver {
// Creates a new RenderWidgetHost and saves it for later retrieval by
// GetCreatedWidget.
- virtual RenderWidgetHostView* CreateNewWidget(int route_id,
- WebKit::WebPopupType popup_type,
- RenderProcessHost* process);
+ RenderWidgetHostView* CreateNewWidget(int route_id,
+ WebKit::WebPopupType popup_type,
+ RenderProcessHost* process);
- virtual RenderWidgetHostView* CreateNewFullscreenWidget(
+ RenderWidgetHostView* CreateNewFullscreenWidget(
int route_id, RenderProcessHost* process);
// Finds the new RenderWidgetHost and returns it. Note that this can only be
// called once as this call also removes it from the internal map.
- virtual RenderWidgetHostView* GetCreatedWidget(int route_id);
+ RenderWidgetHostView* GetCreatedWidget(int route_id);
// Finds the new RenderViewHost/Delegate by route_id, initializes it for
// for renderer-initiated creation, and returns the TabContents that needs
// to be shown, if there is one (i.e. not a BackgroundContents). Note that
// this can only be called once as this call also removes it from the internal
// map.
- virtual TabContents* GetCreatedWindow(int route_id);
+ TabContents* GetCreatedWindow(int route_id);
+
+ // These methods are meant to be called from TabContentsView implementations.
+ // They take care of notifying the TabContentsDelegate.
+ TabContents* CreateNewWindowFromTabContents(
+ TabContents* tab_contents,
+ int route_id,
+ const ViewHostMsg_CreateWindow_Params& params);
+ // Mirrors the RenderViewHostDelegate::View Show methods.
+ TabContents* ShowCreatedWindow(TabContents* tab_contents,
+ int route_id,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture);
+ RenderWidgetHostView* ShowCreatedWidget(TabContents* tab_contents,
+ int route_id,
+ const gfx::Rect& initial_pos);
+ RenderWidgetHostView* ShowCreatedFullscreenWidget(TabContents* tab_contents,
+ int route_id);
private:
// NotificationObserver implementation
diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/tab_contents/tab_contents_view_gtk.cc
index 312f820..6de5a95 100644
--- a/chrome/browser/tab_contents/tab_contents_view_gtk.cc
+++ b/chrome/browser/tab_contents/tab_contents_view_gtk.cc
@@ -84,7 +84,7 @@ TabContentsView* TabContentsView::Create(TabContents* tab_contents) {
}
TabContentsViewGtk::TabContentsViewGtk(TabContents* tab_contents)
- : TabContentsView(tab_contents),
+ : tab_contents_(tab_contents),
floating_(gtk_floating_container_new()),
expanded_(gtk_expanded_container_new()),
constrained_window_(NULL) {
@@ -101,7 +101,7 @@ TabContentsViewGtk::TabContentsViewGtk(TabContents* tab_contents)
gtk_widget_show(floating_.get());
registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_CONNECTED,
Source<TabContents>(tab_contents));
- drag_source_.reset(new TabContentsDragSource(this));
+ drag_source_.reset(new TabContentsDragSource(tab_contents));
}
TabContentsViewGtk::~TabContentsViewGtk() {
@@ -148,17 +148,17 @@ RenderWidgetHostView* TabContentsViewGtk::CreateViewForWidget(
gfx::NativeView content_view = view->native_view();
g_signal_connect(content_view, "focus", G_CALLBACK(OnFocusThunk), this);
g_signal_connect(content_view, "leave-notify-event",
- G_CALLBACK(OnLeaveNotify), tab_contents());
+ G_CALLBACK(OnLeaveNotify), tab_contents_);
g_signal_connect(content_view, "motion-notify-event",
- G_CALLBACK(OnMouseMove), tab_contents());
+ G_CALLBACK(OnMouseMove), tab_contents_);
g_signal_connect(content_view, "scroll-event",
- G_CALLBACK(OnMouseScroll), tab_contents());
+ G_CALLBACK(OnMouseScroll), tab_contents_);
gtk_widget_add_events(content_view, GDK_LEAVE_NOTIFY_MASK |
GDK_POINTER_MOTION_MASK);
InsertIntoContentArea(content_view);
// Renderer target DnD.
- drag_dest_.reset(new WebDragDestGtk(tab_contents(), content_view));
+ drag_dest_.reset(new WebDragDestGtk(tab_contents_, content_view));
return view;
}
@@ -168,7 +168,7 @@ gfx::NativeView TabContentsViewGtk::GetNativeView() const {
}
gfx::NativeView TabContentsViewGtk::GetContentNativeView() const {
- RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView();
+ RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView();
if (!rwhv)
return NULL;
return rwhv->GetNativeView();
@@ -202,9 +202,9 @@ void TabContentsViewGtk::SetPageTitle(const std::wstring& title) {
void TabContentsViewGtk::OnTabCrashed(base::TerminationStatus status,
int error_code) {
- if (tab_contents() != NULL && !sad_tab_.get()) {
+ if (tab_contents_ != NULL && !sad_tab_.get()) {
sad_tab_.reset(new SadTabGtk(
- tab_contents(),
+ tab_contents_,
status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ?
SadTabGtk::KILLED : SadTabGtk::CRASHED));
InsertIntoContentArea(sad_tab_->widget());
@@ -217,14 +217,17 @@ void TabContentsViewGtk::SizeContents(const gfx::Size& size) {
// need to pass the sizing information on to the RWHV which will pass the
// sizing information on to the renderer.
requested_size_ = size;
- RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView();
+ RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView();
if (rwhv)
rwhv->SetSize(size);
}
+void TabContentsViewGtk::RenderViewCreated(RenderViewHost* host) {
+}
+
void TabContentsViewGtk::Focus() {
- if (tab_contents()->showing_interstitial_page()) {
- tab_contents()->interstitial_page()->Focus();
+ if (tab_contents_->showing_interstitial_page()) {
+ tab_contents_->interstitial_page()->Focus();
} else if (!constrained_window_) {
GtkWidget* widget = GetContentNativeView();
if (widget)
@@ -233,8 +236,8 @@ void TabContentsViewGtk::Focus() {
}
void TabContentsViewGtk::SetInitialFocus() {
- if (tab_contents()->FocusLocationBarByDefault())
- tab_contents()->SetFocusToLocationBar(false);
+ if (tab_contents_->FocusLocationBarByDefault())
+ tab_contents_->SetFocusToLocationBar(false);
else
Focus();
}
@@ -250,6 +253,23 @@ void TabContentsViewGtk::RestoreFocus() {
SetInitialFocus();
}
+void TabContentsViewGtk::UpdatePreferredSize(const gfx::Size& pref_size) {
+}
+
+bool TabContentsViewGtk::IsDoingDrag() const {
+ return false;
+}
+
+void TabContentsViewGtk::CancelDragAndCloseTab() {
+}
+
+bool TabContentsViewGtk::IsEventTracking() const {
+ return false;
+}
+
+void TabContentsViewGtk::CloseTabAfterEventTracking() {
+}
+
void TabContentsViewGtk::GetViewBounds(gfx::Rect* out) const {
if (!floating_->window) {
out->SetRect(0, 0, requested_size_.width(), requested_size_.height());
@@ -276,7 +296,7 @@ void TabContentsViewGtk::GotFocus() {
// This is called when we the renderer asks us to take focus back (i.e., it has
// iterated past the last focusable element on the page).
void TabContentsViewGtk::TakeFocus(bool reverse) {
- if (!tab_contents()->delegate()->TakeFocus(reverse)) {
+ if (!tab_contents_->delegate()->TakeFocus(reverse)) {
gtk_widget_child_focus(GTK_WIDGET(GetTopLevelNativeWindow()),
reverse ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD);
}
@@ -299,6 +319,43 @@ void TabContentsViewGtk::Observe(int type,
}
}
+
+void TabContentsViewGtk::CreateNewWindow(
+ int route_id,
+ const ViewHostMsg_CreateWindow_Params& params) {
+ delegate_view_helper_.CreateNewWindowFromTabContents(
+ tab_contents_, route_id, params);
+}
+
+void TabContentsViewGtk::CreateNewWidget(
+ int route_id, WebKit::WebPopupType popup_type) {
+ delegate_view_helper_.CreateNewWidget(route_id, popup_type,
+ tab_contents_->render_view_host()->process());
+}
+
+void TabContentsViewGtk::CreateNewFullscreenWidget(int route_id) {
+ delegate_view_helper_.CreateNewFullscreenWidget(
+ route_id, tab_contents_->render_view_host()->process());
+}
+
+void TabContentsViewGtk::ShowCreatedWindow(int route_id,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture) {
+ delegate_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, initial_pos);
+}
+
+void TabContentsViewGtk::ShowCreatedFullscreenWidget(int route_id) {
+ delegate_view_helper_.ShowCreatedFullscreenWidget(tab_contents_, route_id);
+}
+
void TabContentsViewGtk::ShowContextMenu(const ContextMenuParams& params) {
// 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
@@ -308,7 +365,7 @@ void TabContentsViewGtk::ShowContextMenu(const ContextMenuParams& params) {
if (params.custom_context.render_widget_id !=
webkit_glue::CustomContextMenuContext::kCurrentRenderWidget) {
IPC::Channel::Listener* listener =
- tab_contents()->render_view_host()->process()->GetListenerByID(
+ tab_contents_->render_view_host()->process()->GetListenerByID(
params.custom_context.render_widget_id);
if (!listener) {
NOTREACHED();
@@ -316,7 +373,7 @@ void TabContentsViewGtk::ShowContextMenu(const ContextMenuParams& params) {
}
view = static_cast<RenderWidgetHost*>(listener)->view();
} else {
- view = tab_contents()->GetRenderWidgetHostView();
+ view = tab_contents_->GetRenderWidgetHostView();
}
RenderWidgetHostViewGtk* view_gtk =
static_cast<RenderWidgetHostViewGtk*>(view);
@@ -324,7 +381,7 @@ void TabContentsViewGtk::ShowContextMenu(const ContextMenuParams& params) {
return;
context_menu_.reset(new RenderViewContextMenuGtk(
- tab_contents(), params, view_gtk->last_mouse_down()->time));
+ tab_contents_, params, view_gtk->last_mouse_down()->time));
context_menu_->Init();
gfx::Rect bounds;
@@ -354,7 +411,7 @@ void TabContentsViewGtk::StartDragging(const WebDropData& drop_data,
DCHECK(GetContentNativeView());
RenderWidgetHostViewGtk* view_gtk = static_cast<RenderWidgetHostViewGtk*>(
- tab_contents()->GetRenderWidgetHostView());
+ tab_contents_->GetRenderWidgetHostView());
if (!view_gtk || !view_gtk->last_mouse_down())
return;
@@ -396,16 +453,16 @@ gboolean TabContentsViewGtk::OnFocus(GtkWidget* widget,
gtk_widget_grab_focus(widget);
bool reverse = focus == GTK_DIR_TAB_BACKWARD;
- tab_contents()->FocusThroughTabTraversal(reverse);
+ tab_contents_->FocusThroughTabTraversal(reverse);
return TRUE;
}
void TabContentsViewGtk::OnChildSizeRequest(GtkWidget* widget,
GtkWidget* child,
GtkRequisition* requisition) {
- if (tab_contents()->delegate()) {
+ if (tab_contents_->delegate()) {
requisition->height +=
- tab_contents()->delegate()->GetExtraRenderViewHeight();
+ tab_contents_->delegate()->GetExtraRenderViewHeight();
}
}
@@ -414,18 +471,18 @@ void TabContentsViewGtk::OnSizeAllocate(GtkWidget* widget,
int width = allocation->width;
int height = allocation->height;
// |delegate()| can be NULL here during browser teardown.
- if (tab_contents()->delegate())
- height += tab_contents()->delegate()->GetExtraRenderViewHeight();
+ if (tab_contents_->delegate())
+ height += tab_contents_->delegate()->GetExtraRenderViewHeight();
gfx::Size size(width, height);
requested_size_ = size;
// We manually tell our RWHV to resize the renderer content. This avoids
// spurious resizes from GTK+.
- RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView();
+ RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView();
if (rwhv)
rwhv->SetSize(size);
- if (tab_contents()->interstitial_page())
- tab_contents()->interstitial_page()->SetSize(size);
+ if (tab_contents_->interstitial_page())
+ tab_contents_->interstitial_page()->SetSize(size);
}
void TabContentsViewGtk::OnSetFloatingPosition(
diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.h b/chrome/browser/tab_contents/tab_contents_view_gtk.h
index 33da82f..3aafee9 100644
--- a/chrome/browser/tab_contents/tab_contents_view_gtk.h
+++ b/chrome/browser/tab_contents/tab_contents_view_gtk.h
@@ -11,6 +11,7 @@
#include <vector>
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
#include "chrome/browser/ui/gtk/focus_store_gtk.h"
#include "chrome/browser/ui/gtk/owned_widget_gtk.h"
#include "content/browser/tab_contents/tab_contents_view.h"
@@ -56,13 +57,30 @@ class TabContentsViewGtk : public TabContentsView,
virtual void OnTabCrashed(base::TerminationStatus status,
int error_code);
virtual void SizeContents(const gfx::Size& size);
+ virtual void RenderViewCreated(RenderViewHost* host);
virtual void Focus();
virtual void SetInitialFocus();
virtual void StoreFocus();
virtual void RestoreFocus();
+ virtual void UpdatePreferredSize(const gfx::Size& pref_size);
+ virtual bool IsDoingDrag() const;
+ virtual void CancelDragAndCloseTab();
+ virtual bool IsEventTracking() const;
+ virtual void CloseTabAfterEventTracking();
virtual void GetViewBounds(gfx::Rect* out) const;
// Backend implementation of RenderViewHostDelegate::View.
+ virtual void CreateNewWindow(
+ int route_id,
+ const ViewHostMsg_CreateWindow_Params& params);
+ virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type);
+ virtual void CreateNewFullscreenWidget(int route_id);
+ virtual void ShowCreatedWindow(int route_id,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture);
+ virtual void ShowCreatedWidget(int route_id, const gfx::Rect& initial_pos);
+ virtual void ShowCreatedFullscreenWidget(int route_id);
virtual void ShowContextMenu(const ContextMenuParams& params);
virtual void ShowPopupMenu(const gfx::Rect& bounds,
int item_height,
@@ -109,6 +127,13 @@ class TabContentsViewGtk : public TabContentsView,
CHROMEGTK_CALLBACK_1(TabContentsViewGtk, void, OnSetFloatingPosition,
GtkAllocation*);
+ // The TabContents whose contents we display.
+ TabContents* tab_contents_;
+
+ // Common implementations of some RenderViewHostDelegate::View methods.
+ RenderViewHostDelegateViewHelper delegate_view_helper_;
+
+
// Contains |expanded_| as its GtkBin member.
OwnedWidgetGtk floating_;
diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.h b/chrome/browser/tab_contents/tab_contents_view_mac.h
index 6714cf7..4a91b76f 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.h
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.h
@@ -12,6 +12,7 @@
#include <vector>
#include "base/memory/scoped_nsobject.h"
+#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
#include "chrome/browser/ui/cocoa/base_view.h"
#include "content/browser/tab_contents/tab_contents_view.h"
#include "content/common/notification_observer.h"
@@ -69,20 +70,24 @@ class TabContentsViewMac : public TabContentsView,
virtual void StoreFocus();
virtual void RestoreFocus();
virtual void UpdatePreferredSize(const gfx::Size& pref_size);
- virtual RenderWidgetHostView* CreateNewWidgetInternal(
- int route_id,
- WebKit::WebPopupType popup_type);
- virtual void ShowCreatedWidgetInternal(RenderWidgetHostView* widget_host_view,
- const gfx::Rect& initial_pos);
-
- virtual RenderWidgetHostView* CreateNewFullscreenWidgetInternal(int route_id);
- virtual void ShowCreatedFullscreenWidgetInternal(
- RenderWidgetHostView* widget_host_view);
+ virtual bool IsDoingDrag() const;
+ virtual void CancelDragAndCloseTab();
virtual bool IsEventTracking() const;
virtual void CloseTabAfterEventTracking();
virtual void GetViewBounds(gfx::Rect* out) const;
// Backend implementation of RenderViewHostDelegate::View.
+ virtual void CreateNewWindow(
+ int route_id,
+ const ViewHostMsg_CreateWindow_Params& params);
+ virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type);
+ virtual void CreateNewFullscreenWidget(int route_id);
+ virtual void ShowCreatedWindow(int route_id,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture);
+ virtual void ShowCreatedWidget(int route_id, const gfx::Rect& initial_pos);
+ virtual void ShowCreatedFullscreenWidget(int route_id);
virtual void ShowContextMenu(const ContextMenuParams& params);
virtual void ShowPopupMenu(const gfx::Rect& bounds,
int item_height,
@@ -108,9 +113,16 @@ class TabContentsViewMac : public TabContentsView,
// CloseTabAfterEventTracking() implementation.
void CloseTab();
+ TabContents* tab_contents() { return tab_contents_; }
int preferred_width() const { return preferred_width_; }
private:
+ // The TabContents whose contents we display.
+ TabContents* tab_contents_;
+
+ // Common implementations of some RenderViewHostDelegate::View methods.
+ RenderViewHostDelegateViewHelper delegate_view_helper_;
+
// The Cocoa NSView that lives in the view hierarchy.
scoped_nsobject<TabContentsViewCocoa> 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 59651f7..b0bb75a 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.mm
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm
@@ -67,7 +67,7 @@ TabContentsView* TabContentsView::Create(TabContents* tab_contents) {
}
TabContentsViewMac::TabContentsViewMac(TabContents* tab_contents)
- : TabContentsView(tab_contents),
+ : tab_contents_(tab_contents),
preferred_width_(0) {
registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_CONNECTED,
Source<TabContents>(tab_contents));
@@ -128,7 +128,7 @@ gfx::NativeView TabContentsViewMac::GetNativeView() const {
}
gfx::NativeView TabContentsViewMac::GetContentNativeView() const {
- RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView();
+ RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView();
if (!rwhv)
return NULL;
return rwhv->GetNativeView();
@@ -180,11 +180,10 @@ void TabContentsViewMac::SetPageTitle(const std::wstring& title) {
void TabContentsViewMac::OnTabCrashed(base::TerminationStatus /* status */,
int /* error_code */) {
if (!sad_tab_.get()) {
- TabContents* contents = tab_contents();
- DCHECK(contents);
- if (contents) {
+ DCHECK(tab_contents_);
+ if (tab_contents_) {
SadTabController* sad_tab =
- [[SadTabController alloc] initWithTabContents:contents
+ [[SadTabController alloc] initWithTabContents:tab_contents_
superview:cocoa_view_];
sad_tab_.reset(sad_tab);
}
@@ -205,8 +204,8 @@ void TabContentsViewMac::Focus() {
}
void TabContentsViewMac::SetInitialFocus() {
- if (tab_contents()->FocusLocationBarByDefault())
- tab_contents()->SetFocusToLocationBar(false);
+ if (tab_contents_->FocusLocationBarByDefault())
+ tab_contents_->SetFocusToLocationBar(false);
else
[[cocoa_view_.get() window] makeFirstResponder:GetContentNativeView()];
}
@@ -238,6 +237,13 @@ void TabContentsViewMac::UpdatePreferredSize(const gfx::Size& pref_size) {
preferred_width_ = pref_size.width();
}
+bool TabContentsViewMac::IsDoingDrag() const {
+ return false;
+}
+
+void TabContentsViewMac::CancelDragAndCloseTab() {
+}
+
void TabContentsViewMac::UpdateDragCursor(WebDragOperation operation) {
[cocoa_view_ setCurrentDragOperation: operation];
}
@@ -257,44 +263,49 @@ void TabContentsViewMac::TakeFocus(bool reverse) {
}
}
-void TabContentsViewMac::ShowContextMenu(const ContextMenuParams& params) {
- RenderViewContextMenuMac menu(tab_contents(),
- params,
- GetContentNativeView());
- menu.Init();
+void TabContentsViewMac::CreateNewWindow(
+ int route_id,
+ const ViewHostMsg_CreateWindow_Params& params) {
+ delegate_view_helper_.CreateNewWindowFromTabContents(
+ tab_contents_, route_id, params);
}
-// Display a popup menu for WebKit using Cocoa widgets.
-void TabContentsViewMac::ShowPopupMenu(
- const gfx::Rect& bounds,
- int item_height,
- double item_font_size,
- int selected_item,
- const std::vector<WebMenuItem>& items,
- bool right_aligned) {
- PopupMenuHelper popup_menu_helper(tab_contents()->render_view_host());
- popup_menu_helper.ShowPopupMenu(bounds, item_height, item_font_size,
- selected_item, items, right_aligned);
-}
+void TabContentsViewMac::CreateNewWidget(
+ int route_id, WebKit::WebPopupType popup_type) {
+ RenderWidgetHostView* widget_view = delegate_view_helper_.CreateNewWidget(
+ route_id, popup_type, tab_contents_->render_view_host()->process());
-RenderWidgetHostView* TabContentsViewMac::CreateNewWidgetInternal(
- int route_id,
- WebKit::WebPopupType popup_type) {
// A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it
// to allow it to survive the trip without being hosted.
+ RenderWidgetHostViewMac* widget_view_mac =
+ static_cast<RenderWidgetHostViewMac*>(widget_view);
+ [widget_view_mac->native_view() retain];
+}
+
+void TabContentsViewMac::CreateNewFullscreenWidget(int route_id) {
RenderWidgetHostView* widget_view =
- TabContentsView::CreateNewWidgetInternal(route_id, popup_type);
+ delegate_view_helper_.CreateNewFullscreenWidget(
+ route_id, tab_contents_->render_view_host()->process());
+
+ // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it
+ // to allow it to survive the trip without being hosted.
RenderWidgetHostViewMac* widget_view_mac =
static_cast<RenderWidgetHostViewMac*>(widget_view);
[widget_view_mac->native_view() retain];
+}
- return widget_view;
+void TabContentsViewMac::ShowCreatedWindow(int route_id,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture) {
+ delegate_view_helper_.ShowCreatedWindow(
+ tab_contents_, route_id, disposition, initial_pos, user_gesture);
}
-void TabContentsViewMac::ShowCreatedWidgetInternal(
- RenderWidgetHostView* widget_host_view,
- const gfx::Rect& initial_pos) {
- TabContentsView::ShowCreatedWidgetInternal(widget_host_view, initial_pos);
+void TabContentsViewMac::ShowCreatedWidget(
+ int route_id, const gfx::Rect& initial_pos) {
+ RenderWidgetHostView* widget_host_view = delegate_view_helper_.
+ ShowCreatedWidget(tab_contents_, route_id, 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
@@ -304,22 +315,9 @@ void TabContentsViewMac::ShowCreatedWidgetInternal(
[widget_view_mac->native_view() release];
}
-RenderWidgetHostView* TabContentsViewMac::CreateNewFullscreenWidgetInternal(
- int route_id) {
- // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it
- // to allow it to survive the trip without being hosted.
- RenderWidgetHostView* widget_view =
- TabContentsView::CreateNewFullscreenWidgetInternal(route_id);
- RenderWidgetHostViewMac* widget_view_mac =
- static_cast<RenderWidgetHostViewMac*>(widget_view);
- [widget_view_mac->native_view() retain];
-
- return widget_view;
-}
-
-void TabContentsViewMac::ShowCreatedFullscreenWidgetInternal(
- RenderWidgetHostView* widget_host_view) {
- TabContentsView::ShowCreatedFullscreenWidgetInternal(widget_host_view);
+void TabContentsViewMac::ShowCreatedFullscreenWidget(int route_id) {
+ RenderWidgetHostView* widget_host_view = delegate_view_helper_.
+ ShowCreatedFullscreenWidget(tab_contents_, route_id);
// A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's
// properly embedded (or purposely ignored) we can release the retain we took
@@ -329,6 +327,26 @@ void TabContentsViewMac::ShowCreatedFullscreenWidgetInternal(
[widget_view_mac->native_view() release];
}
+void TabContentsViewMac::ShowContextMenu(const ContextMenuParams& params) {
+ RenderViewContextMenuMac menu(tab_contents_,
+ params,
+ GetContentNativeView());
+ menu.Init();
+}
+
+// Display a popup menu for WebKit using Cocoa widgets.
+void TabContentsViewMac::ShowPopupMenu(
+ const gfx::Rect& bounds,
+ int item_height,
+ double item_font_size,
+ int selected_item,
+ const std::vector<WebMenuItem>& items,
+ bool right_aligned) {
+ PopupMenuHelper popup_menu_helper(tab_contents_->render_view_host());
+ popup_menu_helper.ShowPopupMenu(bounds, item_height, item_font_size,
+ selected_item, items, right_aligned);
+}
+
bool TabContentsViewMac::IsEventTracking() const {
if ([NSApp isKindOfClass:[CrApplication class]] &&
[static_cast<CrApplication*>(NSApp) isHandlingSendEvent]) {
@@ -354,7 +372,7 @@ void TabContentsViewMac::GetViewBounds(gfx::Rect* out) const {
}
void TabContentsViewMac::CloseTab() {
- tab_contents()->Close(tab_contents()->render_view_host());
+ tab_contents_->Close(tab_contents_->render_view_host());
}
void TabContentsViewMac::Observe(int type,
diff --git a/chrome/browser/ui/gtk/tab_contents_drag_source.cc b/chrome/browser/ui/gtk/tab_contents_drag_source.cc
index 5018842..5cff95c 100644
--- a/chrome/browser/ui/gtk/tab_contents_drag_source.cc
+++ b/chrome/browser/ui/gtk/tab_contents_drag_source.cc
@@ -28,9 +28,8 @@ using WebKit::WebDragOperation;
using WebKit::WebDragOperationsMask;
using WebKit::WebDragOperationNone;
-TabContentsDragSource::TabContentsDragSource(
- TabContentsView* tab_contents_view)
- : tab_contents_view_(tab_contents_view),
+TabContentsDragSource::TabContentsDragSource(TabContents* tab_contents)
+ : tab_contents_(tab_contents),
drag_pixbuf_(NULL),
drag_failed_(false),
drag_widget_(gtk_invisible_new()),
@@ -63,10 +62,6 @@ TabContentsDragSource::~TabContentsDragSource() {
gtk_widget_destroy(drag_icon_);
}
-TabContents* TabContentsDragSource::tab_contents() const {
- return tab_contents_view_->tab_contents();
-}
-
void TabContentsDragSource::StartDragging(const WebDropData& drop_data,
WebDragOperationsMask allowed_ops,
GdkEventButton* last_mouse_down,
@@ -75,7 +70,7 @@ void TabContentsDragSource::StartDragging(const WebDropData& drop_data,
// Guard against re-starting before previous drag completed.
if (drag_context_) {
NOTREACHED();
- tab_contents()->SystemDragEnded();
+ tab_contents_->SystemDragEnded();
return;
}
@@ -142,7 +137,7 @@ void TabContentsDragSource::StartDragging(const WebDropData& drop_data,
if (!drag_context_) {
drag_failed_ = true;
drop_data_.reset();
- tab_contents()->SystemDragEnded();
+ tab_contents_->SystemDragEnded();
return;
}
@@ -160,8 +155,8 @@ void TabContentsDragSource::DidProcessEvent(GdkEvent* event) {
GdkEventMotion* event_motion = reinterpret_cast<GdkEventMotion*>(event);
gfx::Point client = gtk_util::ClientPoint(GetContentNativeView());
- if (tab_contents()->render_view_host()) {
- tab_contents()->render_view_host()->DragSourceMovedTo(
+ if (tab_contents_->render_view_host()) {
+ tab_contents_->render_view_host()->DragSourceMovedTo(
client.x(), client.y(),
static_cast<int>(event_motion->x_root),
static_cast<int>(event_motion->y_root));
@@ -240,14 +235,13 @@ void TabContentsDragSource::OnDragDataGet(GtkWidget* sender,
drag_download_util::CreateFileStreamForDrop(&file_path);
if (file_stream) {
// Start downloading the file to the stream.
- TabContents* tab_contents = tab_contents_view_->tab_contents();
scoped_refptr<DragDownloadFile> drag_file_downloader =
new DragDownloadFile(file_path,
linked_ptr<net::FileStream>(file_stream),
download_url_,
- tab_contents->GetURL(),
- tab_contents->encoding(),
- tab_contents);
+ tab_contents_->GetURL(),
+ tab_contents_->encoding(),
+ tab_contents_);
drag_file_downloader->Start(
new drag_download_util::PromiseFileFinalizer(
drag_file_downloader));
@@ -280,8 +274,8 @@ gboolean TabContentsDragSource::OnDragFailed(GtkWidget* sender,
gfx::Point root = gtk_util::ScreenPoint(GetContentNativeView());
gfx::Point client = gtk_util::ClientPoint(GetContentNativeView());
- if (tab_contents()->render_view_host()) {
- tab_contents()->render_view_host()->DragSourceEndedAt(
+ if (tab_contents_->render_view_host()) {
+ tab_contents_->render_view_host()->DragSourceEndedAt(
client.x(), client.y(), root.x(), root.y(),
WebDragOperationNone);
}
@@ -349,21 +343,21 @@ void TabContentsDragSource::OnDragEnd(GtkWidget* sender,
gfx::Point root = gtk_util::ScreenPoint(GetContentNativeView());
gfx::Point client = gtk_util::ClientPoint(GetContentNativeView());
- if (tab_contents()->render_view_host()) {
- tab_contents()->render_view_host()->DragSourceEndedAt(
+ if (tab_contents_->render_view_host()) {
+ tab_contents_->render_view_host()->DragSourceEndedAt(
client.x(), client.y(), root.x(), root.y(),
gtk_util::GdkDragActionToWebDragOp(drag_context->action));
}
}
- tab_contents()->SystemDragEnded();
+ tab_contents_->SystemDragEnded();
drop_data_.reset();
drag_context_ = NULL;
}
gfx::NativeView TabContentsDragSource::GetContentNativeView() const {
- return tab_contents_view_->GetContentNativeView();
+ return tab_contents_->view()->GetContentNativeView();
}
gboolean TabContentsDragSource::OnDragIconExpose(GtkWidget* sender,
diff --git a/chrome/browser/ui/gtk/tab_contents_drag_source.h b/chrome/browser/ui/gtk/tab_contents_drag_source.h
index 6164300..5694e21 100644
--- a/chrome/browser/ui/gtk/tab_contents_drag_source.h
+++ b/chrome/browser/ui/gtk/tab_contents_drag_source.h
@@ -21,17 +21,16 @@
class SkBitmap;
class TabContents;
-class TabContentsView;
struct WebDropData;
// TabContentsDragSource takes care of managing the drag from a TabContents
// with Gtk.
class TabContentsDragSource : public MessageLoopForUI::Observer {
public:
- explicit TabContentsDragSource(TabContentsView* tab_contents_view);
+ explicit TabContentsDragSource(TabContents* tab_contents);
virtual ~TabContentsDragSource();
- TabContents* tab_contents() const;
+ TabContents* tab_contents() const { return tab_contents_; }
// Starts a drag for the tab contents this TabContentsDragSource was
// created for.
@@ -59,8 +58,8 @@ class TabContentsDragSource : public MessageLoopForUI::Observer {
gfx::NativeView GetContentNativeView() const;
- // The view we're manging the drag for.
- TabContentsView* tab_contents_view_;
+ // The tab we're manging the drag for.
+ TabContents* tab_contents_;
// The drop data for the current drag (for drags that originate in the render
// view). Non-NULL iff there is a current drag.
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc
index 724a99f..bdbebee 100644
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc
@@ -70,7 +70,7 @@ NativeTabContentsViewGtk::NativeTabContentsViewGtk(
delegate_(delegate),
ignore_next_char_event_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(drag_source_(
- new TabContentsDragSource(delegate->GetTabContents()->view()))) {
+ new TabContentsDragSource(delegate->GetTabContents()))) {
}
NativeTabContentsViewGtk::~NativeTabContentsViewGtk() {
diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.cc b/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.cc
index 7fe0ac0..0cb5bb0 100644
--- a/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.cc
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.cc
@@ -39,7 +39,7 @@ TabContentsView* TabContentsView::Create(TabContents* tab_contents) {
}
TabContentsViewTouch::TabContentsViewTouch(TabContents* tab_contents)
- : TabContentsView(tab_contents),
+ : tab_contents_(tab_contents),
sad_tab_(NULL),
ignore_next_char_event_(false) {
last_focused_view_storage_id_ =
@@ -107,7 +107,7 @@ gfx::NativeView TabContentsViewTouch::GetNativeView() const {
}
gfx::NativeView TabContentsViewTouch::GetContentNativeView() const {
- RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView();
+ RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView();
if (!rwhv)
return NULL;
return rwhv->GetNativeView();
@@ -139,7 +139,7 @@ void TabContentsViewTouch::OnTabCrashed(base::TerminationStatus status,
return;
sad_tab_.reset(new SadTabView(
- tab_contents(),
+ tab_contents_,
status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ?
SadTabView::KILLED : SadTabView::CRASHED));
RemoveAllChildViews(true);
@@ -151,30 +151,33 @@ void TabContentsViewTouch::SizeContents(const gfx::Size& size) {
WasSized(size);
// We need to send this immediately.
- RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView();
+ RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView();
if (rwhv)
rwhv->SetSize(size);
}
+void TabContentsViewTouch::RenderViewCreated(RenderViewHost* host) {
+}
+
void TabContentsViewTouch::Focus() {
- if (tab_contents()->interstitial_page()) {
- tab_contents()->interstitial_page()->Focus();
+ if (tab_contents_->interstitial_page()) {
+ tab_contents_->interstitial_page()->Focus();
return;
}
- if (tab_contents()->is_crashed() && sad_tab_ != NULL) {
+ if (tab_contents_->is_crashed() && sad_tab_ != NULL) {
sad_tab_->RequestFocus();
return;
}
- RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView();
+ RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView();
if (rwhv)
rwhv->Focus();
}
void TabContentsViewTouch::SetInitialFocus() {
- if (tab_contents()->FocusLocationBarByDefault())
- tab_contents()->SetFocusToLocationBar(false);
+ if (tab_contents_->FocusLocationBarByDefault())
+ tab_contents_->SetFocusToLocationBar(false);
else
Focus();
}
@@ -224,6 +227,23 @@ void TabContentsViewTouch::RestoreFocus() {
}
}
+void TabContentsViewTouch::UpdatePreferredSize(const gfx::Size& pref_size) {
+}
+
+bool TabContentsViewTouch::IsDoingDrag() const {
+ return false;
+}
+
+void TabContentsViewTouch::CancelDragAndCloseTab() {
+}
+
+bool TabContentsViewTouch::IsEventTracking() const {
+ return false;
+}
+
+void TabContentsViewTouch::CloseTabAfterEventTracking() {
+}
+
void TabContentsViewTouch::GetViewBounds(gfx::Rect* out) const {
out->SetRect(x(), y(), width(), height());
}
@@ -247,13 +267,13 @@ void TabContentsViewTouch::UpdateDragCursor(WebDragOperation operation) {
}
void TabContentsViewTouch::GotFocus() {
- if (tab_contents()->delegate())
- tab_contents()->delegate()->TabContentsFocused(tab_contents());
+ if (tab_contents_->delegate())
+ tab_contents_->delegate()->TabContentsFocused(tab_contents_);
}
void TabContentsViewTouch::TakeFocus(bool reverse) {
- if (tab_contents()->delegate() &&
- !tab_contents()->delegate()->TakeFocus(reverse)) {
+ if (tab_contents_->delegate() &&
+ !tab_contents_->delegate()->TakeFocus(reverse)) {
views::FocusManager* focus_manager =
views::FocusManager::GetFocusManagerForNativeView(GetNativeView());
@@ -273,18 +293,55 @@ void TabContentsViewTouch::VisibilityChanged(views::View *, bool is_visible) {
}
}
+
+void TabContentsViewTouch::CreateNewWindow(
+ int route_id,
+ const ViewHostMsg_CreateWindow_Params& params) {
+ delegate_view_helper_.CreateNewWindowFromTabContents(
+ tab_contents_, route_id, params);
+}
+
+void TabContentsViewTouch::CreateNewWidget(
+ int route_id, WebKit::WebPopupType popup_type) {
+ delegate_view_helper_.CreateNewWidget(route_id, popup_type,
+ tab_contents_->render_view_host()->process());
+}
+
+void TabContentsViewTouch::CreateNewFullscreenWidget(int route_id) {
+ delegate_view_helper_.CreateNewFullscreenWidget(
+ route_id, tab_contents_->render_view_host()->process());
+}
+
+void TabContentsViewTouch::ShowCreatedWindow(int route_id,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture) {
+ delegate_view_helper_.ShowCreatedWindow(
+ tab_contents_, route_id, disposition, initial_pos, user_gesture);
+}
+
+void TabContentsViewTouch::ShowCreatedWidget(
+ int route_id, const gfx::Rect& initial_pos) {
+ delegate_view_helper_.ShowCreatedWidget(
+ tab_contents_, route_id, initial_pos);
+}
+
+void TabContentsViewTouch::ShowCreatedFullscreenWidget(int route_id) {
+ delegate_view_helper_.ShowCreatedFullscreenWidget(tab_contents_, route_id);
+}
+
void TabContentsViewTouch::ShowContextMenu(const ContextMenuParams& params) {
// Allow delegates to handle the context menu operation first.
- if (tab_contents()->delegate() &&
- tab_contents()->delegate()->HandleContextMenu(params))
+ if (tab_contents_->delegate() &&
+ tab_contents_->delegate()->HandleContextMenu(params))
return;
- context_menu_.reset(new RenderViewContextMenuViews(tab_contents(), params));
+ context_menu_.reset(new RenderViewContextMenuViews(tab_contents_, params));
context_menu_->Init();
gfx::Point screen_point(params.x, params.y);
RenderWidgetHostViewViews* rwhv = static_cast<RenderWidgetHostViewViews*>
- (tab_contents()->GetRenderWidgetHostView());
+ (tab_contents_->GetRenderWidgetHostView());
if (rwhv) {
views::View::ConvertPointToScreen(rwhv, &screen_point);
}
@@ -308,11 +365,11 @@ void TabContentsViewTouch::ShowPopupMenu(const gfx::Rect& bounds,
}
void TabContentsViewTouch::WasHidden() {
- tab_contents()->HideContents();
+ tab_contents_->HideContents();
}
void TabContentsViewTouch::WasShown() {
- tab_contents()->ShowContents();
+ tab_contents_->ShowContents();
}
void TabContentsViewTouch::WasSized(const gfx::Size& size) {
@@ -323,11 +380,11 @@ void TabContentsViewTouch::WasSized(const gfx::Size& size) {
if (needs_resize) {
size_ = size;
- if (tab_contents()->interstitial_page())
- tab_contents()->interstitial_page()->SetSize(size);
+ if (tab_contents_->interstitial_page())
+ tab_contents_->interstitial_page()->SetSize(size);
}
- RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView();
+ RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView();
if (rwhv && rwhv->GetViewBounds().size() != size)
rwhv->SetSize(size);
diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h b/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h
index 1ae1e05..68e86bc 100644
--- a/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h
@@ -9,6 +9,7 @@
#include <vector>
#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 "ui/gfx/size.h"
#include "views/view.h"
@@ -58,10 +59,16 @@ class TabContentsViewTouch : public TabContentsView, public views::View {
virtual void OnTabCrashed(base::TerminationStatus status,
int error_code) OVERRIDE;
virtual void SizeContents(const gfx::Size& size) OVERRIDE;
+ virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void Focus() OVERRIDE;
virtual void SetInitialFocus() OVERRIDE;
virtual void StoreFocus() OVERRIDE;
virtual void RestoreFocus() OVERRIDE;
+ virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE;
+ virtual bool IsDoingDrag() const OVERRIDE;
+ virtual void CancelDragAndCloseTab() OVERRIDE;
+ virtual bool IsEventTracking() const OVERRIDE;
+ virtual void CloseTabAfterEventTracking() OVERRIDE;
virtual void GetViewBounds(gfx::Rect* out) const OVERRIDE;
// views::View implementation
@@ -70,6 +77,17 @@ class TabContentsViewTouch : public TabContentsView, public views::View {
virtual std::string GetClassName() const OVERRIDE;
// Backend implementation of RenderViewHostDelegate::View.
+ virtual void CreateNewWindow(
+ int route_id,
+ const ViewHostMsg_CreateWindow_Params& params);
+ virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type);
+ virtual void CreateNewFullscreenWidget(int route_id);
+ virtual void ShowCreatedWindow(int route_id,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture);
+ virtual void ShowCreatedWidget(int route_id, const gfx::Rect& initial_pos);
+ virtual void ShowCreatedFullscreenWidget(int route_id);
virtual void ShowContextMenu(const ContextMenuParams& params);
virtual void ShowPopupMenu(const gfx::Rect& bounds,
int item_height,
@@ -103,6 +121,12 @@ class TabContentsViewTouch : public TabContentsView, public views::View {
// when this view is resized.
void SetFloatingPosition(const gfx::Size& size);
+ // The TabContents whose contents we display.
+ TabContents* tab_contents_;
+
+ // Common implementations of some RenderViewHostDelegate::View methods.
+ RenderViewHostDelegateViewHelper delegate_view_helper_;
+
// Used to render the sad tab. This will be non-NULL only when the sad tab is
// visible.
scoped_ptr<SadTabView> sad_tab_;
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 b2684fe..ab70af9 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
@@ -38,7 +38,7 @@ TabContentsView* TabContentsView::Create(TabContents* tab_contents) {
}
TabContentsViewViews::TabContentsViewViews(TabContents* tab_contents)
- : TabContentsView(tab_contents),
+ : tab_contents_(tab_contents),
native_tab_contents_view_(NULL),
sad_tab_(NULL),
close_tab_after_drag_ends_(false),
@@ -98,7 +98,7 @@ gfx::NativeView TabContentsViewViews::GetNativeView() const {
}
gfx::NativeView TabContentsViewViews::GetContentNativeView() const {
- RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView();
+ RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView();
return rwhv ? rwhv->GetNativeView() : NULL;
}
@@ -129,7 +129,7 @@ void TabContentsViewViews::OnTabCrashed(base::TerminationStatus status,
SadTabView::Kind kind =
status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ?
SadTabView::KILLED : SadTabView::CRASHED;
- sad_tab_ = new SadTabView(tab_contents(), kind);
+ sad_tab_ = new SadTabView(tab_contents_, kind);
SetContentsView(sad_tab_);
sad_tab_->SchedulePaint();
}
@@ -147,32 +147,35 @@ void TabContentsViewViews::SizeContents(const gfx::Size& size) {
}
}
+void TabContentsViewViews::RenderViewCreated(RenderViewHost* host) {
+}
+
void TabContentsViewViews::Focus() {
- if (tab_contents()->interstitial_page()) {
- tab_contents()->interstitial_page()->Focus();
+ if (tab_contents_->interstitial_page()) {
+ tab_contents_->interstitial_page()->Focus();
return;
}
- if (tab_contents()->is_crashed() && sad_tab_ != NULL) {
+ if (tab_contents_->is_crashed() && sad_tab_ != NULL) {
sad_tab_->RequestFocus();
return;
}
- if (tab_contents()->constrained_window_count() > 0) {
- ConstrainedWindow* window = *tab_contents()->constrained_window_begin();
+ if (tab_contents_->constrained_window_count() > 0) {
+ ConstrainedWindow* window = *tab_contents_->constrained_window_begin();
DCHECK(window);
window->FocusConstrainedWindow();
return;
}
- RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView();
+ RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView();
GetFocusManager()->FocusNativeView(rwhv ? rwhv->GetNativeView()
: GetNativeView());
}
void TabContentsViewViews::SetInitialFocus() {
- if (tab_contents()->FocusLocationBarByDefault())
- tab_contents()->SetFocusToLocationBar(false);
+ if (tab_contents_->FocusLocationBarByDefault())
+ tab_contents_->SetFocusToLocationBar(false);
else
Focus();
}
@@ -223,6 +226,9 @@ void TabContentsViewViews::RestoreFocus() {
}
}
+void TabContentsViewViews::UpdatePreferredSize(const gfx::Size& pref_size) {
+}
+
bool TabContentsViewViews::IsDoingDrag() const {
return native_tab_contents_view_->IsDoingDrag();
}
@@ -236,6 +242,13 @@ void TabContentsViewViews::CancelDragAndCloseTab() {
close_tab_after_drag_ends_ = true;
}
+bool TabContentsViewViews::IsEventTracking() const {
+ return false;
+}
+
+void TabContentsViewViews::CloseTabAfterEventTracking() {
+}
+
void TabContentsViewViews::GetViewBounds(gfx::Rect* out) const {
*out = GetWindowScreenBounds();
}
@@ -245,12 +258,12 @@ void TabContentsViewViews::UpdateDragCursor(WebDragOperation operation) {
}
void TabContentsViewViews::GotFocus() {
- if (tab_contents()->delegate())
- tab_contents()->delegate()->TabContentsFocused(tab_contents());
+ if (tab_contents_->delegate())
+ tab_contents_->delegate()->TabContentsFocused(tab_contents_);
}
void TabContentsViewViews::TakeFocus(bool reverse) {
- if (!tab_contents()->delegate()->TakeFocus(reverse)) {
+ if (!tab_contents_->delegate()->TakeFocus(reverse)) {
views::FocusManager* focus_manager =
views::FocusManager::GetFocusManagerForNativeView(GetNativeView());
@@ -262,15 +275,51 @@ void TabContentsViewViews::TakeFocus(bool reverse) {
}
void TabContentsViewViews::CloseTab() {
- tab_contents()->Close(tab_contents()->render_view_host());
+ tab_contents_->Close(tab_contents_->render_view_host());
+}
+
+void TabContentsViewViews::CreateNewWindow(
+ int route_id,
+ const ViewHostMsg_CreateWindow_Params& params) {
+ delegate_view_helper_.CreateNewWindowFromTabContents(
+ tab_contents_, route_id, params);
+}
+
+void TabContentsViewViews::CreateNewWidget(
+ int route_id, WebKit::WebPopupType popup_type) {
+ delegate_view_helper_.CreateNewWidget(route_id, popup_type,
+ tab_contents_->render_view_host()->process());
+}
+
+void TabContentsViewViews::CreateNewFullscreenWidget(int route_id) {
+ delegate_view_helper_.CreateNewFullscreenWidget(
+ route_id, tab_contents_->render_view_host()->process());
+}
+
+void TabContentsViewViews::ShowCreatedWindow(int route_id,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture) {
+ delegate_view_helper_.ShowCreatedWindow(
+ tab_contents_, route_id, disposition, initial_pos, user_gesture);
+}
+
+void TabContentsViewViews::ShowCreatedWidget(
+ int route_id, const gfx::Rect& initial_pos) {
+ delegate_view_helper_.ShowCreatedWidget(
+ tab_contents_, route_id, initial_pos);
+}
+
+void TabContentsViewViews::ShowCreatedFullscreenWidget(int route_id) {
+ delegate_view_helper_.ShowCreatedFullscreenWidget(tab_contents_, route_id);
}
void TabContentsViewViews::ShowContextMenu(const ContextMenuParams& params) {
// Allow delegates to handle the context menu operation first.
- if (tab_contents()->delegate()->HandleContextMenu(params))
+ if (tab_contents_->delegate()->HandleContextMenu(params))
return;
- context_menu_.reset(new RenderViewContextMenuViews(tab_contents(), params));
+ context_menu_.reset(new RenderViewContextMenuViews(tab_contents_, params));
context_menu_->Init();
gfx::Point screen_point(params.x, params.y);
@@ -298,46 +347,46 @@ void TabContentsViewViews::ShowPopupMenu(const gfx::Rect& bounds,
// TabContentsViewViews, internal::NativeTabContentsViewDelegate implementation:
TabContents* TabContentsViewViews::GetTabContents() {
- return tab_contents();
+ return tab_contents_;
}
bool TabContentsViewViews::IsShowingSadTab() const {
- return tab_contents()->is_crashed() && sad_tab_;
+ return tab_contents_->is_crashed() && sad_tab_;
}
void TabContentsViewViews::OnNativeTabContentsViewShown() {
- tab_contents()->ShowContents();
+ tab_contents_->ShowContents();
}
void TabContentsViewViews::OnNativeTabContentsViewHidden() {
- tab_contents()->HideContents();
+ tab_contents_->HideContents();
}
void TabContentsViewViews::OnNativeTabContentsViewSized(const gfx::Size& size) {
- if (tab_contents()->interstitial_page())
- tab_contents()->interstitial_page()->SetSize(size);
- RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView();
+ if (tab_contents_->interstitial_page())
+ tab_contents_->interstitial_page()->SetSize(size);
+ RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView();
if (rwhv)
rwhv->SetSize(size);
}
void TabContentsViewViews::OnNativeTabContentsViewWheelZoom(bool zoom_in) {
- if (tab_contents()->delegate())
- tab_contents()->delegate()->ContentsZoomChange(zoom_in);
+ if (tab_contents_->delegate())
+ tab_contents_->delegate()->ContentsZoomChange(zoom_in);
}
void TabContentsViewViews::OnNativeTabContentsViewMouseDown() {
// Make sure this TabContents is activated when it is clicked on.
- if (tab_contents()->delegate())
- tab_contents()->delegate()->ActivateContents(tab_contents());
+ if (tab_contents_->delegate())
+ tab_contents_->delegate()->ActivateContents(tab_contents_);
}
void TabContentsViewViews::OnNativeTabContentsViewMouseMove(bool motion) {
// Let our delegate know that the mouse moved (useful for resetting status
// bubble state).
- if (tab_contents()->delegate()) {
- tab_contents()->delegate()->ContentsMouseEvent(
- tab_contents(), views::Screen::GetCursorScreenPoint(), motion);
+ if (tab_contents_->delegate()) {
+ tab_contents_->delegate()->ContentsMouseEvent(
+ tab_contents_, views::Screen::GetCursorScreenPoint(), motion);
}
}
@@ -346,7 +395,7 @@ void TabContentsViewViews::OnNativeTabContentsViewDraggingEnded() {
close_tab_timer_.Start(base::TimeDelta::FromMilliseconds(0), this,
&TabContentsViewViews::CloseTab);
}
- tab_contents()->SystemDragEnded();
+ tab_contents_->SystemDragEnded();
}
views::internal::NativeWidgetDelegate*
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 0bd78ff..e57af7d 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
@@ -8,6 +8,7 @@
#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 "views/widget/widget.h"
@@ -58,13 +59,30 @@ class TabContentsViewViews : public views::Widget,
virtual void OnTabCrashed(base::TerminationStatus status,
int error_code) OVERRIDE;
virtual void SizeContents(const gfx::Size& size) OVERRIDE;
+ virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void Focus() OVERRIDE;
virtual void SetInitialFocus() OVERRIDE;
virtual void StoreFocus() OVERRIDE;
virtual void RestoreFocus() OVERRIDE;
+ virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE;
virtual bool IsDoingDrag() const OVERRIDE;
virtual void CancelDragAndCloseTab() OVERRIDE;
+ virtual bool IsEventTracking() const;
+ virtual void CloseTabAfterEventTracking();
virtual void GetViewBounds(gfx::Rect* out) const OVERRIDE;
+ virtual void CreateNewWindow(
+ int route_id,
+ const ViewHostMsg_CreateWindow_Params& params) OVERRIDE;
+ virtual void CreateNewWidget(int route_id,
+ WebKit::WebPopupType popup_type) OVERRIDE;
+ virtual void CreateNewFullscreenWidget(int route_id) OVERRIDE;
+ virtual void ShowCreatedWindow(int route_id,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture) OVERRIDE;
+ virtual void ShowCreatedWidget(int route_id,
+ const gfx::Rect& initial_pos) OVERRIDE;
+ virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE;
virtual void ShowContextMenu(const ContextMenuParams& params) OVERRIDE;
virtual void ShowPopupMenu(const gfx::Rect& bounds,
int item_height,
@@ -116,6 +134,12 @@ class TabContentsViewViews : public views::Widget,
// ---------------------------------------------------------------------------
+ // The TabContents whose contents we display.
+ TabContents* tab_contents_;
+
+ // Common implementations of some RenderViewHostDelegate::View methods.
+ RenderViewHostDelegateViewHelper delegate_view_helper_;
+
NativeTabContentsView* native_tab_contents_view_;
// Used to render the sad tab. This will be non-NULL only when the sad tab is