OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_model.h" | 5 #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_model.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "components/browser_sync/profile_sync_service.h" | 10 #include "components/browser_sync/profile_sync_service.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 - (NSInteger)distantSessionCount { | 143 - (NSInteger)distantSessionCount { |
144 return _syncedSessions->GetSessionCount(); | 144 return _syncedSessions->GetSessionCount(); |
145 } | 145 } |
146 | 146 |
147 - (ios::ChromeBrowserState*)browserState { | 147 - (ios::ChromeBrowserState*)browserState { |
148 return _browserState; | 148 return _browserState; |
149 } | 149 } |
150 | 150 |
151 - (TabModel*)tabModelForSessionOfType:(TabSwitcherSessionType)type { | 151 - (TabModel*)tabModelForSessionOfType:(TabSwitcherSessionType)type { |
152 DCHECK(type == TabSwitcherSessionType::OFF_THE_RECORD_SESSION || | 152 DCHECK(TabSwitcherSessionTypeIsLocalSession(type)); |
153 type == TabSwitcherSessionType::REGULAR_SESSION); | |
154 return type == TabSwitcherSessionType::OFF_THE_RECORD_SESSION ? _otrTabModel | 153 return type == TabSwitcherSessionType::OFF_THE_RECORD_SESSION ? _otrTabModel |
155 : _mainTabModel; | 154 : _mainTabModel; |
156 } | 155 } |
157 | 156 |
158 - (NSInteger)numberOfTabsInLocalSessionOfType:(TabSwitcherSessionType)type { | 157 - (NSInteger)numberOfTabsInLocalSessionOfType:(TabSwitcherSessionType)type { |
159 TabModelSnapshot* tabModelSnapshot = [self tabModelSnapshotForSession:type]; | 158 TabModelSnapshot* tabModelSnapshot = [self tabModelSnapshotForSession:type]; |
160 return tabModelSnapshot->tabs().size(); | 159 return tabModelSnapshot->tabs().size(); |
161 } | 160 } |
162 | 161 |
163 - (Tab*)tabAtIndex:(NSUInteger)index | 162 - (Tab*)tabAtIndex:(NSUInteger)index |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 [self tabModelChanged:model]; | 393 [self tabModelChanged:model]; |
395 } | 394 } |
396 | 395 |
397 - (void)tabModel:(TabModel*)model | 396 - (void)tabModel:(TabModel*)model |
398 didChangeTabSnapshot:(Tab*)tab | 397 didChangeTabSnapshot:(Tab*)tab |
399 withImage:(UIImage*)image { | 398 withImage:(UIImage*)image { |
400 [self tabModelChanged:model]; | 399 [self tabModelChanged:model]; |
401 } | 400 } |
402 | 401 |
403 @end | 402 @end |
OLD | NEW |