Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: ios/chrome/browser/ui/main/browser_view_wrangler.mm

Issue 2660143002: Removing iPad Tab Switcher experimental flag. (Closed)
Patch Set: Rebased. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/main/browser_view_wrangler.h" 5 #import "ios/chrome/browser/ui/main/browser_view_wrangler.h"
6 6
7 #include "base/mac/objc_property_releaser.h" 7 #include "base/mac/objc_property_releaser.h"
8 #import "base/mac/scoped_nsobject.h" 8 #import "base/mac/scoped_nsobject.h"
9 #include "ios/chrome/browser/application_context.h" 9 #include "ios/chrome/browser/application_context.h"
10 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 10 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 didChangeActiveTab:(Tab*)newTab 205 didChangeActiveTab:(Tab*)newTab
206 previousTab:(Tab*)previousTab 206 previousTab:(Tab*)previousTab
207 atIndex:(NSUInteger)index { 207 atIndex:(NSUInteger)index {
208 [self updateDeviceSharingManager]; 208 [self updateDeviceSharingManager];
209 } 209 }
210 210
211 - (void)tabModel:(TabModel*)model didChangeTab:(Tab*)tab { 211 - (void)tabModel:(TabModel*)model didChangeTab:(Tab*)tab {
212 [self updateDeviceSharingManager]; 212 [self updateDeviceSharingManager];
213 } 213 }
214 214
215 // Called when the number of tabs changes. Updates the switcher button
216 // visibility in the various modes on tablet.
217 - (void)tabModelDidChangeTabCount:(TabModel*)notifiedTabModel {
218 // If in tablet, update the mode switcher icon based on the number of tabs
219 // in the incognito tab strip. Doing this all the time simplifies a lot
220 // of the state transition logic and setting the property to the same value
221 // incurs no re-layout penalty.
222 [self updateModeToggle];
223 }
224
225 #pragma mark - Other public methods 215 #pragma mark - Other public methods
226 216
227 - (void)updateDeviceSharingManager { 217 - (void)updateDeviceSharingManager {
228 if (!self.deviceSharingManager) { 218 if (!self.deviceSharingManager) {
229 self.deviceSharingManager = 219 self.deviceSharingManager =
230 [[[DeviceSharingManager alloc] init] autorelease]; 220 [[[DeviceSharingManager alloc] init] autorelease];
231 } 221 }
232 [self.deviceSharingManager updateBrowserState:_browserState]; 222 [self.deviceSharingManager updateBrowserState:_browserState];
233 223
234 GURL activeURL; 224 GURL activeURL;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 // be immediately deleted. 274 // be immediately deleted.
285 self.otrTabModel = [self buildOtrTabModel:YES]; 275 self.otrTabModel = [self buildOtrTabModel:YES];
286 DCHECK(![self.otrTabModel count]); 276 DCHECK(![self.otrTabModel count]);
287 DCHECK(_browserState->HasOffTheRecordChromeBrowserState()); 277 DCHECK(_browserState->HasOffTheRecordChromeBrowserState());
288 278
289 if (otrBVCIsCurrent) { 279 if (otrBVCIsCurrent) {
290 _currentBVC = self.otrBVC; 280 _currentBVC = self.otrBVC;
291 } 281 }
292 } 282 }
293 283
294 - (void)updateModeToggle {
295 if (IsIPadIdiom()) {
296 self.mainBVC.hasModeToggleSwitch = self.otrTabModel.count ? YES : NO;
297 self.otrBVC.hasModeToggleSwitch = YES;
298 }
299 }
300
301 #pragma mark - Internal methods 284 #pragma mark - Internal methods
302 285
303 - (TabModel*)buildOtrTabModel:(BOOL)empty { 286 - (TabModel*)buildOtrTabModel:(BOOL)empty {
304 DCHECK(_browserState); 287 DCHECK(_browserState);
305 // Ensure that the OTR ChromeBrowserState is created. 288 // Ensure that the OTR ChromeBrowserState is created.
306 ios::ChromeBrowserState* otrBrowserState = 289 ios::ChromeBrowserState* otrBrowserState =
307 _browserState->GetOffTheRecordChromeBrowserState(); 290 _browserState->GetOffTheRecordChromeBrowserState();
308 DCHECK(otrBrowserState); 291 DCHECK(otrBrowserState);
309 return [self tabModelForBrowserState:otrBrowserState empty:empty]; 292 return [self tabModelForBrowserState:otrBrowserState empty:empty];
310 } 293 }
(...skipping 27 matching lines...) Expand all
338 tabModel:(TabModel*)tabModel { 321 tabModel:(TabModel*)tabModel {
339 base::scoped_nsobject<BrowserViewControllerDependencyFactory> factory( 322 base::scoped_nsobject<BrowserViewControllerDependencyFactory> factory(
340 [[BrowserViewControllerDependencyFactory alloc] 323 [[BrowserViewControllerDependencyFactory alloc]
341 initWithBrowserState:browserState]); 324 initWithBrowserState:browserState]);
342 return [[[BrowserViewController alloc] initWithTabModel:tabModel 325 return [[[BrowserViewController alloc] initWithTabModel:tabModel
343 browserState:browserState 326 browserState:browserState
344 dependencyFactory:factory] autorelease]; 327 dependencyFactory:factory] autorelease];
345 } 328 }
346 329
347 @end 330 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/main/browser_view_wrangler.h ('k') | ios/chrome/browser/ui/no_tabs/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698