OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_MAIN_BROWSER_VIEW_WRANGLER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_MAIN_BROWSER_VIEW_WRANGLER_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 #import "ios/chrome/browser/ui/main/browser_view_information.h" |
| 11 |
| 12 @class BrowsingDataRemovalController; |
| 13 @class DeviceSharingManager; |
| 14 @protocol TabModelObserver; |
| 15 |
| 16 namespace ios { |
| 17 class ChromeBrowserState; |
| 18 } |
| 19 |
| 20 // Protocol for objects that can handle switching browser state storage. |
| 21 @protocol BrowserStateStorageSwitching |
| 22 - (void)changeStorageFromBrowserState:(ios::ChromeBrowserState*)oldState |
| 23 toBrowserState:(ios::ChromeBrowserState*)newState; |
| 24 @end |
| 25 |
| 26 // Wrangler (a class in need of further refactoring) for handling the creation |
| 27 // and ownership of BrowserViewController instances and their associated |
| 28 // TabModels, and a few related methods. |
| 29 @interface BrowserViewWrangler : NSObject<BrowserViewInformation> |
| 30 |
| 31 // Initialize a new instance of this class using |browserState| as the primary |
| 32 // browser state for the tab models and BVCs, and setting |tabModelObserver|, if |
| 33 // not nil, as the tab model delegate for any tab models that are created. |
| 34 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState |
| 35 tabModelObserver:(id<TabModelObserver>)tabModelObserver |
| 36 NS_DESIGNATED_INITIALIZER; |
| 37 |
| 38 - (instancetype)init NS_UNAVAILABLE; |
| 39 |
| 40 // Set the current BVC to be |bvc|, and use |storageSwitcher| to handle the |
| 41 // storage switch. |bvc| should be one of the view controller instances already |
| 42 // owned by the receiver (either |mainBVC| or |otrBVBC|), and this method does |
| 43 // not retain or take ownership of |bvc|. |
| 44 // Note that the BrowserViewInformation protocol defines |
| 45 // |currentBVC| as a readwrite property, so users of this class can directly |
| 46 // call -setCurrentBVC: and bypass the logic in this method; that should only be |
| 47 // done on BVC instances who do not yet have a browser state. |
| 48 - (void)setCurrentBVC:(BrowserViewController*)bvc |
| 49 storageSwitcher:(id<BrowserStateStorageSwitching>)storageSwitcher; |
| 50 |
| 51 // Update the device sharing manager. This should be done after updates to the |
| 52 // tab model. This class creates and manages the state of the sharing manager. |
| 53 - (void)updateDeviceSharingManager; |
| 54 |
| 55 // Delete any incognito tab model state, using |removalController| to handle |
| 56 // the storage removal. |
| 57 - (void)deleteIncognitoTabModelState: |
| 58 (BrowsingDataRemovalController*)removalController; |
| 59 |
| 60 // Updates the mode toggle buttons on tablet. The incognito tab strip always |
| 61 // shows the switcher icon. |
| 62 - (void)updateModeToggle; |
| 63 |
| 64 @end |
| 65 |
| 66 @interface BrowserViewWrangler (Testing) |
| 67 @property(nonatomic, readonly) DeviceSharingManager* deviceSharingManager; |
| 68 @end |
| 69 |
| 70 #endif // IOS_CHROME_BROWSER_UI_MAIN_BROWSER_VIEW_WRANGLER_H_ |
OLD | NEW |