| OLD | NEW |
| 1 // Copyright (c) 2009 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 #include "chrome/browser/cocoa/tab_strip_model_observer_bridge.h" | 5 #include "chrome/browser/cocoa/tab_strip_model_observer_bridge.h" |
| 6 | 6 |
| 7 TabStripModelObserverBridge::TabStripModelObserverBridge(TabStripModel* model, | 7 TabStripModelObserverBridge::TabStripModelObserverBridge(TabStripModel* model, |
| 8 id controller) | 8 id controller) |
| 9 : controller_(controller), model_(model) { | 9 : controller_(controller), model_(model) { |
| 10 DCHECK(model && controller); | 10 DCHECK(model && controller); |
| 11 // Register to be a listener on the model so we can get updates and tell | 11 // Register to be a listener on the model so we can get updates and tell |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 previousContents:old_contents | 56 previousContents:old_contents |
| 57 atIndex:index | 57 atIndex:index |
| 58 userGesture:user_gesture]; | 58 userGesture:user_gesture]; |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 void TabStripModelObserverBridge::TabMoved(TabContents* contents, | 62 void TabStripModelObserverBridge::TabMoved(TabContents* contents, |
| 63 int from_index, | 63 int from_index, |
| 64 int to_index) { | 64 int to_index) { |
| 65 if ([controller_ respondsToSelector: | 65 if ([controller_ respondsToSelector: |
| 66 @selector(tabMovedWithContents:fromIndex:toIndex:pinnedStateChanged:)]) { | 66 @selector(tabMovedWithContents:fromIndex:toIndex:)]) { |
| 67 // TODO: clean this up, need to remove pinnedStateChanged param. | |
| 68 [controller_ tabMovedWithContents:contents | 67 [controller_ tabMovedWithContents:contents |
| 69 fromIndex:from_index | 68 fromIndex:from_index |
| 70 toIndex:to_index | 69 toIndex:to_index]; |
| 71 pinnedStateChanged:NO]; | |
| 72 } | 70 } |
| 73 } | 71 } |
| 74 | 72 |
| 75 void TabStripModelObserverBridge::TabChangedAt(TabContents* contents, | 73 void TabStripModelObserverBridge::TabChangedAt(TabContents* contents, |
| 76 int index, | 74 int index, |
| 77 TabChangeType change_type) { | 75 TabChangeType change_type) { |
| 78 if ([controller_ respondsToSelector: | 76 if ([controller_ respondsToSelector: |
| 79 @selector(tabChangedWithContents:atIndex:changeType:)]) { | 77 @selector(tabChangedWithContents:atIndex:changeType:)]) { |
| 80 [controller_ tabChangedWithContents:contents | 78 [controller_ tabChangedWithContents:contents |
| 81 atIndex:index | 79 atIndex:index |
| 82 changeType:change_type]; | 80 changeType:change_type]; |
| 83 } | 81 } |
| 84 } | 82 } |
| 85 | 83 |
| 86 void TabStripModelObserverBridge::TabPinnedStateChanged(TabContents* contents, | 84 void TabStripModelObserverBridge::TabReplacedAt(TabContents* old_contents, |
| 87 int index) { | 85 TabContents* new_contents, |
| 86 int index) { |
| 87 TabChangedAt(new_contents, index, ALL); |
| 88 } |
| 89 |
| 90 void TabStripModelObserverBridge::TabMiniStateChanged(TabContents* contents, |
| 91 int index) { |
| 88 if ([controller_ respondsToSelector: | 92 if ([controller_ respondsToSelector: |
| 89 @selector(tabPinnedStateChangedWithContents:atIndex:)]) { | 93 @selector(tabMiniStateChangedWithContents:atIndex:)]) { |
| 90 [controller_ tabPinnedStateChangedWithContents:contents | 94 [controller_ tabMiniStateChangedWithContents:contents atIndex:index]; |
| 91 atIndex:index]; | |
| 92 } | 95 } |
| 93 } | 96 } |
| 94 | 97 |
| 95 void TabStripModelObserverBridge::TabStripEmpty() { | 98 void TabStripModelObserverBridge::TabStripEmpty() { |
| 96 if ([controller_ respondsToSelector:@selector(tabStripEmpty)]) | 99 if ([controller_ respondsToSelector:@selector(tabStripEmpty)]) |
| 97 [controller_ tabStripEmpty]; | 100 [controller_ tabStripEmpty]; |
| 98 } | 101 } |
| OLD | NEW |