OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 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_BROWSER_VIEW_CONTROLLER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_BROWSER_VIEW_CONTROLLER_H_ |
| 7 |
| 8 #import <MessageUI/MessageUI.h> |
| 9 #import <StoreKit/StoreKit.h> |
| 10 #import <UIKit/UIKit.h> |
| 11 |
| 12 #import "base/ios/block_types.h" |
| 13 #import "ios/chrome/browser/ui/browser_ios.h" |
| 14 #import "ios/chrome/browser/ui/side_swipe/side_swipe_controller.h" |
| 15 #import "ios/chrome/browser/ui/toolbar/toolbar_owner.h" |
| 16 #import "ios/chrome/browser/ui/toolbar/web_toolbar_controller.h" |
| 17 #import "ios/chrome/browser/ui/url_loader.h" |
| 18 #import "ios/public/provider/chrome/browser/voice/voice_search_presenter.h" |
| 19 |
| 20 @class BrowserContainerView; |
| 21 @class BrowserViewControllerDependencyFactory; |
| 22 @class ContextualSearchController; |
| 23 @class ContextualSearchPanelView; |
| 24 @class FindBarControllerIOS; |
| 25 class GURL; |
| 26 @class NoTabsController; |
| 27 @class PageInfoViewController; |
| 28 @class PreloadController; |
| 29 @class PrintController; |
| 30 @class SideSwipeController; |
| 31 @class Tab; |
| 32 @class TabModel; |
| 33 @class TabStripController; |
| 34 @class ThumbnailHelper; |
| 35 @class VoiceSearchBarView; |
| 36 |
| 37 namespace ios { |
| 38 class ChromeBrowserState; |
| 39 } |
| 40 |
| 41 namespace ios_internal { |
| 42 // Notification sent when the page info is shown. |
| 43 extern NSString* const kPageInfoWillShowNotification; |
| 44 // Notification sent when the page info is hidden. |
| 45 extern NSString* const kPageInfoWillHideNotification; |
| 46 // Notification sent when the location bar becomes first responder. |
| 47 extern NSString* const kLocationBarBecomesFirstResponderNotification; |
| 48 // Notification sent when the location bar resigns first responder. |
| 49 extern NSString* const kLocationBarResignsFirstResponderNotification; |
| 50 } // namespace ios_internal |
| 51 |
| 52 // The top-level view controller for the browser UI. Manages other controllers |
| 53 // which implement the interface. |
| 54 @interface BrowserViewController : UIViewController<BrowserIOS, |
| 55 SideSwipeControllerDelegate, |
| 56 ToolbarOwner, |
| 57 UrlLoader, |
| 58 VoiceSearchPresenter, |
| 59 WebToolbarDelegate> |
| 60 |
| 61 // Initializes a new BVC from its nib. |model| must not be nil. The |
| 62 // webUsageSuspended property for this BVC will be based on |model|, and future |
| 63 // changes to |model|'s suspension state should be made through this BVC |
| 64 // instead of directly on the model. |
| 65 - (instancetype)initWithTabModel:(TabModel*)model |
| 66 browserState:(ios::ChromeBrowserState*)browserState |
| 67 dependencyFactory: |
| 68 (BrowserViewControllerDependencyFactory*)factory |
| 69 NS_DESIGNATED_INITIALIZER; |
| 70 |
| 71 - (instancetype)initWithNibName:(NSString*)nibNameOrNil |
| 72 bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE; |
| 73 |
| 74 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; |
| 75 |
| 76 // The top-level browser container view. |
| 77 @property(nonatomic, retain) BrowserContainerView* contentArea; |
| 78 |
| 79 // Invisible button used to dismiss the keyboard. |
| 80 @property(nonatomic, retain) UIButton* typingShield; |
| 81 |
| 82 // Valid only for tablet. YES if the tab strip will display the mode toggle |
| 83 // switch. May be set to the same value repeatedly with no layout penalty |
| 84 // (guaranteed by the tab strip). |
| 85 @property(nonatomic, assign) BOOL hasModeToggleSwitch; |
| 86 |
| 87 // Activates/deactivates the object. This will enable/disable the ability for |
| 88 // this object to browse, and to have live UIWebViews associated with it. While |
| 89 // not active, the UI will not react to changes in the tab model, so generally |
| 90 // an inactive BVC should not be visible. |
| 91 @property(nonatomic, assign, getter=isActive) BOOL active; |
| 92 |
| 93 // Returns whether or not text to speech is playing. |
| 94 @property(nonatomic, assign, readonly, getter=isPlayingTTS) BOOL playingTTS; |
| 95 |
| 96 // Whether the receiver is currently the primary BVC. |
| 97 - (void)setPrimary:(BOOL)primary; |
| 98 |
| 99 // Called when the typing shield is tapped. |
| 100 - (void)shieldWasTapped:(id)sender; |
| 101 |
| 102 // Called when a UI element to create a new tab is triggered. |
| 103 - (void)newTab:(id)sender; |
| 104 |
| 105 // Makes sure that the view hierarchy has been built. Equivalent to calling |
| 106 // -view, but without the annoying compiler warning. |
| 107 - (void)ensureViewCreated; |
| 108 |
| 109 // Called when the browser state provided to this instance is being destroyed. |
| 110 // At this point the browser will no longer ever be active, and will likely be |
| 111 // deallocated soon. |
| 112 - (void)browserStateDestroyed; |
| 113 |
| 114 // Add a new tab with the given url, appends it to the end of the model, |
| 115 // and makes it the selected tab. The selected tab is returned. |
| 116 - (Tab*)addSelectedTabWithURL:(const GURL&)url |
| 117 transition:(ui::PageTransition)transition; |
| 118 |
| 119 // Add a new tab with the given url, at the given |position|, |
| 120 // and makes it the selected tab. The selected tab is returned. |
| 121 // If |position| == NSNotFound the tab will be added at the end of the stack. |
| 122 - (Tab*)addSelectedTabWithURL:(const GURL&)url |
| 123 atIndex:(NSUInteger)position |
| 124 transition:(ui::PageTransition)transition; |
| 125 |
| 126 // This will dismiss the web views on all the tabs and reload the frontmost one |
| 127 // if there is one. This is used when a userdefault changes and the web views |
| 128 // need to be re-created to pick it up. |
| 129 - (void)resetAllWebViews; |
| 130 |
| 131 // Informs the BVC that a new foreground tab is about to be opened. This is |
| 132 // intended to be called before setWebUsageSuspended:NO in cases where a new tab |
| 133 // is about to appear in order to allow the BVC to avoid doing unnecessary work |
| 134 // related to showing the previously selected tab. |
| 135 - (void)expectNewForegroundTab; |
| 136 |
| 137 // Shows the voice search UI. |
| 138 - (void)startVoiceSearch; |
| 139 |
| 140 // Shows the QR scanner UI. |
| 141 - (void)showQRScanner; |
| 142 |
| 143 // Dismisses all presented views then calls |completion|. |
| 144 - (void)clearPresentedStateWithCompletion:(ProceduralBlock)completion; |
| 145 |
| 146 // Returns a set with the names of the files received from other applications |
| 147 // that are bookmarked or referenced by an open or recently closed tab. |
| 148 - (NSSet*)referencedExternalFiles; |
| 149 |
| 150 // Removes files received from other applications. If |immediately| is YES, |
| 151 // initiates the removal of files immediately. |completionHandler| is called |
| 152 // when files have been removed. |
| 153 - (void)removeExternalFilesImmediately:(BOOL)immediately |
| 154 completionHandler:(ProceduralBlock)completionHandler; |
| 155 |
| 156 @end |
| 157 |
| 158 #endif // IOS_CHROME_BROWSER_UI_BROWSER_VIEW_CONTROLLER_H_ |
OLD | NEW |