| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GTK_TABS_DRAG_DATA_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_TABS_DRAG_DATA_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_TABS_DRAG_DATA_H_ | 6 #define CHROME_BROWSER_UI_GTK_TABS_DRAG_DATA_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 | 12 |
| 13 class TabContents; | 13 class TabContents; |
| 14 typedef TabContents TabContentsWrapper; | |
| 15 class TabGtk; | 14 class TabGtk; |
| 16 | 15 |
| 17 namespace content { | 16 namespace content { |
| 18 class WebContents; | 17 class WebContents; |
| 19 class WebContentsDelegate; | 18 class WebContentsDelegate; |
| 20 } | 19 } |
| 21 | 20 |
| 22 struct DraggedTabData { | 21 struct DraggedTabData { |
| 23 public: | 22 public: |
| 24 DraggedTabData(); | 23 DraggedTabData(); |
| 25 DraggedTabData(TabGtk* tab, | 24 DraggedTabData(TabGtk* tab, |
| 26 TabContentsWrapper* contents, | 25 TabContents* contents, |
| 27 content::WebContentsDelegate* original_delegate, | 26 content::WebContentsDelegate* original_delegate, |
| 28 int source_model_index, | 27 int source_model_index, |
| 29 bool pinned, | 28 bool pinned, |
| 30 bool mini); | 29 bool mini); |
| 31 ~DraggedTabData(); | 30 ~DraggedTabData(); |
| 32 | 31 |
| 33 // Resetting the delegate of |contents_->web_contents()| to | 32 // Resetting the delegate of |contents_->web_contents()| to |
| 34 // |original_delegate_|. | 33 // |original_delegate_|. |
| 35 void ResetDelegate(); | 34 void ResetDelegate(); |
| 36 | 35 |
| 37 // The tab being dragged. | 36 // The tab being dragged. |
| 38 TabGtk* tab_; | 37 TabGtk* tab_; |
| 39 | 38 |
| 40 // The TabContentsWrapper being dragged. | 39 // The TabContents being dragged. |
| 41 TabContentsWrapper* contents_; | 40 TabContents* contents_; |
| 42 | 41 |
| 43 // The original content::WebContentsDelegate of |contents|, before it was | 42 // The original content::WebContentsDelegate of |contents|, before it was |
| 44 // detached from the browser window. We store this so that we can forward | 43 // detached from the browser window. We store this so that we can forward |
| 45 // certain delegate notifications back to it if we can't handle them locally. | 44 // certain delegate notifications back to it if we can't handle them locally. |
| 46 content::WebContentsDelegate* original_delegate_; | 45 content::WebContentsDelegate* original_delegate_; |
| 47 | 46 |
| 48 // This is the index of |contents| in |source_tabstrip_| when the drag | 47 // This is the index of |contents| in |source_tabstrip_| when the drag |
| 49 // began. This is used to restore the previous state if the drag is aborted. | 48 // began. This is used to restore the previous state if the drag is aborted. |
| 50 int source_model_index_; | 49 int source_model_index_; |
| 51 | 50 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 83 |
| 85 // Convenience method for getting the drag data associated with tab at |index| | 84 // Convenience method for getting the drag data associated with tab at |index| |
| 86 // within |drag_data_|. | 85 // within |drag_data_|. |
| 87 DraggedTabData* get(size_t index) { return &drag_data_[index]; } | 86 DraggedTabData* get(size_t index) { return &drag_data_[index]; } |
| 88 | 87 |
| 89 int source_tab_index() const { return source_tab_index_; } | 88 int source_tab_index() const { return source_tab_index_; } |
| 90 int mini_tab_count() const { return mini_tab_count_; } | 89 int mini_tab_count() const { return mini_tab_count_; } |
| 91 int non_mini_tab_count() const { return non_mini_tab_count_; } | 90 int non_mini_tab_count() const { return non_mini_tab_count_; } |
| 92 | 91 |
| 93 // Convenience for |source_tab_drag_data()->contents_|. | 92 // Convenience for |source_tab_drag_data()->contents_|. |
| 94 TabContentsWrapper* GetSourceTabContentsWrapper(); | 93 TabContents* GetSourceTabContents(); |
| 95 | 94 |
| 96 // Convenience for |source_tab_drag_data()->contents_->web_contents()|. | 95 // Convenience for |source_tab_drag_data()->contents_->web_contents()|. |
| 97 content::WebContents* GetSourceWebContents(); | 96 content::WebContents* GetSourceWebContents(); |
| 98 | 97 |
| 99 // Convenience for getting the DraggedTabData corresponding to the tab that | 98 // Convenience for getting the DraggedTabData corresponding to the tab that |
| 100 // was under the mouse pointer when the user started dragging. | 99 // was under the mouse pointer when the user started dragging. |
| 101 DraggedTabData* GetSourceTabData(); | 100 DraggedTabData* GetSourceTabData(); |
| 102 | 101 |
| 103 private: | 102 private: |
| 104 std::vector<DraggedTabData> drag_data_; | 103 std::vector<DraggedTabData> drag_data_; |
| 105 | 104 |
| 106 // Index of the source tab in |drag_data_|. | 105 // Index of the source tab in |drag_data_|. |
| 107 int source_tab_index_; | 106 int source_tab_index_; |
| 108 // Number of non mini tabs within |drag_data_|. | 107 // Number of non mini tabs within |drag_data_|. |
| 109 int non_mini_tab_count_; | 108 int non_mini_tab_count_; |
| 110 // Number of mini tabs within |drag_data_|. | 109 // Number of mini tabs within |drag_data_|. |
| 111 int mini_tab_count_; | 110 int mini_tab_count_; |
| 112 | 111 |
| 113 DISALLOW_COPY_AND_ASSIGN(DragData); | 112 DISALLOW_COPY_AND_ASSIGN(DragData); |
| 114 }; | 113 }; |
| 115 | 114 |
| 116 #endif // CHROME_BROWSER_UI_GTK_TABS_DRAG_DATA_H_ | 115 #endif // CHROME_BROWSER_UI_GTK_TABS_DRAG_DATA_H_ |
| OLD | NEW |