OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "chrome/browser/tabs/tab_strip_model.h" | 10 #include "chrome/browser/tabs/tab_strip_model.h" |
11 #include "chrome/browser/views/tabs/tab_strip_controller.h" | 11 #include "chrome/browser/views/tabs/tab_strip_controller.h" |
12 #include "chrome/common/notification_observer.h" | 12 #include "chrome/common/notification_observer.h" |
13 #include "chrome/common/notification_registrar.h" | 13 #include "chrome/common/notification_registrar.h" |
14 | 14 |
15 class BaseTab; | 15 class BaseTab; |
16 class BaseTabStrip; | 16 class BaseTabStrip; |
17 class Browser; | 17 class Browser; |
18 | 18 |
19 struct TabRendererData; | 19 struct TabRendererData; |
20 | 20 |
21 // An implementation of TabStripController that sources data from the | 21 // An implementation of TabStripController that sources data from the |
22 // TabContentses in a TabStripModel. | 22 // TabContentsWrappers in a TabStripModel. |
23 class BrowserTabStripController : public TabStripController, | 23 class BrowserTabStripController : public TabStripController, |
24 public TabStripModelObserver, | 24 public TabStripModelObserver, |
25 public NotificationObserver { | 25 public NotificationObserver { |
26 public: | 26 public: |
27 BrowserTabStripController(Browser* browser, TabStripModel* model); | 27 BrowserTabStripController(Browser* browser, TabStripModel* model); |
28 virtual ~BrowserTabStripController(); | 28 virtual ~BrowserTabStripController(); |
29 | 29 |
30 void InitFromModel(BaseTabStrip* tabstrip); | 30 void InitFromModel(BaseTabStrip* tabstrip); |
31 | 31 |
32 TabStripModel* model() const { return model_; } | 32 TabStripModel* model() const { return model_; } |
(...skipping 17 matching lines...) Expand all Loading... |
50 virtual void SelectTab(int model_index); | 50 virtual void SelectTab(int model_index); |
51 virtual void CloseTab(int model_index); | 51 virtual void CloseTab(int model_index); |
52 virtual void ShowContextMenu(BaseTab* tab, const gfx::Point& p); | 52 virtual void ShowContextMenu(BaseTab* tab, const gfx::Point& p); |
53 virtual void UpdateLoadingAnimations(); | 53 virtual void UpdateLoadingAnimations(); |
54 virtual int HasAvailableDragActions() const; | 54 virtual int HasAvailableDragActions() const; |
55 virtual void PerformDrop(bool drop_before, int index, const GURL& url); | 55 virtual void PerformDrop(bool drop_before, int index, const GURL& url); |
56 virtual bool IsCompatibleWith(BaseTabStrip* other) const; | 56 virtual bool IsCompatibleWith(BaseTabStrip* other) const; |
57 virtual void CreateNewTab(); | 57 virtual void CreateNewTab(); |
58 | 58 |
59 // TabStripModelObserver implementation: | 59 // TabStripModelObserver implementation: |
60 virtual void TabInsertedAt(TabContents* contents, | 60 virtual void TabInsertedAt(TabContentsWrapper* contents, |
61 int model_index, | 61 int model_index, |
62 bool foreground); | 62 bool foreground); |
63 virtual void TabDetachedAt(TabContents* contents, int model_index); | 63 virtual void TabDetachedAt(TabContentsWrapper* contents, int model_index); |
64 virtual void TabSelectedAt(TabContents* old_contents, | 64 virtual void TabSelectedAt(TabContentsWrapper* old_contents, |
65 TabContents* contents, | 65 TabContentsWrapper* contents, |
66 int model_index, | 66 int model_index, |
67 bool user_gesture); | 67 bool user_gesture); |
68 virtual void TabMoved(TabContents* contents, | 68 virtual void TabMoved(TabContentsWrapper* contents, |
69 int from_model_index, | 69 int from_model_index, |
70 int to_model_index); | 70 int to_model_index); |
71 virtual void TabChangedAt(TabContents* contents, | 71 virtual void TabChangedAt(TabContentsWrapper* contents, |
72 int model_index, | 72 int model_index, |
73 TabChangeType change_type); | 73 TabChangeType change_type); |
74 virtual void TabReplacedAt(TabContents* old_contents, | 74 virtual void TabReplacedAt(TabContentsWrapper* old_contents, |
75 TabContents* new_contents, | 75 TabContentsWrapper* new_contents, |
76 int model_index); | 76 int model_index); |
77 virtual void TabPinnedStateChanged(TabContents* contents, int model_index); | 77 virtual void TabPinnedStateChanged(TabContentsWrapper* contents, |
78 virtual void TabMiniStateChanged(TabContents* contents, int model_index); | 78 int model_index); |
79 virtual void TabBlockedStateChanged(TabContents* contents, int model_index); | 79 virtual void TabMiniStateChanged(TabContentsWrapper* contents, |
| 80 int model_index); |
| 81 virtual void TabBlockedStateChanged(TabContentsWrapper* contents, |
| 82 int model_index); |
80 | 83 |
81 // NotificationObserver implementation: | 84 // NotificationObserver implementation: |
82 virtual void Observe(NotificationType type, const NotificationSource& source, | 85 virtual void Observe(NotificationType type, const NotificationSource& source, |
83 const NotificationDetails& details); | 86 const NotificationDetails& details); |
84 | 87 |
85 private: | 88 private: |
86 class TabContextMenuContents; | 89 class TabContextMenuContents; |
87 | 90 |
88 // Invokes tabstrip_->SetTabData. | 91 // Invokes tabstrip_->SetTabData. |
89 void SetTabDataAt(TabContents* contents, int model_index); | 92 void SetTabDataAt(TabContentsWrapper* contents, int model_index); |
90 | 93 |
91 // Sets the TabRendererData from the TabStripModel. | 94 // Sets the TabRendererData from the TabStripModel. |
92 void SetTabRendererDataFromModel(TabContents* contents, | 95 void SetTabRendererDataFromModel(TabContents* contents, |
93 int model_index, | 96 int model_index, |
94 TabRendererData* data); | 97 TabRendererData* data); |
95 | 98 |
96 void StartHighlightTabsForCommand( | 99 void StartHighlightTabsForCommand( |
97 TabStripModel::ContextMenuCommand command_id, | 100 TabStripModel::ContextMenuCommand command_id, |
98 BaseTab* tab); | 101 BaseTab* tab); |
99 void StopHighlightTabsForCommand( | 102 void StopHighlightTabsForCommand( |
(...skipping 12 matching lines...) Expand all Loading... |
112 // If non-NULL it means we're showing a menu for the tab. | 115 // If non-NULL it means we're showing a menu for the tab. |
113 scoped_ptr<TabContextMenuContents> context_menu_contents_; | 116 scoped_ptr<TabContextMenuContents> context_menu_contents_; |
114 | 117 |
115 NotificationRegistrar notification_registrar_; | 118 NotificationRegistrar notification_registrar_; |
116 | 119 |
117 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); | 120 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); |
118 }; | 121 }; |
119 | 122 |
120 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 123 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |
121 | 124 |
OLD | NEW |