| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_VIEWS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/timer.h" | 11 #include "base/timer.h" |
| 12 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate
.h" | 12 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate
.h" |
| 13 #include "content/browser/tab_contents/tab_contents_view_helper.h" | 13 #include "content/browser/tab_contents/tab_contents_view_helper.h" |
| 14 #include "content/public/browser/web_contents_view.h" | 14 #include "content/public/browser/web_contents_view.h" |
| 15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
| 16 | 16 |
| 17 class NativeTabContentsView; | 17 class NativeTabContentsView; |
| 18 class RenderViewContextMenuViews; | 18 class RenderViewContextMenuViews; |
| 19 class SkBitmap; | 19 class SkBitmap; |
| 20 struct WebDropData; | 20 struct WebDropData; |
| 21 namespace gfx { | 21 namespace gfx { |
| 22 class Point; | 22 class Point; |
| 23 class Size; | 23 class Size; |
| 24 } | 24 } |
| 25 namespace views { | 25 namespace views { |
| 26 class Widget; | 26 class Widget; |
| 27 } | 27 } |
| 28 namespace content { |
| 29 class WebContentsViewDelegate; |
| 30 class WebDragDestDelegate; |
| 31 } |
| 28 | 32 |
| 29 // Views-specific implementation of the WebContentsView. | 33 // Views-specific implementation of the WebContentsView. |
| 30 class TabContentsViewViews : public views::Widget, | 34 class TabContentsViewViews : public views::Widget, |
| 31 public content::WebContentsView, | 35 public content::WebContentsView, |
| 32 public internal::NativeTabContentsViewDelegate { | 36 public internal::NativeTabContentsViewDelegate { |
| 33 public: | 37 public: |
| 34 // The corresponding WebContents is passed in the constructor, and manages our | 38 // The corresponding WebContents is passed in the constructor, and manages our |
| 35 // lifetime. This doesn't need to be the case, but is this way currently | 39 // lifetime. This doesn't need to be the case, but is this way currently |
| 36 // because that's what was easiest when they were split. | 40 // because that's what was easiest when they were split. |
| 37 explicit TabContentsViewViews(content::WebContents* web_contents); | 41 explicit TabContentsViewViews(content::WebContents* web_contents, |
| 42 content::WebContentsViewDelegate* delegate); |
| 38 virtual ~TabContentsViewViews(); | 43 virtual ~TabContentsViewViews(); |
| 39 | 44 |
| 40 NativeTabContentsView* native_tab_contents_view() const { | 45 NativeTabContentsView* native_tab_contents_view() const { |
| 41 return native_tab_contents_view_; | 46 return native_tab_contents_view_; |
| 42 } | 47 } |
| 43 | 48 |
| 44 // Overridden from WebContentsView: | 49 // Overridden from WebContentsView: |
| 45 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; | 50 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; |
| 46 virtual content::RenderWidgetHostView* CreateViewForWidget( | 51 virtual content::RenderWidgetHostView* CreateViewForWidget( |
| 47 content::RenderWidgetHost* render_widget_host) OVERRIDE; | 52 content::RenderWidgetHost* render_widget_host) OVERRIDE; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 virtual content::WebContents* GetWebContents() OVERRIDE; | 104 virtual content::WebContents* GetWebContents() OVERRIDE; |
| 100 virtual void OnNativeTabContentsViewShown() OVERRIDE; | 105 virtual void OnNativeTabContentsViewShown() OVERRIDE; |
| 101 virtual void OnNativeTabContentsViewHidden() OVERRIDE; | 106 virtual void OnNativeTabContentsViewHidden() OVERRIDE; |
| 102 virtual void OnNativeTabContentsViewSized(const gfx::Size& size) OVERRIDE; | 107 virtual void OnNativeTabContentsViewSized(const gfx::Size& size) OVERRIDE; |
| 103 virtual void OnNativeTabContentsViewWheelZoom(bool zoom_in) OVERRIDE; | 108 virtual void OnNativeTabContentsViewWheelZoom(bool zoom_in) OVERRIDE; |
| 104 virtual void OnNativeTabContentsViewMouseDown() OVERRIDE; | 109 virtual void OnNativeTabContentsViewMouseDown() OVERRIDE; |
| 105 virtual void OnNativeTabContentsViewMouseMove(bool motion) OVERRIDE; | 110 virtual void OnNativeTabContentsViewMouseMove(bool motion) OVERRIDE; |
| 106 virtual void OnNativeTabContentsViewDraggingEnded() OVERRIDE; | 111 virtual void OnNativeTabContentsViewDraggingEnded() OVERRIDE; |
| 107 virtual views::internal::NativeWidgetDelegate* | 112 virtual views::internal::NativeWidgetDelegate* |
| 108 AsNativeWidgetDelegate() OVERRIDE; | 113 AsNativeWidgetDelegate() OVERRIDE; |
| 114 virtual content::WebDragDestDelegate* GetDragDestDelegate() OVERRIDE; |
| 109 | 115 |
| 110 // Overridden from views::Widget: | 116 // Overridden from views::Widget: |
| 111 virtual void OnNativeWidgetVisibilityChanged(bool visible) OVERRIDE; | 117 virtual void OnNativeWidgetVisibilityChanged(bool visible) OVERRIDE; |
| 112 virtual void OnNativeWidgetSizeChanged(const gfx::Size& new_size) OVERRIDE; | 118 virtual void OnNativeWidgetSizeChanged(const gfx::Size& new_size) OVERRIDE; |
| 113 | 119 |
| 114 // A helper method for closing the tab. | 120 // A helper method for closing the tab. |
| 115 void CloseTab(); | 121 void CloseTab(); |
| 116 | 122 |
| 117 views::Widget* GetSadTab() const; | 123 views::Widget* GetSadTab() const; |
| 118 | 124 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 132 // The context menu. Callbacks are asynchronous so we need to keep it around. | 138 // The context menu. Callbacks are asynchronous so we need to keep it around. |
| 133 scoped_ptr<RenderViewContextMenuViews> context_menu_; | 139 scoped_ptr<RenderViewContextMenuViews> context_menu_; |
| 134 | 140 |
| 135 // Set to true if we want to close the tab after the system drag operation | 141 // Set to true if we want to close the tab after the system drag operation |
| 136 // has finished. | 142 // has finished. |
| 137 bool close_tab_after_drag_ends_; | 143 bool close_tab_after_drag_ends_; |
| 138 | 144 |
| 139 // Used to close the tab after the stack has unwound. | 145 // Used to close the tab after the stack has unwound. |
| 140 base::OneShotTimer<TabContentsViewViews> close_tab_timer_; | 146 base::OneShotTimer<TabContentsViewViews> close_tab_timer_; |
| 141 | 147 |
| 148 // Chrome specific functionality (to make it easier for this class to |
| 149 // eventually move to content). |
| 150 scoped_ptr<content::WebContentsViewDelegate> delegate_; |
| 151 |
| 142 DISALLOW_COPY_AND_ASSIGN(TabContentsViewViews); | 152 DISALLOW_COPY_AND_ASSIGN(TabContentsViewViews); |
| 143 }; | 153 }; |
| 144 | 154 |
| 145 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_VIEWS_H_ | 155 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_VIEWS_H_ |
| OLD | NEW |