| 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" | 11 #import "chrome/browser/ui/cocoa/omnibox_decoration_bubble_controller.h" |
| 12 #include "content/public/common/media_stream_request.h" | 12 #include "content/public/common/media_stream_request.h" |
| 13 | 13 |
| 14 class ContentSettingBubbleModel; | 14 class ContentSettingBubbleModel; |
| 15 class ContentSettingBubbleWebContentsObserverBridge; | 15 class ContentSettingBubbleWebContentsObserverBridge; |
| 16 class ContentSettingDecoration; |
| 16 class ContentSettingMediaMenuModel; | 17 class ContentSettingMediaMenuModel; |
| 17 @class InfoBubbleView; | 18 @class InfoBubbleView; |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 class WebContents; | 21 class WebContents; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace content_setting_bubble { | 24 namespace content_setting_bubble { |
| 24 // For every "show popup" button, remember the index of the popup tab contents | 25 // For every "show popup" button, remember the index of the popup tab contents |
| 25 // it should open when clicked. | 26 // it should open when clicked. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 43 struct compare_button { | 44 struct compare_button { |
| 44 bool operator()(NSPopUpButton *const a, NSPopUpButton *const b) const { | 45 bool operator()(NSPopUpButton *const a, NSPopUpButton *const b) const { |
| 45 return [a tag] < [b tag]; | 46 return [a tag] < [b tag]; |
| 46 } | 47 } |
| 47 }; | 48 }; |
| 48 using MediaMenuPartsMap = | 49 using MediaMenuPartsMap = |
| 49 std::map<NSPopUpButton*, std::unique_ptr<MediaMenuParts>, compare_button>; | 50 std::map<NSPopUpButton*, std::unique_ptr<MediaMenuParts>, compare_button>; |
| 50 } // namespace content_setting_bubble | 51 } // namespace content_setting_bubble |
| 51 | 52 |
| 52 // Manages a "content blocked" bubble. | 53 // Manages a "content blocked" bubble. |
| 53 @interface ContentSettingBubbleController : BaseBubbleController { | 54 @interface ContentSettingBubbleController : OmniboxDecorationBubbleController { |
| 54 @private | 55 @private |
| 55 IBOutlet NSTextField* titleLabel_; | 56 IBOutlet NSTextField* titleLabel_; |
| 56 IBOutlet NSTextField* messageLabel_; | 57 IBOutlet NSTextField* messageLabel_; |
| 57 IBOutlet NSMatrix* allowBlockRadioGroup_; | 58 IBOutlet NSMatrix* allowBlockRadioGroup_; |
| 58 | 59 |
| 59 IBOutlet NSButton* manageButton_; | 60 IBOutlet NSButton* manageButton_; |
| 60 IBOutlet NSButton* doneButton_; | 61 IBOutlet NSButton* doneButton_; |
| 61 IBOutlet NSButton* loadButton_; | 62 IBOutlet NSButton* loadButton_; |
| 62 | 63 |
| 63 // The container for the bubble contents of the geolocation bubble. | 64 // The container for the bubble contents of the geolocation bubble. |
| 64 IBOutlet NSView* contentsContainer_; | 65 IBOutlet NSView* contentsContainer_; |
| 65 | 66 |
| 66 IBOutlet NSTextField* blockedResourcesField_; | 67 IBOutlet NSTextField* blockedResourcesField_; |
| 67 | 68 |
| 68 std::unique_ptr<ContentSettingBubbleModel> contentSettingBubbleModel_; | 69 std::unique_ptr<ContentSettingBubbleModel> contentSettingBubbleModel_; |
| 69 std::unique_ptr<ContentSettingBubbleWebContentsObserverBridge> | 70 std::unique_ptr<ContentSettingBubbleWebContentsObserverBridge> |
| 70 observerBridge_; | 71 observerBridge_; |
| 71 content_setting_bubble::PopupLinks popupLinks_; | 72 content_setting_bubble::PopupLinks popupLinks_; |
| 72 content_setting_bubble::MediaMenuPartsMap mediaMenus_; | 73 content_setting_bubble::MediaMenuPartsMap mediaMenus_; |
| 74 |
| 75 // The omnibox icon the bubble is anchored to. |
| 76 ContentSettingDecoration* decoration_; // weak |
| 73 } | 77 } |
| 74 | 78 |
| 75 // Creates and shows a content blocked bubble. Takes ownership of | 79 // Creates and shows a content blocked bubble. Takes ownership of |
| 76 // |contentSettingBubbleModel| but not of the other objects. | 80 // |contentSettingBubbleModel| but not of the other objects. |
| 77 + (ContentSettingBubbleController*) | 81 + (ContentSettingBubbleController*) |
| 78 showForModel:(ContentSettingBubbleModel*)contentSettingBubbleModel | 82 showForModel:(ContentSettingBubbleModel*)contentSettingBubbleModel |
| 79 webContents:(content::WebContents*)webContents | 83 webContents:(content::WebContents*)webContents |
| 80 parentWindow:(NSWindow*)parentWindow | 84 parentWindow:(NSWindow*)parentWindow |
| 81 anchoredAt:(NSPoint)anchoredAt; | 85 decoration:(ContentSettingDecoration*)decoration |
| 86 anchoredAt:(NSPoint)anchoredAt; |
| 82 | 87 |
| 83 // Callback for the "don't block / continue blocking" radio group. | 88 // Callback for the "don't block / continue blocking" radio group. |
| 84 - (IBAction)allowBlockToggled:(id)sender; | 89 - (IBAction)allowBlockToggled:(id)sender; |
| 85 | 90 |
| 86 // Callback for "close" button. | 91 // Callback for "close" button. |
| 87 - (IBAction)closeBubble:(id)sender; | 92 - (IBAction)closeBubble:(id)sender; |
| 88 | 93 |
| 89 // Callback for "manage" button. | 94 // Callback for "manage" button. |
| 90 - (IBAction)manageBlocking:(id)sender; | 95 - (IBAction)manageBlocking:(id)sender; |
| 91 | 96 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 102 - (IBAction)mediaMenuChanged:(id)sender; | 107 - (IBAction)mediaMenuChanged:(id)sender; |
| 103 | 108 |
| 104 @end | 109 @end |
| 105 | 110 |
| 106 @interface ContentSettingBubbleController (TestingAPI) | 111 @interface ContentSettingBubbleController (TestingAPI) |
| 107 | 112 |
| 108 // Returns the weak reference to the |mediaMenus_|. | 113 // Returns the weak reference to the |mediaMenus_|. |
| 109 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus; | 114 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus; |
| 110 | 115 |
| 111 @end | 116 @end |
| OLD | NEW |