diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-06 18:16:42 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-06 18:16:42 +0000 |
commit | dcc0b01c43ee6a7718a405f21e6bebaa283f5967 (patch) | |
tree | 10fc667ba4b9d54c34eebdf1fa1eeae0087c71fb /chrome | |
parent | cb17f7f681804aeac05df6c6e5e0c644df5694d9 (diff) | |
download | chromium_src-dcc0b01c43ee6a7718a405f21e6bebaa283f5967.zip chromium_src-dcc0b01c43ee6a7718a405f21e6bebaa283f5967.tar.gz chromium_src-dcc0b01c43ee6a7718a405f21e6bebaa283f5967.tar.bz2 |
Stub out web_contents_view_gtk.
Also start using the new render_widget_host_view_gtk
Review URL: http://codereview.chromium.org/21119
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9319 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser.scons | 3 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.cc | 3 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_widget_host_view_gtk.cc | 3 | ||||
-rw-r--r-- | chrome/browser/tab_contents/render_view_host_manager.cc | 4 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents.cc | 8 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents_view_gtk.cc | 151 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents_view_gtk.h | 68 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.cc | 2 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.h | 4 |
9 files changed, 241 insertions, 5 deletions
diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons index 994aac9..423cf2a 100644 --- a/chrome/browser/browser.scons +++ b/chrome/browser/browser.scons @@ -762,7 +762,6 @@ if not env.Bit('windows'): 'tab_contents/tab_contents_factory.cc', 'tab_contents/tab_util.cc', 'tab_contents/view_source_contents.cc', - 'tab_contents/web_contents_view.cc', 'tab_contents/web_drag_source.cc', 'tab_contents/web_drop_target.cc', 'task_manager.cc', @@ -803,11 +802,13 @@ if env.Bit('linux'): 'browser_window_factory_gtk.cc', 'browser_window_gtk.cc', 'renderer_host/render_widget_host_view_gtk.cc', + 'tab_contents/web_contents_view_gtk.cc', ]) if env.Bit('mac'): input_files.Remove( 'spellchecker.cc', + 'tab_contents/web_contents_view.cc', ) if env.Bit('windows'): diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 7e2a579..abd3661 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -32,6 +32,9 @@ #if defined(OS_WIN) // TODO(port): remove these when stubs are filled in #include "chrome/browser/debugger/debugger_wrapper.h" +#endif + +#if !defined(OS_MACOSX) #include "chrome/browser/renderer_host/render_widget_host_view.h" #endif diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc index 35d64b6..6b4375d 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc @@ -78,6 +78,8 @@ RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( RenderWidgetHostViewGtk::RenderWidgetHostViewGtk(RenderWidgetHost* widget) : widget_(widget) { + widget_->set_view(this); + view_ = gtk_drawing_area_new(); gtk_widget_add_events(view_, GDK_EXPOSURE_MASK | @@ -222,3 +224,4 @@ void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) { NOTIMPLEMENTED(); } } + diff --git a/chrome/browser/tab_contents/render_view_host_manager.cc b/chrome/browser/tab_contents/render_view_host_manager.cc index c434b10..b7655a5 100644 --- a/chrome/browser/tab_contents/render_view_host_manager.cc +++ b/chrome/browser/tab_contents/render_view_host_manager.cc @@ -4,9 +4,9 @@ #include "chrome/browser/tab_contents/render_view_host_manager.h" -#if defined(OS_POSIX) +#if defined(OS_MACOSX) #include "chrome/common/temp_scaffolding_stubs.h" -#elif defined(OS_WIN) +#else #include "chrome/browser/renderer_host/render_widget_host_view.h" #endif diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc index 17c9013..b152a28 100644 --- a/chrome/browser/tab_contents/web_contents.cc +++ b/chrome/browser/tab_contents/web_contents.cc @@ -47,16 +47,20 @@ #include "chrome/browser/plugin_installer.h" #include "chrome/browser/plugin_service.h" #include "chrome/browser/printing/print_job.h" -#include "chrome/browser/renderer_host/render_widget_host_view.h" #include "chrome/browser/search_engines/template_url_fetcher.h" #include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/web_contents_view.h" #include "chrome/browser/views/hung_renderer_view.h" // TODO(brettw) delete me. #include "chrome/common/resource_bundle.h" #endif #include "generated_resources.h" +#if !defined(OS_MACOSX) +// TODO(port): port this to mac. +#include "chrome/browser/renderer_host/render_widget_host_view.h" +#include "chrome/browser/tab_contents/web_contents_view.h" +#endif + // Cross-Site Navigations // // If a WebContents is told to navigate to a different web site (as determined diff --git a/chrome/browser/tab_contents/web_contents_view_gtk.cc b/chrome/browser/tab_contents/web_contents_view_gtk.cc new file mode 100644 index 0000000..c5ff575 --- /dev/null +++ b/chrome/browser/tab_contents/web_contents_view_gtk.cc @@ -0,0 +1,151 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/tab_contents/web_contents_view_gtk.h" + +#include "base/gfx/point.h" +#include "base/gfx/rect.h" +#include "chrome/browser/renderer_host/render_view_host.h" +#include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" +#include "chrome/browser/tab_contents/web_contents.h" + +// static +WebContentsView* WebContentsView::Create(WebContents* web_contents) { + return new WebContentsViewGtk(web_contents); +} + +WebContentsViewGtk::WebContentsViewGtk(WebContents* web_contents) + : web_contents_(web_contents) { +} + +WebContentsViewGtk::~WebContentsViewGtk() { +} + +WebContents* WebContentsViewGtk::GetWebContents() { + return web_contents_; +} + +void WebContentsViewGtk::CreateView() { + NOTIMPLEMENTED(); +} + +RenderWidgetHostView* WebContentsViewGtk::CreateViewForWidget( + RenderWidgetHost* render_widget_host) { + DCHECK(!render_widget_host->view()); + RenderWidgetHostViewGtk* view = + new RenderWidgetHostViewGtk(render_widget_host); + // TODO(port): do we need to do any extra setup? + return view; +} + +gfx::NativeView WebContentsViewGtk::GetNativeView() const { + NOTIMPLEMENTED(); + return NULL; +} + +gfx::NativeView WebContentsViewGtk::GetContentNativeView() const { + NOTIMPLEMENTED(); + return NULL; +} + +gfx::NativeView WebContentsViewGtk::GetTopLevelNativeView() const { + NOTIMPLEMENTED(); + return NULL; +} + +void WebContentsViewGtk::GetContainerBounds(gfx::Rect* out) const { + NOTIMPLEMENTED(); +} + +void WebContentsViewGtk::OnContentsDestroy() { + NOTIMPLEMENTED(); +} + +void WebContentsViewGtk::SetPageTitle(const std::wstring& title) { + NOTIMPLEMENTED(); +} + +void WebContentsViewGtk::Invalidate() { + NOTIMPLEMENTED(); +} + +void WebContentsViewGtk::SizeContents(const gfx::Size& size) { + NOTIMPLEMENTED(); +} + +void WebContentsViewGtk::FindInPage(const Browser& browser, + bool find_next, bool forward_direction) { + NOTIMPLEMENTED(); +} + +void WebContentsViewGtk::HideFindBar(bool end_session) { + NOTIMPLEMENTED(); +} + +void WebContentsViewGtk::ReparentFindWindow(Browser* new_browser) const { + NOTIMPLEMENTED(); +} + +bool WebContentsViewGtk::GetFindBarWindowInfo(gfx::Point* position, + bool* fully_visible) const { + NOTIMPLEMENTED(); + return false; +} + +void WebContentsViewGtk::UpdateDragCursor(bool is_drop_target) { + NOTIMPLEMENTED(); +} + +void WebContentsViewGtk::TakeFocus(bool reverse) { + NOTIMPLEMENTED(); +} + +void WebContentsViewGtk::HandleKeyboardEvent(const WebKeyboardEvent& event) { + NOTIMPLEMENTED(); +} + +void WebContentsViewGtk::OnFindReply(int request_id, + int number_of_matches, + const gfx::Rect& selection_rect, + int active_match_ordinal, + bool final_update) { + NOTIMPLEMENTED(); +} + +void WebContentsViewGtk::ShowContextMenu(const ContextMenuParams& params) { + NOTIMPLEMENTED(); +} + +void WebContentsViewGtk::StartDragging(const WebDropData& drop_data) { + NOTIMPLEMENTED(); +} + +WebContents* WebContentsViewGtk::CreateNewWindowInternal( + int route_id, + base::WaitableEvent* modal_dialog_event) { + NOTIMPLEMENTED(); + return NULL; +} + +RenderWidgetHostView* WebContentsViewGtk::CreateNewWidgetInternal( + int route_id, + bool activatable) { + NOTIMPLEMENTED(); + return NULL; +} + +void WebContentsViewGtk::ShowCreatedWindowInternal( + WebContents* new_web_contents, + WindowOpenDisposition disposition, + const gfx::Rect& initial_pos, + bool user_gesture) { + NOTIMPLEMENTED(); +} + +void WebContentsViewGtk::ShowCreatedWidgetInternal( + RenderWidgetHostView* widget_host_view, + const gfx::Rect& initial_pos) { + NOTIMPLEMENTED(); +} + diff --git a/chrome/browser/tab_contents/web_contents_view_gtk.h b/chrome/browser/tab_contents/web_contents_view_gtk.h new file mode 100644 index 0000000..b00a520 --- /dev/null +++ b/chrome/browser/tab_contents/web_contents_view_gtk.h @@ -0,0 +1,68 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_WIN_H_ +#define CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_WIN_H_ + +#include "chrome/browser/tab_contents/web_contents_view.h" + +class WebContentsViewGtk : public WebContentsView { + public: + // The corresponding WebContents is passed in the constructor, and manages our + // lifetime. This doesn't need to be the case, but is this way currently + // because that's what was easiest when they were split. + explicit WebContentsViewGtk(WebContents* web_contents); + virtual ~WebContentsViewGtk(); + + // WebContentsView implementation -------------------------------------------- + + virtual WebContents* GetWebContents(); + virtual void CreateView(); + virtual RenderWidgetHostView* CreateViewForWidget( + RenderWidgetHost* render_widget_host); + + virtual gfx::NativeView GetNativeView() const; + virtual gfx::NativeView GetContentNativeView() const; + virtual gfx::NativeView GetTopLevelNativeView() const; + virtual void GetContainerBounds(gfx::Rect* out) const; + virtual void OnContentsDestroy(); + virtual void SetPageTitle(const std::wstring& title); + virtual void Invalidate(); + virtual void SizeContents(const gfx::Size& size); + virtual void FindInPage(const Browser& browser, + bool find_next, bool forward_direction); + virtual void HideFindBar(bool end_session); + virtual void ReparentFindWindow(Browser* new_browser) const; + virtual bool GetFindBarWindowInfo(gfx::Point* position, + bool* fully_visible) const; + + // Backend implementation of RenderViewHostDelegate::View. + virtual WebContents* CreateNewWindowInternal( + int route_id, base::WaitableEvent* modal_dialog_event); + virtual RenderWidgetHostView* CreateNewWidgetInternal(int route_id, + bool activatable); + virtual void ShowCreatedWindowInternal(WebContents* new_web_contents, + WindowOpenDisposition disposition, + const gfx::Rect& initial_pos, + bool user_gesture); + virtual void ShowCreatedWidgetInternal(RenderWidgetHostView* widget_host_view, + const gfx::Rect& initial_pos); + virtual void ShowContextMenu(const ContextMenuParams& params); + virtual void StartDragging(const WebDropData& drop_data); + virtual void UpdateDragCursor(bool is_drop_target); + virtual void TakeFocus(bool reverse); + virtual void HandleKeyboardEvent(const WebKeyboardEvent& event); + virtual void OnFindReply(int request_id, + int number_of_matches, + const gfx::Rect& selection_rect, + int active_match_ordinal, + bool final_update); + private: + WebContents* web_contents_; + + DISALLOW_COPY_AND_ASSIGN(WebContentsViewGtk); +}; + +#endif // CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_WIN_H_ + diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc index f902539..661f632 100644 --- a/chrome/common/temp_scaffolding_stubs.cc +++ b/chrome/common/temp_scaffolding_stubs.cc @@ -213,6 +213,7 @@ void TabContents::Destroy() { //-------------------------------------------------------------------------- +#if defined(OS_MACOSX) class RenderWidgetHostViewStub : public RenderWidgetHostView { public: RenderWidgetHostViewStub(RenderWidgetHost* host) { @@ -225,6 +226,7 @@ RenderWidgetHostView* NOTIMPLEMENTED(); return new RenderWidgetHostViewStub(host); } +#endif // defined(OS_MACOSX) //-------------------------------------------------------------------------- diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h index 19f5b4a..f50b066 100644 --- a/chrome/common/temp_scaffolding_stubs.h +++ b/chrome/common/temp_scaffolding_stubs.h @@ -620,6 +620,7 @@ class ConfirmInfoBarDelegate : public InfoBarDelegate { }; }; +#if defined(OS_MACOSX) class RenderWidgetHostView { public: virtual RenderWidgetHost* GetRenderWidgetHost() const { @@ -650,6 +651,7 @@ class RenderWidgetHostView { virtual void Destroy() { NOTIMPLEMENTED(); } virtual void SetTooltipText(const std::wstring&) { NOTIMPLEMENTED(); } }; +#endif // defined(MAC_OSX) class LoadNotificationDetails { public: @@ -926,6 +928,7 @@ class URLFixerUpper { //--------------------------------------------------------------------------- // These stubs are for WebContents +#if defined(OS_MACOSX) class WebContentsView : public RenderViewHostDelegate::View { public: void OnContentsDestroy() { NOTIMPLEMENTED(); } @@ -971,6 +974,7 @@ class WebContentsViewWin : public WebContentsView { public: WebContentsViewWin(WebContents*) { } }; +#endif // defined(OS_MACOSX) class WebApp : public base::RefCountedThreadSafe<WebApp> { public: |