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

Unified Diff: ios/clean/chrome/browser/ui/tab/tab_coordinator.mm

Issue 2814713002: Add a bottom toolbar setting. (Closed)
Patch Set: Rebased Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ios/clean/chrome/browser/ui/tab/tab_coordinator.mm
diff --git a/ios/clean/chrome/browser/ui/tab/tab_coordinator.mm b/ios/clean/chrome/browser/ui/tab/tab_coordinator.mm
index f3fa64965c2fabeb23e1592f95f3bf0fe2c2ffcb..3e26b6a82a89558bff0669512e211077225f4763 100644
--- a/ios/clean/chrome/browser/ui/tab/tab_coordinator.mm
+++ b/ios/clean/chrome/browser/ui/tab/tab_coordinator.mm
@@ -27,12 +27,6 @@
#error "This file requires ARC support."
#endif
-namespace {
-// Placeholder "experiment" flag. Change this to YES to have the toolbar at the
-// bottom.
-const BOOL kUseBottomToolbar = NO;
-} // namespace
-
@interface TabCoordinator ()<CRWWebStateObserver,
TabCommands,
UIViewControllerTransitioningDelegate>
@@ -99,6 +93,9 @@ const BOOL kUseBottomToolbar = NO;
- (void)stop {
[super stop];
+ for (BrowserCoordinator* child in self.children) {
+ [self removeChildCoordinator:child];
+ }
_webStateObserver.reset();
[self.browser->dispatcher() stopDispatchingToTarget:self];
}
@@ -133,11 +130,18 @@ const BOOL kUseBottomToolbar = NO;
#pragma mark - Experiment support
-// Create and return a new view controller for use as a tab container;
+- (BOOL)usesBottomToolbar {
+ NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
+ NSString* bottomToolbarPreference =
+ [defaults stringForKey:@"EnableBottomToolbar"];
+ return [bottomToolbarPreference isEqualToString:@"Enabled"];
+}
+
+// Creates and returns a new view controller for use as a tab container;
// experimental configurations determine which subclass of
// TabContainerViewController to return.
- (TabContainerViewController*)newTabContainer {
- if (kUseBottomToolbar) {
+ if ([self usesBottomToolbar]) {
return [[BottomToolbarTabViewController alloc] init];
}
return [[TopToolbarTabViewController alloc] init];
« no previous file with comments | « ios/clean/chrome/browser/ui/tab/BUILD.gn ('k') | ios/clean/chrome/browser/ui/tab/tab_coordinator_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698