Commit 69467c7c authored by Nazerke's avatar Nazerke Committed by Commit Bot

[ios] Add a TabStrip CollectionViewController.

This CL adds a view controller for the TabStrip and adds it as a
property to TabStripCoordinator along with other its required
properties.

Bug: 1128249,1130401, 1130400
Change-Id: I891ee1f2d5551aba7ce39c7fa68d8dfe0c56ac3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2421108Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Nazerke Kalidolda <nazerke@google.com>
Cr-Commit-Position: refs/heads/master@{#811046}
parent 490b8678
......@@ -10,7 +10,23 @@ source_set("tab_strip") {
]
deps = [
"//base",
"//ios/chrome/browser/browser_state",
"//ios/chrome/browser/main:public",
"//ios/chrome/browser/ui/coordinators:chrome_coordinators",
"//ios/chrome/browser/ui/tab_strip:tab_strip_ui",
]
frameworks = [ "UIKit.framework" ]
}
source_set("tab_strip_ui") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"tab_strip_view_controller.h",
"tab_strip_view_controller.mm",
]
deps = [
"//ios/chrome/browser/browser_state",
"//ios/chrome/browser/main:public",
]
frameworks = [ "UIKit.framework" ]
}
......@@ -8,6 +8,8 @@
#import "ios/chrome/browser/ui/coordinators/chrome_coordinator.h"
class Browser;
@protocol PopupMenuLongPressDelegate;
@class TabStripViewController;
// Coordinator for the tab strip.
@interface TabStripCoordinator : ChromeCoordinator
......@@ -19,6 +21,12 @@ class Browser;
- (instancetype)initWithBaseViewController:(UIViewController*)viewController
browser:(Browser*)browser NS_UNAVAILABLE;
// The TabStrip view controller owned by this coordinator.
@property(nonatomic, strong) UIViewController* viewController;
// Delegate for the long press gesture recognizer triggering popup menu.
@property(nonatomic, weak) id<PopupMenuLongPressDelegate> longPressDelegate;
@end
#endif // IOS_CHROME_BROWSER_UI_TAB_STRIP_TAB_STRIP_COORDINATOR_H_
......@@ -5,14 +5,14 @@
#import "ios/chrome/browser/ui/tab_strip/tab_strip_coordinator.h"
#include "base/check_op.h"
#import "ios/chrome/browser/browser_state/chrome_browser_state.h"
#import "ios/chrome/browser/main/browser.h"
#import "ios/chrome/browser/ui/tab_strip/tab_strip_view_controller.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@interface TabStripCoordinator ()
@end
@implementation TabStripCoordinator
#pragma mark - ChromeCoordinator
......@@ -22,4 +22,27 @@
return [super initWithBaseViewController:nil browser:browser];
}
- (void)start {
if (self.viewController)
return;
self.viewController = [[TabStripViewController alloc] init];
if (@available(iOS 13, *)) {
self.viewController.overrideUserInterfaceStyle =
self.browser->GetBrowserState()->IsOffTheRecord()
? UIUserInterfaceStyleDark
: UIUserInterfaceStyleUnspecified;
}
}
- (void)stop {
self.viewController = nil;
}
#pragma mark - Properties
- (void)setLongPressDelegate:(id<PopupMenuLongPressDelegate>)longPressDelegate {
_longPressDelegate = longPressDelegate;
}
@end
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_TAB_STRIP_TAB_STRIP_VIEW_CONTROLLER_H_
#define IOS_CHROME_BROWSER_UI_TAB_STRIP_TAB_STRIP_VIEW_CONTROLLER_H_
#import <UIKit/UIKit.h>
@protocol PopupMenuLongPressDelegate;
// ViewController for the TabStrip. This ViewController is contained by
// BrowserViewController. This TabStripViewController is responsible for
// responding to the different updates in the tabstrip view.
@interface TabStripViewController : UICollectionViewController
@end
#endif // IOS_CHROME_BROWSER_UI_TAB_STRIP_TAB_STRIP_VIEW_CONTROLLER_H_
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/tab_strip/tab_strip_view_controller.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation TabStripViewController
@end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment