OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_ |
6 #define CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_ | 6 #define CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_ |
7 | 7 |
8 #include "base/gfx/size.h" | 8 #include "base/gfx/size.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/timer.h" |
10 #include "chrome/browser/tab_contents/tab_contents_view.h" | 11 #include "chrome/browser/tab_contents/tab_contents_view.h" |
11 #include "views/widget/widget_win.h" | 12 #include "views/widget/widget_win.h" |
12 | 13 |
13 class RenderViewContextMenuWin; | 14 class RenderViewContextMenuWin; |
14 class SadTabView; | 15 class SadTabView; |
15 struct WebDropData; | 16 struct WebDropData; |
| 17 class WebDragSource; |
16 class WebDropTarget; | 18 class WebDropTarget; |
17 | 19 |
18 // Windows-specific implementation of the TabContentsView. It is a HWND that | 20 // Windows-specific implementation of the TabContentsView. It is a HWND that |
19 // contains all of the contents of the tab and associated child views. | 21 // contains all of the contents of the tab and associated child views. |
20 class TabContentsViewWin : public TabContentsView, | 22 class TabContentsViewWin : public TabContentsView, |
21 public views::WidgetWin { | 23 public views::WidgetWin { |
22 public: | 24 public: |
23 // The corresponding TabContents is passed in the constructor, and manages our | 25 // The corresponding TabContents is passed in the constructor, and manages our |
24 // lifetime. This doesn't need to be the case, but is this way currently | 26 // lifetime. This doesn't need to be the case, but is this way currently |
25 // because that's what was easiest when they were split. | 27 // because that's what was easiest when they were split. |
(...skipping 14 matching lines...) Expand all Loading... |
40 virtual gfx::NativeWindow GetTopLevelNativeWindow() const; | 42 virtual gfx::NativeWindow GetTopLevelNativeWindow() const; |
41 virtual void GetContainerBounds(gfx::Rect* out) const; | 43 virtual void GetContainerBounds(gfx::Rect* out) const; |
42 virtual void OnContentsDestroy(); | 44 virtual void OnContentsDestroy(); |
43 virtual void SetPageTitle(const std::wstring& title); | 45 virtual void SetPageTitle(const std::wstring& title); |
44 virtual void OnTabCrashed(); | 46 virtual void OnTabCrashed(); |
45 virtual void SizeContents(const gfx::Size& size); | 47 virtual void SizeContents(const gfx::Size& size); |
46 virtual void Focus(); | 48 virtual void Focus(); |
47 virtual void SetInitialFocus(); | 49 virtual void SetInitialFocus(); |
48 virtual void StoreFocus(); | 50 virtual void StoreFocus(); |
49 virtual void RestoreFocus(); | 51 virtual void RestoreFocus(); |
| 52 virtual bool IsDoingDrag() const; |
| 53 virtual void CancelDragAndCloseTab(); |
50 | 54 |
51 // Backend implementation of RenderViewHostDelegate::View. | 55 // Backend implementation of RenderViewHostDelegate::View. |
52 virtual void ShowContextMenu(const ContextMenuParams& params); | 56 virtual void ShowContextMenu(const ContextMenuParams& params); |
53 virtual void StartDragging(const WebDropData& drop_data); | 57 virtual void StartDragging(const WebDropData& drop_data); |
54 virtual void UpdateDragCursor(bool is_drop_target); | 58 virtual void UpdateDragCursor(bool is_drop_target); |
55 virtual void GotFocus(); | 59 virtual void GotFocus(); |
56 virtual void TakeFocus(bool reverse); | 60 virtual void TakeFocus(bool reverse); |
57 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 61 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
58 | 62 |
59 // WidgetWin overridde. | 63 // WidgetWin overridde. |
60 virtual views::FocusManager* GetFocusManager(); | 64 virtual views::FocusManager* GetFocusManager(); |
61 | 65 |
62 private: | 66 private: |
| 67 // A helper method for closing the tab. |
| 68 void CloseTab(); |
| 69 |
63 // Windows events ------------------------------------------------------------ | 70 // Windows events ------------------------------------------------------------ |
64 | 71 |
65 // Overrides from WidgetWin. | 72 // Overrides from WidgetWin. |
66 virtual void OnDestroy(); | 73 virtual void OnDestroy(); |
67 virtual void OnHScroll(int scroll_type, short position, HWND scrollbar); | 74 virtual void OnHScroll(int scroll_type, short position, HWND scrollbar); |
68 virtual void OnMouseLeave(); | 75 virtual void OnMouseLeave(); |
69 virtual LRESULT OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param); | 76 virtual LRESULT OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param); |
70 virtual void OnPaint(HDC junk_dc); | 77 virtual void OnPaint(HDC junk_dc); |
71 virtual LRESULT OnReflectedMessage(UINT msg, WPARAM w_param, LPARAM l_param); | 78 virtual LRESULT OnReflectedMessage(UINT msg, WPARAM w_param, LPARAM l_param); |
72 virtual void OnVScroll(int scroll_type, short position, HWND scrollbar); | 79 virtual void OnVScroll(int scroll_type, short position, HWND scrollbar); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // The id used in the ViewStorage to store the last focused view. | 115 // The id used in the ViewStorage to store the last focused view. |
109 int last_focused_view_storage_id_; | 116 int last_focused_view_storage_id_; |
110 | 117 |
111 // The context menu. Callbacks are asynchronous so we need to keep it around. | 118 // The context menu. Callbacks are asynchronous so we need to keep it around. |
112 scoped_ptr<RenderViewContextMenuWin> context_menu_; | 119 scoped_ptr<RenderViewContextMenuWin> context_menu_; |
113 | 120 |
114 // The FocusManager associated with this tab. Stored as it is not directly | 121 // The FocusManager associated with this tab. Stored as it is not directly |
115 // accessible when unparented. | 122 // accessible when unparented. |
116 views::FocusManager* focus_manager_; | 123 views::FocusManager* focus_manager_; |
117 | 124 |
| 125 // |drag_source_| is our callback interface passed to the system when we |
| 126 // want to initiate a drag and drop operation. We use it to tell if a |
| 127 // drag operation is happening. |
| 128 scoped_refptr<WebDragSource> drag_source_; |
| 129 |
| 130 // Set to true if we want to close the tab after the system drag operation |
| 131 // has finished. |
| 132 bool close_tab_after_drag_ends_; |
| 133 |
| 134 // Used to close the tab after the stack has unwound. |
| 135 base::OneShotTimer<TabContentsViewWin> close_tab_timer_; |
| 136 |
118 DISALLOW_COPY_AND_ASSIGN(TabContentsViewWin); | 137 DISALLOW_COPY_AND_ASSIGN(TabContentsViewWin); |
119 }; | 138 }; |
120 | 139 |
121 #endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_ | 140 #endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_ |
OLD | NEW |