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
3 // found in the LICENSE file.
7 #import <Cocoa/Cocoa.h>
9 #include "base/memory/scoped_ptr.h"
10 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
11 #include "content/public/common/media_stream_request.h"
13 class ContentSettingBubbleModel
;
14 class ContentSettingBubbleWebContentsObserverBridge
;
15 class ContentSettingMediaMenuModel
;
16 @
class InfoBubbleView
;
22 namespace content_setting_bubble
{
23 // For every "show popup" button, remember the index of the popup tab contents
24 // it should open when clicked.
25 typedef std::map
<NSButton
*, int> PopupLinks
;
27 // For every media menu button, remember the components assosiated with the
29 struct MediaMenuParts
{
30 MediaMenuParts(content::MediaStreamType type
, NSTextField
* label
);
33 content::MediaStreamType type
;
34 NSTextField
* label
; // Weak.
35 scoped_ptr
<ContentSettingMediaMenuModel
> model
;
38 DISALLOW_COPY_AND_ASSIGN(MediaMenuParts
);
40 typedef std::map
<NSPopUpButton
*, MediaMenuParts
*> MediaMenuPartsMap
;
41 } // namespace content_setting_bubble
43 // Manages a "content blocked" bubble.
44 @interface ContentSettingBubbleController
: BaseBubbleController
{
46 IBOutlet NSTextField
* titleLabel_
;
47 IBOutlet NSMatrix
* allowBlockRadioGroup_
;
49 IBOutlet NSButton
* manageButton_
;
50 IBOutlet NSButton
* doneButton_
;
51 IBOutlet NSButton
* loadButton_
;
53 // The container for the bubble contents of the geolocation bubble.
54 IBOutlet NSView
* contentsContainer_
;
56 IBOutlet NSTextField
* blockedResourcesField_
;
58 scoped_ptr
<ContentSettingBubbleModel
> contentSettingBubbleModel_
;
59 scoped_ptr
<ContentSettingBubbleWebContentsObserverBridge
> observerBridge_
;
60 content_setting_bubble::PopupLinks popupLinks_
;
61 content_setting_bubble::MediaMenuPartsMap mediaMenus_
;
64 // Creates and shows a content blocked bubble. Takes ownership of
65 // |contentSettingBubbleModel| but not of the other objects.
66 + (ContentSettingBubbleController
*)
67 showForModel
:(ContentSettingBubbleModel
*)contentSettingBubbleModel
68 webContents
:(content::WebContents
*)webContents
69 parentWindow
:(NSWindow
*)parentWindow
70 anchoredAt
:(NSPoint
)anchoredAt
;
72 // Callback for the "don't block / continue blocking" radio group.
73 - (IBAction
)allowBlockToggled
:(id
)sender
;
75 // Callback for "close" button.
76 - (IBAction
)closeBubble
:(id
)sender
;
78 // Callback for "manage" button.
79 - (IBAction
)manageBlocking
:(id
)sender
;
81 // Callback for "info" link.
82 - (IBAction
)showMoreInfo
:(id
)sender
;
84 // Callback for "load" (plugins, mixed script) button.
85 - (IBAction
)load
:(id
)sender
;
87 // Callback for "Learn More" link.
88 - (IBAction
)learnMoreLinkClicked
:(id
)sender
;
90 // Callback for "media menu" button.
91 - (IBAction
)mediaMenuChanged
:(id
)sender
;
95 @interface
ContentSettingBubbleController (TestingAPI
)
97 // Returns the weak reference to the |mediaMenus_|.
98 - (content_setting_bubble::MediaMenuPartsMap
*)mediaMenus
;