| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_CONTEXT_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_TOOLS_MENU_TOOLS_MENU_CONTEXT_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_TOOLS_MENU_TOOLS_MENU_CONTEXT_H_ | 6 #define IOS_CHROME_BROWSER_UI_TOOLS_MENU_TOOLS_MENU_CONTEXT_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 #import <UIKit/UIKit.h> | 9 #import <UIKit/UIKit.h> |
| 10 | 10 |
| 11 @class ReadingListMenuNotifier; | 11 @class ReadingListMenuNotifier; |
| 12 | 12 |
| 13 // Context defining options that can be set to change the tools menu's | 13 namespace web { |
| 14 // appearance. All are set to false by default. | 14 enum class UserAgentType : short; |
| 15 @interface ToolsMenuContext : NSObject | 15 } // namespace web |
| 16 // Indicate that the menu is being shown while in the tab switcher. | 16 |
| 17 // Configuation defining options that can be set to change the tools menu's |
| 18 // appearance. All boolean properties are set to NO, and |userAgentType| is set |
| 19 // to NONE by default. |
| 20 @interface ToolsMenuConfiguration : NSObject |
| 21 // Indicates that the menu is being shown while in the tab switcher. |
| 17 @property(nonatomic, getter=isInTabSwitcher) BOOL inTabSwitcher; | 22 @property(nonatomic, getter=isInTabSwitcher) BOOL inTabSwitcher; |
| 18 // Indicate that the menu is being shown while there are no open tabs. | 23 // Indicates that the menu is being shown while there are no open tabs. |
| 19 @property(nonatomic, getter=hasNoOpenedTabs) BOOL noOpenedTabs; | 24 @property(nonatomic, getter=hasNoOpenedTabs) BOOL noOpenedTabs; |
| 20 // Indicate that the menu is being shown while in incognito mode. | 25 // Indicates that the menu is being shown while in incognito mode. |
| 21 @property(nonatomic, getter=isInIncognito) BOOL inIncognito; | 26 @property(nonatomic, getter=isInIncognito) BOOL inIncognito; |
| 27 |
| 28 // Indicates that the menu is being shown while user agent is |userAgentType|. |
| 29 // If NONE, shows "Request Desktop Site" in disabled state. |
| 30 // If MOBILE, shows "Request Desktop Site" in enabled state. |
| 31 // If DESKTOP, shows "Request Mobile Site" in enabled state. |
| 32 @property(nonatomic, assign) web::UserAgentType userAgentType; |
| 33 |
| 22 // View that the menu will be displayed in. | 34 // View that the menu will be displayed in. |
| 23 @property(nonatomic, readonly) UIView* displayView; | 35 @property(nonatomic, readonly) UIView* displayView; |
| 24 // Button from which popup menu will be opened. | 36 // Button from which popup menu will be opened. |
| 25 @property(nonatomic, assign) UIButton* toolsMenuButton; | 37 @property(nonatomic, assign) UIButton* toolsMenuButton; |
| 26 // Menu's origin relative to the |displayView|'s coordinate system, calculated | 38 // Menu's origin relative to the |displayView|'s coordinate system, calculated |
| 27 // from |toolsMenuButton| and |displayView|. | 39 // from |toolsMenuButton| and |displayView|. |
| 28 @property(nonatomic, readonly) CGRect sourceRect; | 40 @property(nonatomic, readonly) CGRect sourceRect; |
| 29 // Image insets that should be applied to the tools button if it is displayed, | 41 // Image insets that should be applied to the tools button if it is displayed, |
| 30 // calculated from |toolsMenuButton|. | 42 // calculated from |toolsMenuButton|. |
| 31 @property(nonatomic, readonly) UIEdgeInsets toolsButtonInsets; | 43 @property(nonatomic, readonly) UIEdgeInsets toolsButtonInsets; |
| 32 // Notifier for changes to the reading list requiring the menu to be updated. | 44 // Notifier for changes to the reading list requiring the menu to be updated. |
| 33 // Menus needing to be updated should set themselves as this object's delegate. | 45 // Menus needing to be updated should set themselves as this object's delegate. |
| 34 @property(nonatomic, assign) ReadingListMenuNotifier* readingListMenuNotifier; | 46 @property(nonatomic, assign) ReadingListMenuNotifier* readingListMenuNotifier; |
| 35 | 47 |
| 36 // Initialize a ToolsMenuContext instance with default values. |displayView| is | 48 // Initialize a ToolsMenuContext instance with default values. |displayView| is |
| 37 // the weakly-held parent view within which the popup tools menu using this | 49 // the weakly-held parent view within which the popup tools menu using this |
| 38 // context will be displayed. | 50 // context will be displayed. |
| 39 - (instancetype)initWithDisplayView:(UIView*)displayView | 51 - (instancetype)initWithDisplayView:(UIView*)displayView |
| 40 NS_DESIGNATED_INITIALIZER; | 52 NS_DESIGNATED_INITIALIZER; |
| 41 - (instancetype)init NS_UNAVAILABLE; | 53 - (instancetype)init NS_UNAVAILABLE; |
| 42 | 54 |
| 43 @end | 55 @end |
| 44 | 56 |
| 45 #endif // IOS_CHROME_BROWSER_UI_TOOLS_MENU_TOOLS_MENU_CONTEXT_H_ | 57 #endif // IOS_CHROME_BROWSER_UI_TOOLS_MENU_TOOLS_MENU_CONTEXT_H_ |
| OLD | NEW |