| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_TOOLS_MENU_TOOLS_MENU_VIEW_CONTROLLER_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_TOOLS_MENU_TOOLS_MENU_VIEW_CONTROLLER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_TOOLS_MENU_TOOLS_MENU_VIEW_CONTROLLER_H_ | 6 #define IOS_CHROME_BROWSER_UI_TOOLS_MENU_TOOLS_MENU_VIEW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 @class ToolsMenuContext; | 10 @class ToolsMenuConfiguration; |
| 11 | 11 |
| 12 // TODO(crbug.com/228521): Remove this once the new command/metric handling is | 12 // TODO(crbug.com/228521): Remove this once the new command/metric handling is |
| 13 // implemented. This is a temporary workaround to allow metrics recording to | 13 // implemented. This is a temporary workaround to allow metrics recording to |
| 14 // distinguish the action. The value used is in the dynamic range (< | 14 // distinguish the action. The value used is in the dynamic range (< |
| 15 // IDC_MinimumLabelValue) to avoid collisions. | 15 // IDC_MinimumLabelValue) to avoid collisions. |
| 16 #define IDC_TEMP_EDIT_BOOKMARK 3900 | 16 #define IDC_TEMP_EDIT_BOOKMARK 3900 |
| 17 | 17 |
| 18 // The a11y ID of the tools menu items (used by integration tests). | 18 // The a11y ID of the tools menu items (used by integration tests). |
| 19 extern NSString* const kToolsMenuNewTabId; | 19 extern NSString* const kToolsMenuNewTabId; |
| 20 extern NSString* const kToolsMenuNewIncognitoTabId; | 20 extern NSString* const kToolsMenuNewIncognitoTabId; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 47 // subsequent rows. | 47 // subsequent rows. |
| 48 // For each icon and item in the menu there is a corresponding delegate method. | 48 // For each icon and item in the menu there is a corresponding delegate method. |
| 49 @interface ToolsMenuViewController : UIViewController | 49 @interface ToolsMenuViewController : UIViewController |
| 50 // Keeps track of the state (Bookmarked or not) of the current visible page. | 50 // Keeps track of the state (Bookmarked or not) of the current visible page. |
| 51 // This is used to alter the state of the popup menu (i.e. Add/Edit bookmark). | 51 // This is used to alter the state of the popup menu (i.e. Add/Edit bookmark). |
| 52 @property(nonatomic, assign) BOOL isCurrentPageBookmarked; | 52 @property(nonatomic, assign) BOOL isCurrentPageBookmarked; |
| 53 @property(nonatomic, assign) BOOL isTabLoading; | 53 @property(nonatomic, assign) BOOL isTabLoading; |
| 54 // The tool button to be shown hovering above the popup. | 54 // The tool button to be shown hovering above the popup. |
| 55 @property(nonatomic, readonly) UIButton* toolsButton; | 55 @property(nonatomic, readonly) UIButton* toolsButton; |
| 56 | 56 |
| 57 // Keeps track of the items in tools menu. |
| 58 @property(nonatomic, copy) NSArray* menuItems; |
| 59 |
| 57 @property(nonatomic, assign) id<ToolsPopupTableDelegate> delegate; | 60 @property(nonatomic, assign) id<ToolsPopupTableDelegate> delegate; |
| 58 | 61 |
| 59 // Initializes the Tools popup menu. | 62 // Initializes the Tools popup menu. |
| 60 - (void)initializeMenu:(ToolsMenuContext*)context; | 63 - (void)initializeMenuWithConfiguration:(ToolsMenuConfiguration*)configuration; |
| 61 | 64 |
| 62 // Returns the optimal height needed to display the menu items. | 65 // Returns the optimal height needed to display the menu items. |
| 63 // The height returned is usually less than the |suggestedHeight| unless | 66 // The height returned is usually less than the |suggestedHeight| unless |
| 64 // the last row of the menu puts the height just over the |suggestedHeight|. | 67 // the last row of the menu puts the height just over the |suggestedHeight|. |
| 65 // If the Tools menu items is taller than the |suggestedHeight| by at least | 68 // If the Tools menu items is taller than the |suggestedHeight| by at least |
| 66 // one menu item, the last visible menu item will be shown partially so user | 69 // one menu item, the last visible menu item will be shown partially so user |
| 67 // can tell that the Tools menu is scrollable. | 70 // can tell that the Tools menu is scrollable. |
| 68 - (CGFloat)optimalHeight:(CGFloat)suggestedHeight; | 71 - (CGFloat)optimalHeight:(CGFloat)suggestedHeight; |
| 69 | 72 |
| 70 // Enable or disable menu item by IDC value. | 73 // Enable or disable menu item by IDC value. |
| 71 - (void)setItemEnabled:(BOOL)enabled withTag:(NSInteger)tag; | 74 - (void)setItemEnabled:(BOOL)enabled withTag:(NSInteger)tag; |
| 72 | 75 |
| 73 // Called when the current tab loading state changes. | 76 // Called when the current tab loading state changes. |
| 74 - (void)setIsTabLoading:(BOOL)isTabLoading; | 77 - (void)setIsTabLoading:(BOOL)isTabLoading; |
| 75 | 78 |
| 76 // TODO(stuartmorgan): Should the set of options that are passed in to the | 79 // TODO(stuartmorgan): Should the set of options that are passed in to the |
| 77 // constructor just have the ability to specify whether commands should be | 80 // constructor just have the ability to specify whether commands should be |
| 78 // enabled or disabled rather than having these individual setters? crbug/228506 | 81 // enabled or disabled rather than having these individual setters? crbug/228506 |
| 79 // Informs tools popup menu whether "Find In Page..." command should be | 82 // Informs tools popup menu whether "Find In Page..." command should be |
| 80 // enabled. | 83 // enabled. |
| 81 - (void)setCanShowFindBar:(BOOL)enabled; | 84 - (void)setCanShowFindBar:(BOOL)enabled; |
| 82 | 85 |
| 83 // Informs tools popup menu whether "Share..." command should be enabled. | 86 // Informs tools popup menu whether "Share..." command should be enabled. |
| 84 - (void)setCanShowShareMenu:(BOOL)enabled; | 87 - (void)setCanShowShareMenu:(BOOL)enabled; |
| 85 | 88 |
| 86 // Informs tools popup menu whether the switch to reader mode is possible. | 89 // Informs tools popup menu whether the switch to reader mode is possible. |
| 87 - (void)setCanUseReaderMode:(BOOL)enabled; | 90 - (void)setCanUseReaderMode:(BOOL)enabled; |
| 88 | 91 |
| 89 // Informs tools popup menu whether "Request Desktop Site" can be enabled. | |
| 90 - (void)setCanUseDesktopUserAgent:(BOOL)value; | |
| 91 | |
| 92 - (void)animateContentIn; | 92 - (void)animateContentIn; |
| 93 | 93 |
| 94 - (void)hideContent; | 94 - (void)hideContent; |
| 95 | 95 |
| 96 @end | 96 @end |
| 97 | 97 |
| 98 #endif // IOS_CHROME_BROWSER_UI_TOOLS_MENU_TOOLS_MENU_VIEW_CONTROLLER_H_ | 98 #endif // IOS_CHROME_BROWSER_UI_TOOLS_MENU_TOOLS_MENU_VIEW_CONTROLLER_H_ |
| OLD | NEW |