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_COCOA_TABS_TAB_STRIP_MODEL_OBSERVER_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_MODEL_OBSERVER_BRIDGE_H_ |
6 #define CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_MODEL_OBSERVER_BRIDGE_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_MODEL_OBSERVER_BRIDGE_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 11 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
12 | 12 |
13 class TabStripModel; | 13 class TabStripModel; |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 class WebContents; | 16 class WebContents; |
17 } | 17 } |
18 | 18 |
19 // A C++ bridge class to handle receiving notifications from the C++ tab strip | 19 // A C++ bridge class to handle receiving notifications from the C++ tab strip |
20 // model. When the caller allocates a bridge, it automatically registers for | 20 // model. When the caller allocates a bridge, it automatically registers for |
21 // notifications from |model| and passes messages to |controller| via the | 21 // notifications from |model| and passes messages to |controller| via the |
22 // informal protocol below. The owner of this object is responsible for deleting | 22 // informal protocol below. The owner of this object is responsible for deleting |
23 // it (and thus unhooking notifications) before |controller| is destroyed. | 23 // it (and thus unhooking notifications) before |controller| is destroyed. |
24 class TabStripModelObserverBridge : public TabStripModelObserver { | 24 class TabStripModelObserverBridge : public TabStripModelObserver { |
25 public: | 25 public: |
26 TabStripModelObserverBridge(TabStripModel* model, id controller); | 26 TabStripModelObserverBridge(TabStripModel* model, id controller); |
27 ~TabStripModelObserverBridge() override; | 27 ~TabStripModelObserverBridge() override; |
28 | 28 |
29 // Overridden from TabStripModelObserver | 29 // Overridden from TabStripModelObserver |
30 void TabInsertedAt(content::WebContents* contents, | 30 void TabInsertedAt(TabStripModel* tab_strip_model, |
| 31 content::WebContents* contents, |
31 int index, | 32 int index, |
32 bool foreground) override; | 33 bool foreground) override; |
33 void TabClosingAt(TabStripModel* tab_strip_model, | 34 void TabClosingAt(TabStripModel* tab_strip_model, |
34 content::WebContents* contents, | 35 content::WebContents* contents, |
35 int index) override; | 36 int index) override; |
36 void TabDetachedAt(content::WebContents* contents, int index) override; | 37 void TabDetachedAt(content::WebContents* contents, int index) override; |
37 void TabDeactivated(content::WebContents* contents) override; | 38 void TabDeactivated(content::WebContents* contents) override; |
38 void ActiveTabChanged(content::WebContents* old_contents, | 39 void ActiveTabChanged(content::WebContents* old_contents, |
39 content::WebContents* new_contents, | 40 content::WebContents* new_contents, |
40 int index, | 41 int index, |
41 int reason) override; | 42 int reason) override; |
42 void TabSelectionChanged(TabStripModel* tab_strip_model, | 43 void TabSelectionChanged(TabStripModel* tab_strip_model, |
43 const ui::ListSelectionModel& old_model) override; | 44 const ui::ListSelectionModel& old_model) override; |
44 void TabMoved(content::WebContents* contents, | 45 void TabMoved(content::WebContents* contents, |
45 int from_index, | 46 int from_index, |
46 int to_index) override; | 47 int to_index) override; |
47 void TabChangedAt(content::WebContents* contents, | 48 void TabChangedAt(content::WebContents* contents, |
48 int index, | 49 int index, |
49 TabChangeType change_type) override; | 50 TabChangeType change_type) override; |
50 void TabReplacedAt(TabStripModel* tab_strip_model, | 51 void TabReplacedAt(TabStripModel* tab_strip_model, |
51 content::WebContents* old_contents, | 52 content::WebContents* old_contents, |
52 content::WebContents* new_contents, | 53 content::WebContents* new_contents, |
53 int index) override; | 54 int index) override; |
54 void TabPinnedStateChanged(content::WebContents* contents, | 55 void TabPinnedStateChanged(TabStripModel* tab_strip_model, |
| 56 content::WebContents* contents, |
55 int index) override; | 57 int index) override; |
56 void TabStripEmpty() override; | 58 void TabStripEmpty() override; |
57 | 59 |
58 private: | 60 private: |
59 id controller_; // weak, owns me | 61 id controller_; // weak, owns me |
60 TabStripModel* model_; // weak, owned by Browser | 62 TabStripModel* model_; // weak, owned by Browser |
61 }; | 63 }; |
62 | 64 |
63 // A collection of methods which can be selectively implemented by any | 65 // A collection of methods which can be selectively implemented by any |
64 // Cocoa object to receive updates about changes to a tab strip model. It is | 66 // Cocoa object to receive updates about changes to a tab strip model. It is |
(...skipping 20 matching lines...) Expand all Loading... |
85 - (void)tabReplacedWithContents:(content::WebContents*)newContents | 87 - (void)tabReplacedWithContents:(content::WebContents*)newContents |
86 previousContents:(content::WebContents*)oldContents | 88 previousContents:(content::WebContents*)oldContents |
87 atIndex:(NSInteger)index; | 89 atIndex:(NSInteger)index; |
88 - (void)tabPinnedStateChangedWithContents:(content::WebContents*)contents | 90 - (void)tabPinnedStateChangedWithContents:(content::WebContents*)contents |
89 atIndex:(NSInteger)index; | 91 atIndex:(NSInteger)index; |
90 - (void)tabStripEmpty; | 92 - (void)tabStripEmpty; |
91 - (void)tabSelectionChanged; | 93 - (void)tabSelectionChanged; |
92 @end | 94 @end |
93 | 95 |
94 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_MODEL_OBSERVER_BRIDGE_H_ | 96 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_MODEL_OBSERVER_BRIDGE_H_ |
OLD | NEW |