| 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 TabContents; | 13 class TabContents; |
| 14 class TabStripModel; | 14 class TabStripModel; |
| 15 | 15 |
| 16 namespace content { |
| 17 class WebContents; |
| 18 } |
| 19 |
| 16 // A C++ bridge class to handle receiving notifications from the C++ tab strip | 20 // A C++ bridge class to handle receiving notifications from the C++ tab strip |
| 17 // model. When the caller allocates a bridge, it automatically registers for | 21 // model. When the caller allocates a bridge, it automatically registers for |
| 18 // notifications from |model| and passes messages to |controller| via the | 22 // notifications from |model| and passes messages to |controller| via the |
| 19 // informal protocol below. The owner of this object is responsible for deleting | 23 // informal protocol below. The owner of this object is responsible for deleting |
| 20 // it (and thus unhooking notifications) before |controller| is destroyed. | 24 // it (and thus unhooking notifications) before |controller| is destroyed. |
| 21 class TabStripModelObserverBridge : public TabStripModelObserver { | 25 class TabStripModelObserverBridge : public TabStripModelObserver { |
| 22 public: | 26 public: |
| 23 TabStripModelObserverBridge(TabStripModel* model, id controller); | 27 TabStripModelObserverBridge(TabStripModel* model, id controller); |
| 24 virtual ~TabStripModelObserverBridge(); | 28 virtual ~TabStripModelObserverBridge(); |
| 25 | 29 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 51 | 55 |
| 52 private: | 56 private: |
| 53 id controller_; // weak, owns me | 57 id controller_; // weak, owns me |
| 54 TabStripModel* model_; // weak, owned by Browser | 58 TabStripModel* model_; // weak, owned by Browser |
| 55 }; | 59 }; |
| 56 | 60 |
| 57 // A collection of methods which can be selectively implemented by any | 61 // A collection of methods which can be selectively implemented by any |
| 58 // Cocoa object to receive updates about changes to a tab strip model. It is | 62 // Cocoa object to receive updates about changes to a tab strip model. It is |
| 59 // ok to not implement them, the calling code checks before calling. | 63 // ok to not implement them, the calling code checks before calling. |
| 60 @interface NSObject(TabStripModelBridge) | 64 @interface NSObject(TabStripModelBridge) |
| 61 - (void)insertTabWithContents:(TabContents*)contents | 65 - (void)insertTabWithContents:(content::WebContents*)contents |
| 62 atIndex:(NSInteger)index | 66 atIndex:(NSInteger)index |
| 63 inForeground:(bool)inForeground; | 67 inForeground:(bool)inForeground; |
| 64 - (void)tabClosingWithContents:(TabContents*)contents | 68 - (void)tabClosingWithContents:(content::WebContents*)contents |
| 65 atIndex:(NSInteger)index; | 69 atIndex:(NSInteger)index; |
| 66 - (void)tabDetachedWithContents:(TabContents*)contents | 70 - (void)tabDetachedWithContents:(content::WebContents*)contents |
| 67 atIndex:(NSInteger)index; | 71 atIndex:(NSInteger)index; |
| 68 - (void)activateTabWithContents:(TabContents*)newContents | 72 - (void)activateTabWithContents:(content::WebContents*)newContents |
| 69 previousContents:(TabContents*)oldContents | 73 previousContents:(content::WebContents*)oldContents |
| 70 atIndex:(NSInteger)index | 74 atIndex:(NSInteger)index |
| 71 userGesture:(bool)wasUserGesture; | 75 userGesture:(bool)wasUserGesture; |
| 72 - (void)tabMovedWithContents:(TabContents*)contents | 76 - (void)tabMovedWithContents:(content::WebContents*)contents |
| 73 fromIndex:(NSInteger)from | 77 fromIndex:(NSInteger)from |
| 74 toIndex:(NSInteger)to; | 78 toIndex:(NSInteger)to; |
| 75 - (void)tabChangedWithContents:(TabContents*)contents | 79 - (void)tabChangedWithContents:(content::WebContents*)contents |
| 76 atIndex:(NSInteger)index | 80 atIndex:(NSInteger)index |
| 77 changeType:(TabStripModelObserver::TabChangeType)change; | 81 changeType:(TabStripModelObserver::TabChangeType)change; |
| 78 - (void)tabReplacedWithContents:(TabContents*)newContents | 82 - (void)tabReplacedWithContents:(content::WebContents*)newContents |
| 79 previousContents:(TabContents*)oldContents | 83 previousContents:(content::WebContents*)oldContents |
| 80 atIndex:(NSInteger)index; | 84 atIndex:(NSInteger)index; |
| 81 - (void)tabMiniStateChangedWithContents:(TabContents*)contents | 85 - (void)tabMiniStateChangedWithContents:(content::WebContents*)contents |
| 82 atIndex:(NSInteger)index; | 86 atIndex:(NSInteger)index; |
| 83 - (void)tabStripEmpty; | 87 - (void)tabStripEmpty; |
| 84 - (void)tabStripModelDeleted; | 88 - (void)tabStripModelDeleted; |
| 85 @end | 89 @end |
| 86 | 90 |
| 87 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_MODEL_OBSERVER_BRIDGE_H_ | 91 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_MODEL_OBSERVER_BRIDGE_H_ |
| OLD | NEW |