| 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 "base/timer.h" |
| 11 #include "chrome/browser/tab_contents/tab_contents_view.h" | 11 #include "chrome/browser/tab_contents/tab_contents_view.h" |
| 12 #include "views/widget/widget_win.h" | 12 #include "views/widget/widget_win.h" |
| 13 | 13 |
| 14 class RenderViewContextMenuWin; | 14 class RenderViewContextMenuWin; |
| 15 class SadTabView; | 15 class SadTabView; |
| 16 class TabContentsDragWin; |
| 16 struct WebDropData; | 17 struct WebDropData; |
| 17 class WebDragSource; | 18 class WebDragSource; |
| 18 class WebDropTarget; | 19 class WebDropTarget; |
| 19 | 20 |
| 20 // Windows-specific implementation of the TabContentsView. It is a HWND that | 21 // Windows-specific implementation of the TabContentsView. It is a HWND that |
| 21 // contains all of the contents of the tab and associated child views. | 22 // contains all of the contents of the tab and associated child views. |
| 22 class TabContentsViewWin : public TabContentsView, | 23 class TabContentsViewWin : public TabContentsView, |
| 23 public views::WidgetWin { | 24 public views::WidgetWin { |
| 24 public: | 25 public: |
| 25 // The corresponding TabContents is passed in the constructor, and manages our | 26 // The corresponding TabContents is passed in the constructor, and manages our |
| (...skipping 29 matching lines...) Expand all Loading... |
| 55 virtual void ShowContextMenu(const ContextMenuParams& params); | 56 virtual void ShowContextMenu(const ContextMenuParams& params); |
| 56 virtual void StartDragging(const WebDropData& drop_data, | 57 virtual void StartDragging(const WebDropData& drop_data, |
| 57 WebKit::WebDragOperationsMask operations); | 58 WebKit::WebDragOperationsMask operations); |
| 58 virtual void UpdateDragCursor(WebKit::WebDragOperation operation); | 59 virtual void UpdateDragCursor(WebKit::WebDragOperation operation); |
| 59 virtual void GotFocus(); | 60 virtual void GotFocus(); |
| 60 virtual void TakeFocus(bool reverse); | 61 virtual void TakeFocus(bool reverse); |
| 61 | 62 |
| 62 // WidgetWin overridde. | 63 // WidgetWin overridde. |
| 63 virtual views::FocusManager* GetFocusManager(); | 64 virtual views::FocusManager* GetFocusManager(); |
| 64 | 65 |
| 66 void EndDragging(); |
| 67 |
| 68 WebDropTarget* drop_target() const { return drop_target_.get(); } |
| 69 |
| 65 private: | 70 private: |
| 66 // A helper method for closing the tab. | 71 // A helper method for closing the tab. |
| 67 void CloseTab(); | 72 void CloseTab(); |
| 68 | 73 |
| 69 // Windows events ------------------------------------------------------------ | 74 // Windows events ------------------------------------------------------------ |
| 70 | 75 |
| 71 // Overrides from WidgetWin. | 76 // Overrides from WidgetWin. |
| 72 virtual void OnDestroy(); | 77 virtual void OnDestroy(); |
| 73 virtual void OnHScroll(int scroll_type, short position, HWND scrollbar); | 78 virtual void OnHScroll(int scroll_type, short position, HWND scrollbar); |
| 74 virtual void OnMouseLeave(); | 79 virtual void OnMouseLeave(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // The id used in the ViewStorage to store the last focused view. | 116 // The id used in the ViewStorage to store the last focused view. |
| 112 int last_focused_view_storage_id_; | 117 int last_focused_view_storage_id_; |
| 113 | 118 |
| 114 // The context menu. Callbacks are asynchronous so we need to keep it around. | 119 // The context menu. Callbacks are asynchronous so we need to keep it around. |
| 115 scoped_ptr<RenderViewContextMenuWin> context_menu_; | 120 scoped_ptr<RenderViewContextMenuWin> context_menu_; |
| 116 | 121 |
| 117 // The FocusManager associated with this tab. Stored as it is not directly | 122 // The FocusManager associated with this tab. Stored as it is not directly |
| 118 // accessible when unparented. | 123 // accessible when unparented. |
| 119 views::FocusManager* focus_manager_; | 124 views::FocusManager* focus_manager_; |
| 120 | 125 |
| 121 // |drag_source_| is our callback interface passed to the system when we | |
| 122 // want to initiate a drag and drop operation. We use it to tell if a | |
| 123 // drag operation is happening. | |
| 124 scoped_refptr<WebDragSource> drag_source_; | |
| 125 | |
| 126 // Set to true if we want to close the tab after the system drag operation | 126 // Set to true if we want to close the tab after the system drag operation |
| 127 // has finished. | 127 // has finished. |
| 128 bool close_tab_after_drag_ends_; | 128 bool close_tab_after_drag_ends_; |
| 129 | 129 |
| 130 // Used to close the tab after the stack has unwound. | 130 // Used to close the tab after the stack has unwound. |
| 131 base::OneShotTimer<TabContentsViewWin> close_tab_timer_; | 131 base::OneShotTimer<TabContentsViewWin> close_tab_timer_; |
| 132 | 132 |
| 133 // Used to handle the drag-and-drop. |
| 134 scoped_refptr<TabContentsDragWin> drag_handler_; |
| 135 |
| 133 DISALLOW_COPY_AND_ASSIGN(TabContentsViewWin); | 136 DISALLOW_COPY_AND_ASSIGN(TabContentsViewWin); |
| 134 }; | 137 }; |
| 135 | 138 |
| 136 #endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_ | 139 #endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_ |
| OLD | NEW |