BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / content_settings / content_setting_bubble_cocoa.h
blob701787e059a26beb3395c776e5ec7dbc939859e4
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.
5 #include <map>
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;
18 namespace content {
19 class WebContents;
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
28 // menu button.
29 struct MediaMenuParts {
30 MediaMenuParts(content::MediaStreamType type, NSTextField* label);
31 ~MediaMenuParts();
33 content::MediaStreamType type;
34 NSTextField* label; // Weak.
35 scoped_ptr<ContentSettingMediaMenuModel> model;
37 private:
38 DISALLOW_COPY_AND_ASSIGN(MediaMenuParts);
41 // Comparator used by MediaMenuPartsMap to order its keys.
42 struct compare_button {
43 bool operator()(NSPopUpButton *const a, NSPopUpButton *const b) const {
44 return [a tag] < [b tag];
47 typedef std::map<NSPopUpButton*, MediaMenuParts*, compare_button>
48 MediaMenuPartsMap;
49 } // namespace content_setting_bubble
51 // Manages a "content blocked" bubble.
52 @interface ContentSettingBubbleController : BaseBubbleController {
53 @private
54 IBOutlet NSTextField* titleLabel_;
55 IBOutlet NSMatrix* allowBlockRadioGroup_;
57 IBOutlet NSButton* manageButton_;
58 IBOutlet NSButton* doneButton_;
59 IBOutlet NSButton* loadButton_;
61 // The container for the bubble contents of the geolocation bubble.
62 IBOutlet NSView* contentsContainer_;
64 IBOutlet NSTextField* blockedResourcesField_;
66 scoped_ptr<ContentSettingBubbleModel> contentSettingBubbleModel_;
67 scoped_ptr<ContentSettingBubbleWebContentsObserverBridge> observerBridge_;
68 content_setting_bubble::PopupLinks popupLinks_;
69 content_setting_bubble::MediaMenuPartsMap mediaMenus_;
72 // Creates and shows a content blocked bubble. Takes ownership of
73 // |contentSettingBubbleModel| but not of the other objects.
74 + (ContentSettingBubbleController*)
75 showForModel:(ContentSettingBubbleModel*)contentSettingBubbleModel
76 webContents:(content::WebContents*)webContents
77 parentWindow:(NSWindow*)parentWindow
78 anchoredAt:(NSPoint)anchoredAt;
80 // Callback for the "don't block / continue blocking" radio group.
81 - (IBAction)allowBlockToggled:(id)sender;
83 // Callback for "close" button.
84 - (IBAction)closeBubble:(id)sender;
86 // Callback for "manage" button.
87 - (IBAction)manageBlocking:(id)sender;
89 // Callback for "info" link.
90 - (IBAction)showMoreInfo:(id)sender;
92 // Callback for "load" (plugins, mixed script) button.
93 - (IBAction)load:(id)sender;
95 // Callback for "Learn More" link.
96 - (IBAction)learnMoreLinkClicked:(id)sender;
98 // Callback for "media menu" button.
99 - (IBAction)mediaMenuChanged:(id)sender;
101 @end
103 @interface ContentSettingBubbleController (TestingAPI)
105 // Returns the weak reference to the |mediaMenus_|.
106 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus;
108 @end