1 // Copyright 2018 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_POPUP_MENU_POPUP_MENU_MEDIATOR_H_ 6 #define IOS_CHROME_BROWSER_UI_POPUP_MENU_POPUP_MENU_MEDIATOR_H_ 7 8 #import <UIKit/UIKit.h> 9 10 #import "ios/chrome/browser/ui/browser_container/browser_container_consumer.h" 11 #import "ios/chrome/browser/ui/popup_menu/popup_menu_action_handler_commands.h" 12 #import "ios/chrome/browser/ui/popup_menu/public/popup_menu_ui_updating.h" 13 14 namespace bookmarks { 15 class BookmarkModel; 16 } 17 namespace feature_engagement { 18 class Tracker; 19 } 20 @protocol BrowserCommands; 21 class OverlayPresenter; 22 @protocol PopupMenuConsumer; 23 class PrefService; 24 class ReadingListModel; 25 class TemplateURLService; 26 class WebStateList; 27 class BrowserPolicyConnectorIOS; 28 29 // Mediator for the popup menu. This object is in charge of creating and 30 // updating the items of the popup menu. 31 @interface PopupMenuMediator 32 : NSObject <BrowserContainerConsumer, PopupMenuActionHandlerCommands> 33 34 // Initializes the mediator with a |type| of popup menu, whether it 35 // |isIncognito|, a |readingListModel| used to display the badge for the reading 36 // list entry, whether the mediator should |triggerNewIncognitoTabTip|, and a 37 // |browserPolicyConnector| used to check if the browser is managed by policy. 38 - (instancetype)initWithType:(PopupMenuType)type 39 isIncognito:(BOOL)isIncognito 40 readingListModel:(ReadingListModel*)readingListModel 41 triggerNewIncognitoTabTip:(BOOL)triggerNewIncognitoTabTip 42 browserPolicyConnector:(BrowserPolicyConnectorIOS*)browserPolicyConnector 43 NS_DESIGNATED_INITIALIZER; 44 - (instancetype)init NS_UNAVAILABLE; 45 46 // The WebStateList that this mediator listens for any changes on the current 47 // WebState. 48 @property(nonatomic, assign) WebStateList* webStateList; 49 // The overlay presenter for OverlayModality::kWebContentArea. This mediator 50 // listens for overlay presentation events to determine whether the "Read Later" 51 // button should be enabled. 52 @property(nonatomic, assign) OverlayPresenter* webContentAreaOverlayPresenter; 53 // The consumer to be configured with this mediator. 54 @property(nonatomic, strong) id<PopupMenuConsumer> popupMenu; 55 // Dispatcher. 56 @property(nonatomic, weak) id<BrowserCommands> dispatcher; 57 // Records events for the use of in-product help. The mediator does not take 58 // ownership of tracker. Tracker must not be destroyed during lifetime of the 59 // object. 60 @property(nonatomic, assign) feature_engagement::Tracker* engagementTracker; 61 // The bookmarks model to know if the page is bookmarked. 62 @property(nonatomic, assign) bookmarks::BookmarkModel* bookmarkModel; 63 // Pref service to retrieve preference values. 64 @property(nonatomic, assign) PrefService* prefService; 65 // The template url service to use for checking whether search by image is 66 // available. 67 @property(nonatomic, assign) TemplateURLService* templateURLService; 68 69 // Disconnect the mediator. 70 - (void)disconnect; 71 72 @end 73 74 #endif // IOS_CHROME_BROWSER_UI_POPUP_MENU_POPUP_MENU_MEDIATOR_H_ 75