Chromium Code Reviews| 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* manageCheckbox_; | |
|
Robert Sesek
2017/05/02 21:51:47
Since this is only used in the subclass, I'd recom
shivanisha
2017/05/03 18:10:35
done
| |
| 64 IBOutlet NSButton* doneButton_; | 65 IBOutlet NSButton* doneButton_; |
| 65 IBOutlet NSButton* loadButton_; | 66 IBOutlet NSButton* loadButton_; |
| 66 | 67 |
| 68 std::unique_ptr<ContentSettingBubbleModel> contentSettingBubbleModel_; | |
|
Robert Sesek
2017/05/02 21:51:47
nit: blank line after
shivanisha
2017/05/03 18:10:35
done
| |
| 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. | |
|
Robert Sesek
2017/05/02 21:51:47
Ditto the comments about ownership of the model fr
shivanisha
2017/05/03 18:10:35
done
| |
| 85 - (id)initWithModel:(ContentSettingBubbleModel*)settingsBubbleModel | |
| 86 webContents:(content::WebContents*)webContents | |
| 87 window:(NSWindow*)window | |
| 88 parentWindow:(NSWindow*)parentWindow | |
| 89 decoration:(ContentSettingDecoration*)decoration | |
| 90 anchoredAt:(NSPoint)anchoredAt; | |
| 91 | |
| 82 // Creates and shows a content blocked bubble. Takes ownership of | 92 // Creates and shows a content blocked bubble. Takes ownership of |
| 83 // |contentSettingBubbleModel| but not of the other objects. | 93 // |contentSettingBubbleModel| but not of the other objects. |
| 84 + (ContentSettingBubbleController*) | 94 + (ContentSettingBubbleController*) |
| 85 showForModel:(ContentSettingBubbleModel*)contentSettingBubbleModel | 95 showForModel:(ContentSettingBubbleModel*)contentSettingBubbleModel |
| 86 webContents:(content::WebContents*)webContents | 96 webContents:(content::WebContents*)webContents |
| 87 parentWindow:(NSWindow*)parentWindow | 97 parentWindow:(NSWindow*)parentWindow |
| 88 decoration:(ContentSettingDecoration*)decoration | 98 decoration:(ContentSettingDecoration*)decoration |
| 89 anchoredAt:(NSPoint)anchoredAt; | 99 anchoredAt:(NSPoint)anchoredAt; |
| 90 | 100 |
| 101 - (void)initManageDoneButtons; | |
|
Robert Sesek
2017/05/02 21:51:47
It's a little odd exposing just this method (it ne
shivanisha
2017/05/03 18:10:35
Added a function called layoutView which is also o
| |
| 102 | |
| 91 // Callback for the "don't block / continue blocking" radio group. | 103 // Callback for the "don't block / continue blocking" radio group. |
| 92 - (IBAction)allowBlockToggled:(id)sender; | 104 - (IBAction)allowBlockToggled:(id)sender; |
| 93 | 105 |
| 94 // Callback for "close" button. | 106 // Callback for "close" button. |
| 95 - (IBAction)closeBubble:(id)sender; | 107 - (IBAction)closeBubble:(id)sender; |
| 96 | 108 |
| 97 // Callback for "manage" button. | 109 // Callback for "manage" button. |
| 98 - (IBAction)manageBlocking:(id)sender; | 110 - (IBAction)manageBlocking:(id)sender; |
| 99 | 111 |
| 100 // Callback for "info" link. | 112 // Callback for "info" link. |
| 101 - (IBAction)showMoreInfo:(id)sender; | 113 - (IBAction)showMoreInfo:(id)sender; |
| 102 | 114 |
| 103 // Callback for "load" (plugins, mixed script) button. | 115 // Callback for "load" (plugins, mixed script) button. |
| 104 - (IBAction)load:(id)sender; | 116 - (IBAction)load:(id)sender; |
| 105 | 117 |
| 106 // Callback for "Learn More" link. | 118 // Callback for "Learn More" link. |
| 107 - (IBAction)learnMoreLinkClicked:(id)sender; | 119 - (IBAction)learnMoreLinkClicked:(id)sender; |
| 108 | 120 |
| 109 // Callback for "media menu" button. | 121 // Callback for "media menu" button. |
| 110 - (IBAction)mediaMenuChanged:(id)sender; | 122 - (IBAction)mediaMenuChanged:(id)sender; |
| 111 | 123 |
| 124 // Callback for "manage" checkbox button. | |
| 125 - (IBAction)manageCheckboxChecked:(id)sender; | |
| 126 | |
| 112 @end | 127 @end |
| 113 | 128 |
| 114 @interface ContentSettingBubbleController (TestingAPI) | 129 @interface ContentSettingBubbleController (TestingAPI) |
| 115 | 130 |
| 116 // Returns the weak reference to the |mediaMenus_|. | 131 // Returns the weak reference to the |mediaMenus_|. |
| 117 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus; | 132 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus; |
| 118 | 133 |
| 119 @end | 134 @end |
| 120 | 135 |
| 121 #endif // CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_COCOA _H_ | 136 #endif // CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_COCOA _H_ |
| OLD | NEW |