OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_COCOA_H_ |
6 #define CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_COCOA_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 bool operator()(NSPopUpButton *const a, NSPopUpButton *const b) const { | 48 bool operator()(NSPopUpButton *const a, NSPopUpButton *const b) const { |
49 return [a tag] < [b tag]; | 49 return [a tag] < [b tag]; |
50 } | 50 } |
51 }; | 51 }; |
52 using MediaMenuPartsMap = | 52 using MediaMenuPartsMap = |
53 std::map<NSPopUpButton*, std::unique_ptr<MediaMenuParts>, compare_button>; | 53 std::map<NSPopUpButton*, std::unique_ptr<MediaMenuParts>, compare_button>; |
54 } // namespace content_setting_bubble | 54 } // namespace content_setting_bubble |
55 | 55 |
56 // Manages a "content blocked" bubble. | 56 // Manages a "content blocked" bubble. |
57 @interface ContentSettingBubbleController : OmniboxDecorationBubbleController { | 57 @interface ContentSettingBubbleController : OmniboxDecorationBubbleController { |
58 @private | 58 @protected |
59 IBOutlet NSTextField* titleLabel_; | 59 IBOutlet NSTextField* titleLabel_; |
60 IBOutlet NSTextField* messageLabel_; | 60 IBOutlet NSTextField* messageLabel_; |
61 IBOutlet NSMatrix* allowBlockRadioGroup_; | 61 IBOutlet NSMatrix* allowBlockRadioGroup_; |
62 | 62 |
63 IBOutlet NSButton* manageButton_; | 63 IBOutlet NSButton* manageButton_; |
64 IBOutlet NSButton* doneButton_; | 64 IBOutlet NSButton* doneButton_; |
65 IBOutlet NSButton* loadButton_; | 65 IBOutlet NSButton* loadButton_; |
66 | 66 |
| 67 std::unique_ptr<ContentSettingBubbleModel> contentSettingBubbleModel_; |
| 68 |
| 69 @private |
67 // The container for the bubble contents of the geolocation bubble. | 70 // The container for the bubble contents of the geolocation bubble. |
68 IBOutlet NSView* contentsContainer_; | 71 IBOutlet NSView* contentsContainer_; |
69 | 72 |
70 IBOutlet NSTextField* blockedResourcesField_; | 73 IBOutlet NSTextField* blockedResourcesField_; |
71 | 74 |
72 std::unique_ptr<ContentSettingBubbleModel> contentSettingBubbleModel_; | |
73 std::unique_ptr<ContentSettingBubbleWebContentsObserverBridge> | 75 std::unique_ptr<ContentSettingBubbleWebContentsObserverBridge> |
74 observerBridge_; | 76 observerBridge_; |
75 content_setting_bubble::PopupLinks popupLinks_; | 77 content_setting_bubble::PopupLinks popupLinks_; |
76 content_setting_bubble::MediaMenuPartsMap mediaMenus_; | 78 content_setting_bubble::MediaMenuPartsMap mediaMenus_; |
77 | 79 |
78 // The omnibox icon the bubble is anchored to. | 80 // The omnibox icon the bubble is anchored to. |
79 ContentSettingDecoration* decoration_; // weak | 81 ContentSettingDecoration* decoration_; // weak |
80 } | 82 } |
81 | 83 |
| 84 // Initializes the controller using the model. Takes ownership of |
| 85 // |settingsBubbleModel| but not of the other objects. This is intended to be |
| 86 // invoked by subclasses and most callers should invoke the showForModel |
| 87 // convenience constructor. |
| 88 - (id)initWithModel:(ContentSettingBubbleModel*)settingsBubbleModel |
| 89 webContents:(content::WebContents*)webContents |
| 90 window:(NSWindow*)window |
| 91 parentWindow:(NSWindow*)parentWindow |
| 92 decoration:(ContentSettingDecoration*)decoration |
| 93 anchoredAt:(NSPoint)anchoredAt; |
| 94 |
82 // Creates and shows a content blocked bubble. Takes ownership of | 95 // Creates and shows a content blocked bubble. Takes ownership of |
83 // |contentSettingBubbleModel| but not of the other objects. | 96 // |contentSettingBubbleModel| but not of the other objects. |
84 + (ContentSettingBubbleController*) | 97 + (ContentSettingBubbleController*) |
85 showForModel:(ContentSettingBubbleModel*)contentSettingBubbleModel | 98 showForModel:(ContentSettingBubbleModel*)contentSettingBubbleModel |
86 webContents:(content::WebContents*)webContents | 99 webContents:(content::WebContents*)webContents |
87 parentWindow:(NSWindow*)parentWindow | 100 parentWindow:(NSWindow*)parentWindow |
88 decoration:(ContentSettingDecoration*)decoration | 101 decoration:(ContentSettingDecoration*)decoration |
89 anchoredAt:(NSPoint)anchoredAt; | 102 anchoredAt:(NSPoint)anchoredAt; |
90 | 103 |
| 104 // Initializes the layout of all the UI elements. |
| 105 - (void)layoutView; |
| 106 |
91 // Callback for the "don't block / continue blocking" radio group. | 107 // Callback for the "don't block / continue blocking" radio group. |
92 - (IBAction)allowBlockToggled:(id)sender; | 108 - (IBAction)allowBlockToggled:(id)sender; |
93 | 109 |
94 // Callback for "close" button. | 110 // Callback for "close" button. |
95 - (IBAction)closeBubble:(id)sender; | 111 - (IBAction)closeBubble:(id)sender; |
96 | 112 |
97 // Callback for "manage" button. | 113 // Callback for "manage" button. |
98 - (IBAction)manageBlocking:(id)sender; | 114 - (IBAction)manageBlocking:(id)sender; |
99 | 115 |
100 // Callback for "info" link. | 116 // Callback for "info" link. |
(...skipping 11 matching lines...) Expand all Loading... |
112 @end | 128 @end |
113 | 129 |
114 @interface ContentSettingBubbleController (TestingAPI) | 130 @interface ContentSettingBubbleController (TestingAPI) |
115 | 131 |
116 // Returns the weak reference to the |mediaMenus_|. | 132 // Returns the weak reference to the |mediaMenus_|. |
117 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus; | 133 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus; |
118 | 134 |
119 @end | 135 @end |
120 | 136 |
121 #endif // CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_COCOA
_H_ | 137 #endif // CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_COCOA
_H_ |
OLD | NEW |