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 ContentSettingMediaMenuModel
;
15 @
class InfoBubbleView
;
17 namespace content_setting_bubble
{
18 // For every "show popup" button, remember the index of the popup tab contents
19 // it should open when clicked.
20 typedef std::map
<NSButton
*, int> PopupLinks
;
22 // For every media menu button, remember the components assosiated with the
24 struct MediaMenuParts
{
25 MediaMenuParts(content::MediaStreamType type
, NSTextField
* label
);
28 content::MediaStreamType type
;
29 NSTextField
* label
; // Weak.
30 scoped_ptr
<ContentSettingMediaMenuModel
> model
;
33 DISALLOW_COPY_AND_ASSIGN(MediaMenuParts
);
35 typedef std::map
<NSPopUpButton
*, MediaMenuParts
*> MediaMenuPartsMap
;
36 } // namespace content_setting_bubble
38 // Manages a "content blocked" bubble.
39 @interface ContentSettingBubbleController
: BaseBubbleController
{
41 IBOutlet NSTextField
* titleLabel_
;
42 IBOutlet NSMatrix
* allowBlockRadioGroup_
;
44 IBOutlet NSButton
* manageButton_
;
45 IBOutlet NSButton
* doneButton_
;
46 IBOutlet NSButton
* loadButton_
;
48 // The container for the bubble contents of the geolocation bubble.
49 IBOutlet NSView
* contentsContainer_
;
51 IBOutlet NSTextField
* blockedResourcesField_
;
53 scoped_ptr
<ContentSettingBubbleModel
> contentSettingBubbleModel_
;
54 content_setting_bubble::PopupLinks popupLinks_
;
55 content_setting_bubble::MediaMenuPartsMap mediaMenus_
;
58 // Creates and shows a content blocked bubble. Takes ownership of
59 // |contentSettingBubbleModel| but not of the other objects.
60 + (ContentSettingBubbleController
*)
61 showForModel
:(ContentSettingBubbleModel
*)contentSettingBubbleModel
62 parentWindow
:(NSWindow
*)parentWindow
63 anchoredAt
:(NSPoint
)anchoredAt
;
65 // Callback for the "don't block / continue blocking" radio group.
66 - (IBAction
)allowBlockToggled
:(id
)sender
;
68 // Callback for "close" button.
69 - (IBAction
)closeBubble
:(id
)sender
;
71 // Callback for "manage" button.
72 - (IBAction
)manageBlocking
:(id
)sender
;
74 // Callback for "info" link.
75 - (IBAction
)showMoreInfo
:(id
)sender
;
77 // Callback for "load" (plug-ins, mixed script) button.
78 - (IBAction
)load
:(id
)sender
;
80 // Callback for "Learn More" link.
81 - (IBAction
)learnMoreLinkClicked
:(id
)sender
;
83 // Callback for "media menu" button.
84 - (IBAction
)mediaMenuChanged
:(id
)sender
;
88 @interface
ContentSettingBubbleController (TestingAPI
)
90 // Returns the weak reference to the |mediaMenus_|.
91 - (content_setting_bubble::MediaMenuPartsMap
*)mediaMenus
;