diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-11 04:17:48 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-11 04:17:48 +0000 |
commit | 6395479cb45348d2049bcb1a5a49988ec00eb465 (patch) | |
tree | ea7509e451583b709a8634067848d4a88ff67269 /content | |
parent | 461a0dfec2e9a6046b93844ea9ac3fc7c876d5f2 (diff) | |
download | chromium_src-6395479cb45348d2049bcb1a5a49988ec00eb465.zip chromium_src-6395479cb45348d2049bcb1a5a49988ec00eb465.tar.gz chromium_src-6395479cb45348d2049bcb1a5a49988ec00eb465.tar.bz2 |
Remove TabContentsView methods that just call to the delegate, and have them be part of the delegate interface instead. This is towards making TabContentsView just an interface.
BUG=87702
Review URL: http://codereview.chromium.org/7277027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91989 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/DEPS | 1 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host.cc | 11 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host.h | 7 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host.cc | 65 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host_delegate.cc | 4 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host_delegate.h | 84 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host_unittest.cc | 13 | ||||
-rw-r--r-- | content/browser/tab_contents/interstitial_page.cc | 59 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents.cc | 32 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents.h | 15 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents_delegate.cc | 7 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents_delegate.h | 10 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents_view.cc | 44 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents_view.h | 30 |
14 files changed, 108 insertions, 274 deletions
diff --git a/content/browser/DEPS b/content/browser/DEPS index b5fa323..6036788 100644 --- a/content/browser/DEPS +++ b/content/browser/DEPS @@ -23,6 +23,7 @@ include_rules = [ # http://crbug.com/76788 "+chrome/browser/profiles/profile.h", + # http://crbug.com/87702 "+chrome/browser/tab_contents/render_view_host_delegate_helper.h", # ONLY USED BY TESTS diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index 2f17226..3b3fc5c 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc @@ -11,7 +11,6 @@ #include "base/process_util.h" #include "base/string_piece.h" #include "base/threading/thread.h" -#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" #include "content/browser/browser_thread.h" #include "content/browser/gpu/gpu_data_manager.h" #include "content/browser/gpu/gpu_process_host_ui_shim.h" @@ -31,6 +30,8 @@ #include "ui/gfx/gtk_native_view_id_manager.h" #endif +bool GpuProcessHost::gpu_enabled_ = true; + namespace { enum GPUProcessLifetimeEvent { @@ -502,17 +503,15 @@ void GpuProcessHost::OnProcessCrashed(int exit_code) { SendOutstandingReplies(); if (++g_gpu_crash_count >= kGpuMaxCrashCount) { // The gpu process is too unstable to use. Disable it for current session. - RenderViewHostDelegateHelper::set_gpu_enabled(false); + gpu_enabled_ = false; } BrowserChildProcessHost::OnProcessCrashed(exit_code); } bool GpuProcessHost::LaunchGpuProcess() { - if (!RenderViewHostDelegateHelper::gpu_enabled() || - g_gpu_crash_count >= kGpuMaxCrashCount) - { + if (!gpu_enabled_ || g_gpu_crash_count >= kGpuMaxCrashCount) { SendOutstandingReplies(); - RenderViewHostDelegateHelper::set_gpu_enabled(false); + gpu_enabled_ = false; return false; } diff --git a/content/browser/gpu/gpu_process_host.h b/content/browser/gpu/gpu_process_host.h index 93fd311..c50af2e 100644 --- a/content/browser/gpu/gpu_process_host.h +++ b/content/browser/gpu/gpu_process_host.h @@ -28,6 +28,8 @@ class GpuMainThread; class GpuProcessHost : public BrowserChildProcessHost, public base::NonThreadSafe { public: + static bool gpu_enabled() { return gpu_enabled_; } + // Creates a new GpuProcessHost or gets one for a particular // renderer process, resulting in the launching of a GPU process if required. // Returns null on failure. It is not safe to store the pointer once control @@ -148,6 +150,11 @@ class GpuProcessHost : public BrowserChildProcessHost, scoped_ptr<GpuMainThread> in_process_gpu_thread_; + // Master switch for enabling/disabling GPU acceleration for the current + // browser session. It does not change the acceleration settings for + // existing tabs, just the future ones. + static bool gpu_enabled_; + DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); }; diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index 37bf2bd..3a5abad 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -578,10 +578,7 @@ void RenderViewHost::GotFocus() { void RenderViewHost::LostCapture() { RenderWidgetHost::LostCapture(); - - RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); - if (view) - view->LostCapture(); + delegate_->LostCapture(); } void RenderViewHost::SetInitialFocus(bool reverse) { @@ -1084,15 +1081,12 @@ void RenderViewHost::RemoveObserver(RenderViewHostObserver* observer) { bool RenderViewHost::PreHandleKeyboardEvent( const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { - RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); - return view && view->PreHandleKeyboardEvent(event, is_keyboard_shortcut); + return delegate_->PreHandleKeyboardEvent(event, is_keyboard_shortcut); } void RenderViewHost::UnhandledKeyboardEvent( const NativeWebKeyboardEvent& event) { - RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); - if (view) - view->HandleKeyboardEvent(event); + delegate_->HandleKeyboardEvent(event); } void RenderViewHost::OnUserGesture() { @@ -1135,15 +1129,11 @@ void RenderViewHost::NotifyRendererResponsive() { } void RenderViewHost::OnMsgFocus() { - RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); - if (view) - view->Activate(); + delegate_->Activate(); } void RenderViewHost::OnMsgBlur() { - RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); - if (view) - view->Deactivate(); + delegate_->Deactivate(); } void RenderViewHost::ForwardMouseEvent( @@ -1154,35 +1144,30 @@ void RenderViewHost::ForwardMouseEvent( WebKit::WebMouseEvent event_copy(mouse_event); RenderWidgetHost::ForwardMouseEvent(event_copy); - RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); - if (view) { - switch (event_copy.type) { - case WebInputEvent::MouseMove: - view->HandleMouseMove(); - break; - case WebInputEvent::MouseLeave: - view->HandleMouseLeave(); - break; - case WebInputEvent::MouseDown: - view->HandleMouseDown(); - break; - case WebInputEvent::MouseWheel: - if (ignore_input_events()) - delegate_->OnIgnoredUIEvent(); - break; - case WebInputEvent::MouseUp: - view->HandleMouseUp(); - default: - // For now, we don't care about the rest. - break; - } + switch (event_copy.type) { + case WebInputEvent::MouseMove: + delegate_->HandleMouseMove(); + break; + case WebInputEvent::MouseLeave: + delegate_->HandleMouseLeave(); + break; + case WebInputEvent::MouseDown: + delegate_->HandleMouseDown(); + break; + case WebInputEvent::MouseWheel: + if (ignore_input_events()) + delegate_->OnIgnoredUIEvent(); + break; + case WebInputEvent::MouseUp: + delegate_->HandleMouseUp(); + default: + // For now, we don't care about the rest. + break; } } void RenderViewHost::OnMouseActivate() { - RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); - if (view) - view->HandleMouseActivate(); + delegate_->HandleMouseActivate(); } void RenderViewHost::ForwardKeyboardEvent( diff --git a/content/browser/renderer_host/render_view_host_delegate.cc b/content/browser/renderer_host/render_view_host_delegate.cc index 12bbc36..be281c5 100644 --- a/content/browser/renderer_host/render_view_host_delegate.cc +++ b/content/browser/renderer_host/render_view_host_delegate.cc @@ -39,3 +39,7 @@ WebPreferences RenderViewHostDelegate::GetWebkitPrefs() { return WebPreferences(); } +bool RenderViewHostDelegate::PreHandleKeyboardEvent( + const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { + return false; +} diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h index ee9cd26..044db27 100644 --- a/content/browser/renderer_host/render_view_host_delegate.h +++ b/content/browser/renderer_host/render_view_host_delegate.h @@ -25,52 +25,27 @@ class BackgroundContents; struct BookmarkNodeData; class BookmarkNode; struct ContextMenuParams; -class FilePath; class GURL; -class ListValue; struct NativeWebKeyboardEvent; -class NavigationEntry; class Profile; struct RendererPreferences; class RenderProcessHost; class RenderViewHost; -class ResourceRedirectDetails; -class ResourceRequestDetails; class SkBitmap; class TabContents; struct ViewHostMsg_CreateWindow_Params; struct ViewHostMsg_FrameNavigate_Params; -struct WebApplicationInfo; struct WebDropData; struct WebMenuItem; class WebKeyboardEvent; struct WebPreferences; -namespace base { -class WaitableEvent; -} - namespace gfx { class Point; class Rect; class Size; } -namespace IPC { -class Message; -} - -namespace net { -class CookieList; -class CookieOptions; -} - -namespace webkit_glue { -struct FormData; -struct FormField; -struct PasswordForm; -} - // // RenderViewHostDelegate // @@ -87,7 +62,6 @@ class RenderViewHostDelegate : public IPC::Channel::Listener { public: // View ---------------------------------------------------------------------- // Functions that can be routed directly to a view-specific class. - class View { public: // The page is trying to open a new page (e.g. a popup window). The window @@ -171,35 +145,6 @@ class RenderViewHostDelegate : public IPC::Channel::Listener { // retrieved by doing a Shift-Tab. virtual void TakeFocus(bool reverse) = 0; - // Notification that the view has lost capture. - virtual void LostCapture() = 0; - - // The page wants the hosting window to activate/deactivate itself (it - // called the JavaScript window.focus()/blur() method). - virtual void Activate() = 0; - virtual void Deactivate() = 0; - - // Callback to give the browser a chance to handle the specified keyboard - // event before sending it to the renderer. - // Returns true if the |event| was handled. Otherwise, if the |event| would - // be handled in HandleKeyboardEvent() method as a normal keyboard shortcut, - // |*is_keyboard_shortcut| should be set to true. - virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, - bool* is_keyboard_shortcut) = 0; - - // Callback to inform the browser that the renderer did not process the - // specified events. This gives an opportunity to the browser to process the - // event (used for keyboard shortcuts). - virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) = 0; - - // Notifications about mouse events in this view. This is useful for - // implementing global 'on hover' features external to the view. - virtual void HandleMouseMove() = 0; - virtual void HandleMouseDown() = 0; - virtual void HandleMouseLeave() = 0; - virtual void HandleMouseUp() = 0; - virtual void HandleMouseActivate() = 0; - // The contents' preferred size changed. virtual void UpdatePreferredSize(const gfx::Size& pref_size) = 0; @@ -390,6 +335,35 @@ class RenderViewHostDelegate : public IPC::Channel::Listener { // Notification that a worker process has crashed. void WorkerCrashed() {} + // The page wants the hosting window to activate/deactivate itself (it + // called the JavaScript window.focus()/blur() method). + virtual void Activate() {} + virtual void Deactivate() {} + + // Notification that the view has lost capture. + virtual void LostCapture() {} + + // Callback to give the browser a chance to handle the specified keyboard + // event before sending it to the renderer. + // Returns true if the |event| was handled. Otherwise, if the |event| would + // be handled in HandleKeyboardEvent() method as a normal keyboard shortcut, + // |*is_keyboard_shortcut| should be set to true. + virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, + bool* is_keyboard_shortcut); + + // Callback to inform the browser that the renderer did not process the + // specified events. This gives an opportunity to the browser to process the + // event (used for keyboard shortcuts). + virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {} + + // Notifications about mouse events in this view. This is useful for + // implementing global 'on hover' features external to the view. + virtual void HandleMouseMove() {} + virtual void HandleMouseDown() {} + virtual void HandleMouseLeave() {} + virtual void HandleMouseUp() {} + virtual void HandleMouseActivate() {} + protected: virtual ~RenderViewHostDelegate() {} }; diff --git a/content/browser/renderer_host/render_view_host_unittest.cc b/content/browser/renderer_host/render_view_host_unittest.cc index 0838606..f6c4d10 100644 --- a/content/browser/renderer_host/render_view_host_unittest.cc +++ b/content/browser/renderer_host/render_view_host_unittest.cc @@ -92,19 +92,6 @@ class MockDraggingRenderViewHostDelegateView virtual void UpdateDragCursor(WebKit::WebDragOperation operation) {} virtual void GotFocus() {} virtual void TakeFocus(bool reverse) {} - virtual void LostCapture() {} - virtual void Activate() {} - virtual void Deactivate() {} - virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, - bool* is_keyboard_shortcut) { - return false; - } - virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {} - virtual void HandleMouseMove() {} - virtual void HandleMouseDown() {} - virtual void HandleMouseLeave() {} - virtual void HandleMouseUp() {} - virtual void HandleMouseActivate() {} virtual void UpdatePreferredSize(const gfx::Size& pref_size) {} GURL drag_url() { diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc index 307074a..383b26e 100644 --- a/content/browser/tab_contents/interstitial_page.cc +++ b/content/browser/tab_contents/interstitial_page.cc @@ -112,17 +112,6 @@ class InterstitialPage::InterstitialPageRVHViewDelegate virtual void UpdateDragCursor(WebDragOperation operation); virtual void GotFocus(); virtual void TakeFocus(bool reverse); - virtual void LostCapture(); - virtual void Activate(); - virtual void Deactivate(); - virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, - bool* is_keyboard_shortcut); - virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); - virtual void HandleMouseMove(); - virtual void HandleMouseDown(); - virtual void HandleMouseLeave(); - virtual void HandleMouseUp(); - virtual void HandleMouseActivate(); virtual void OnFindReply(int request_id, int number_of_matches, const gfx::Rect& selection_rect, @@ -670,54 +659,6 @@ void InterstitialPage::InterstitialPageRVHViewDelegate::TakeFocus( interstitial_page_->tab()->GetViewDelegate()->TakeFocus(reverse); } -void InterstitialPage::InterstitialPageRVHViewDelegate::LostCapture() { -} - -void InterstitialPage::InterstitialPageRVHViewDelegate::Activate() { - if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) - interstitial_page_->tab()->GetViewDelegate()->Activate(); -} - -void InterstitialPage::InterstitialPageRVHViewDelegate::Deactivate() { - if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) - interstitial_page_->tab()->GetViewDelegate()->Deactivate(); -} - -bool InterstitialPage::InterstitialPageRVHViewDelegate::PreHandleKeyboardEvent( - const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { - if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) - return interstitial_page_->tab()->GetViewDelegate()->PreHandleKeyboardEvent( - event, is_keyboard_shortcut); - return false; -} - -void InterstitialPage::InterstitialPageRVHViewDelegate::HandleKeyboardEvent( - const NativeWebKeyboardEvent& event) { - if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) - interstitial_page_->tab()->GetViewDelegate()->HandleKeyboardEvent(event); -} - -void InterstitialPage::InterstitialPageRVHViewDelegate::HandleMouseMove() { - if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) - interstitial_page_->tab()->GetViewDelegate()->HandleMouseMove(); -} - -void InterstitialPage::InterstitialPageRVHViewDelegate::HandleMouseDown() { - if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) - interstitial_page_->tab()->GetViewDelegate()->HandleMouseDown(); -} - -void InterstitialPage::InterstitialPageRVHViewDelegate::HandleMouseLeave() { - if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) - interstitial_page_->tab()->GetViewDelegate()->HandleMouseLeave(); -} - -void InterstitialPage::InterstitialPageRVHViewDelegate::HandleMouseUp() { -} - -void InterstitialPage::InterstitialPageRVHViewDelegate::HandleMouseActivate() { -} - void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( int request_id, int number_of_matches, const gfx::Rect& selection_rect, int active_match_ordinal, bool final_update) { diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 6a58976..e6fbba1 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -469,6 +469,32 @@ void TabContents::Deactivate() { delegate_->DeactivateContents(this); } +void TabContents::LostCapture() { + if (delegate_) + delegate_->LostCapture(); +} + +bool TabContents::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, + bool* is_keyboard_shortcut) { + return delegate_ && + delegate_->PreHandleKeyboardEvent(event, is_keyboard_shortcut); +} + +void TabContents::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { + if (delegate_) + delegate_->HandleKeyboardEvent(event); +} + +void TabContents::HandleMouseUp() { + if (delegate_) + delegate_->HandleMouseUp(); +} + +void TabContents::HandleMouseActivate() { + if (delegate_) + delegate_->HandleMouseActivate(); +} + void TabContents::ShowContents() { RenderWidgetHostView* rwhv = GetRenderWidgetHostView(); if (rwhv) @@ -515,12 +541,6 @@ bool TabContents::NavigateToEntry( if (!dest_render_view_host) return false; // Unable to create the desired render view host. - if (delegate_ && delegate_->ShouldEnablePreferredSizeNotifications()) { - dest_render_view_host->Send(new ViewMsg_EnablePreferredSizeChangedMode( - dest_render_view_host->routing_id(), - kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow)); - } - // For security, we should never send non-Web-UI URLs to a Web UI renderer. // Double check that here. int enabled_bindings = dest_render_view_host->enabled_bindings(); diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index 9b88ea6..63e7506 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -227,13 +227,6 @@ class TabContents : public PageNavigator, // NOTE: If you override this, call the superclass version too! virtual void WasHidden(); - // Activates this contents within its containing window, bringing that window - // to the foreground if necessary. - void Activate(); - - // Deactivates this contents by deactivating its containing window. - void Deactivate(); - // TODO(brettw) document these. virtual void ShowContents(); virtual void HideContents(); @@ -668,6 +661,14 @@ class TabContents : public PageNavigator, virtual void LoadStateChanged(const GURL& url, net::LoadState load_state, uint64 upload_position, uint64 upload_size); virtual void WorkerCrashed(); + virtual void Activate(); + virtual void Deactivate(); + virtual void LostCapture(); + virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, + bool* is_keyboard_shortcut); + virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); + virtual void HandleMouseUp(); + virtual void HandleMouseActivate(); // RenderViewHostManager::Delegate ------------------------------------------- diff --git a/content/browser/tab_contents/tab_contents_delegate.cc b/content/browser/tab_contents/tab_contents_delegate.cc index 750abfc..e51c7f2d 100644 --- a/content/browser/tab_contents/tab_contents_delegate.cc +++ b/content/browser/tab_contents/tab_contents_delegate.cc @@ -208,13 +208,6 @@ gfx::NativeWindow TabContentsDelegate::GetFrameNativeWindow() { void TabContentsDelegate::TabContentsCreated(TabContents* new_contents) { } -bool TabContentsDelegate::ShouldEnablePreferredSizeNotifications() { - return false; -} - -void TabContentsDelegate::UpdatePreferredSize(const gfx::Size& pref_size) { -} - void TabContentsDelegate::ContentRestrictionsChanged(TabContents* source) { } diff --git a/content/browser/tab_contents/tab_contents_delegate.h b/content/browser/tab_contents/tab_contents_delegate.h index c14c6b7..735554f 100644 --- a/content/browser/tab_contents/tab_contents_delegate.h +++ b/content/browser/tab_contents/tab_contents_delegate.h @@ -256,16 +256,6 @@ class TabContentsDelegate { // typically happens when popups are created. virtual void TabContentsCreated(TabContents* new_contents); - // Whether the renderer should report its preferred size when it changes by - // calling UpdatePreferredSize(). - // Note that this is set when the RenderViewHost is created and cannot be - // changed after that. - virtual bool ShouldEnablePreferredSizeNotifications(); - - // Notification that the preferred size of the contents has changed. - // Only called if ShouldEnablePreferredSizeNotifications() returns true. - virtual void UpdatePreferredSize(const gfx::Size& pref_size); - // Notifies the delegate that the content restrictions for this tab has // changed. virtual void ContentRestrictionsChanged(TabContents* source); diff --git a/content/browser/tab_contents/tab_contents_view.cc b/content/browser/tab_contents/tab_contents_view.cc index 13ca172d..0019441 100644 --- a/content/browser/tab_contents/tab_contents_view.cc +++ b/content/browser/tab_contents/tab_contents_view.cc @@ -26,10 +26,6 @@ void TabContentsView::RenderWidgetHostDestroyed(RenderWidgetHost* host) { delegate_view_helper_.RenderWidgetHostDestroyed(host); } -void TabContentsView::RenderViewCreated(RenderViewHost* host) { - // Default implementation does nothing. Platforms may override. -} - void TabContentsView::CreateNewWindow( int route_id, const ViewHostMsg_CreateWindow_Params& params) { @@ -85,37 +81,12 @@ void TabContentsView::ShowCreatedWidget(int route_id, ShowCreatedWidgetInternal(widget_host_view, initial_pos); } -void TabContentsView::Activate() { - tab_contents_->Activate(); -} - -void TabContentsView::Deactivate() { - tab_contents_->Deactivate(); -} - void TabContentsView::ShowCreatedFullscreenWidget(int route_id) { RenderWidgetHostView* widget_host_view = delegate_view_helper_.GetCreatedWidget(route_id); ShowCreatedFullscreenWidgetInternal(widget_host_view); } -void TabContentsView::LostCapture() { - if (tab_contents_->delegate()) - tab_contents_->delegate()->LostCapture(); -} - -bool TabContentsView::PreHandleKeyboardEvent( - const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { - return tab_contents_->delegate() && - tab_contents_->delegate()->PreHandleKeyboardEvent( - event, is_keyboard_shortcut); -} - -void TabContentsView::UpdatePreferredSize(const gfx::Size& pref_size) { - if (tab_contents_->delegate()) - tab_contents_->delegate()->UpdatePreferredSize(pref_size); -} - bool TabContentsView::IsDoingDrag() const { return false; } @@ -126,21 +97,6 @@ bool TabContentsView::IsEventTracking() const { TabContentsView::TabContentsView() : tab_contents_(NULL) {} -void TabContentsView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { - if (tab_contents_->delegate()) - tab_contents_->delegate()->HandleKeyboardEvent(event); -} - -void TabContentsView::HandleMouseUp() { - if (tab_contents_->delegate()) - tab_contents_->delegate()->HandleMouseUp(); -} - -void TabContentsView::HandleMouseActivate() { - if (tab_contents_->delegate()) - tab_contents_->delegate()->HandleMouseActivate(); -} - RenderWidgetHostView* TabContentsView::CreateNewWidgetInternal( int route_id, WebKit::WebPopupType popup_type) { return delegate_view_helper_.CreateNewWidget(route_id, popup_type, diff --git a/content/browser/tab_contents/tab_contents_view.h b/content/browser/tab_contents/tab_contents_view.h index 4b981c3..1e6d73f 100644 --- a/content/browser/tab_contents/tab_contents_view.h +++ b/content/browser/tab_contents/tab_contents_view.h @@ -98,9 +98,8 @@ class TabContentsView : public RenderViewHostDelegate::View { void RenderWidgetHostDestroyed(RenderWidgetHost* host); // Invoked when the TabContents is notified that the RenderView has been - // fully created. The default implementation does nothing; override - // for platform-specific behavior is needed. - virtual void RenderViewCreated(RenderViewHost* host); + // fully created. + virtual void RenderViewCreated(RenderViewHost* host) {} // Sets focus to the native widget for this tab. virtual void Focus() = 0; @@ -116,29 +115,8 @@ class TabContentsView : public RenderViewHostDelegate::View { // invoked, SetInitialFocus is invoked. virtual void RestoreFocus() = 0; - // RenderViewHostDelegate::View method. Forwards to the TabContentsDelegate. - virtual void LostCapture(); - - // Keyboard events forwarding from the RenderViewHost. - // The default implementation just forward the events to the - // TabContentsDelegate object. - virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, - bool* is_keyboard_shortcut); - - // Keyboard events forwarding from the RenderViewHost. - // The default implementation just forward the events to the - // TabContentsDelegate object. - virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); - - // Simple mouse event forwarding from the RenderViewHost. - virtual void HandleMouseMove() {} - virtual void HandleMouseDown() {} - virtual void HandleMouseLeave() {} - virtual void HandleMouseUp(); - virtual void HandleMouseActivate(); - // Notification that the preferred size of the contents has changed. - virtual void UpdatePreferredSize(const gfx::Size& pref_size); + virtual void UpdatePreferredSize(const gfx::Size& pref_size) {} // If we try to close the tab while a drag is in progress, we crash. These // methods allow the tab contents to determine if a drag is in progress and @@ -196,8 +174,6 @@ class TabContentsView : public RenderViewHostDelegate::View { const gfx::Rect& initial_pos, bool user_gesture); virtual void ShowCreatedWidget(int route_id, const gfx::Rect& initial_pos); - virtual void Activate(); - virtual void Deactivate(); virtual void ShowCreatedFullscreenWidget(int route_id); // The TabContents whose contents we display. |