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 #include <map> | |
6 | |
7 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
8 | 6 |
| 7 #include <map> |
| 8 #include <memory> |
| 9 |
9 #include "base/macros.h" | 10 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" | 11 #import "chrome/browser/ui/cocoa/base_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 ContentSettingMediaMenuModel; | 16 class ContentSettingMediaMenuModel; |
17 @class InfoBubbleView; | 17 @class InfoBubbleView; |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 class WebContents; | 20 class WebContents; |
21 } | 21 } |
22 | 22 |
23 namespace content_setting_bubble { | 23 namespace content_setting_bubble { |
24 // For every "show popup" button, remember the index of the popup tab contents | 24 // For every "show popup" button, remember the index of the popup tab contents |
25 // it should open when clicked. | 25 // it should open when clicked. |
26 typedef std::map<NSButton*, int> PopupLinks; | 26 typedef std::map<NSButton*, int> PopupLinks; |
27 | 27 |
28 // For every media menu button, remember the components assosiated with the | 28 // For every media menu button, remember the components assosiated with the |
29 // menu button. | 29 // menu button. |
30 struct MediaMenuParts { | 30 struct MediaMenuParts { |
31 MediaMenuParts(content::MediaStreamType type, NSTextField* label); | 31 MediaMenuParts(content::MediaStreamType type, NSTextField* label); |
32 ~MediaMenuParts(); | 32 ~MediaMenuParts(); |
33 | 33 |
34 content::MediaStreamType type; | 34 content::MediaStreamType type; |
35 NSTextField* label; // Weak. | 35 NSTextField* label; // Weak. |
36 scoped_ptr<ContentSettingMediaMenuModel> model; | 36 std::unique_ptr<ContentSettingMediaMenuModel> model; |
37 | 37 |
38 private: | 38 private: |
39 DISALLOW_COPY_AND_ASSIGN(MediaMenuParts); | 39 DISALLOW_COPY_AND_ASSIGN(MediaMenuParts); |
40 }; | 40 }; |
41 | 41 |
42 // Comparator used by MediaMenuPartsMap to order its keys. | 42 // Comparator used by MediaMenuPartsMap to order its keys. |
43 struct compare_button { | 43 struct compare_button { |
44 bool operator()(NSPopUpButton *const a, NSPopUpButton *const b) const { | 44 bool operator()(NSPopUpButton *const a, NSPopUpButton *const b) const { |
45 return [a tag] < [b tag]; | 45 return [a tag] < [b tag]; |
46 } | 46 } |
(...skipping 10 matching lines...) Expand all Loading... |
57 | 57 |
58 IBOutlet NSButton* manageButton_; | 58 IBOutlet NSButton* manageButton_; |
59 IBOutlet NSButton* doneButton_; | 59 IBOutlet NSButton* doneButton_; |
60 IBOutlet NSButton* loadButton_; | 60 IBOutlet NSButton* loadButton_; |
61 | 61 |
62 // The container for the bubble contents of the geolocation bubble. | 62 // The container for the bubble contents of the geolocation bubble. |
63 IBOutlet NSView* contentsContainer_; | 63 IBOutlet NSView* contentsContainer_; |
64 | 64 |
65 IBOutlet NSTextField* blockedResourcesField_; | 65 IBOutlet NSTextField* blockedResourcesField_; |
66 | 66 |
67 scoped_ptr<ContentSettingBubbleModel> contentSettingBubbleModel_; | 67 std::unique_ptr<ContentSettingBubbleModel> contentSettingBubbleModel_; |
68 scoped_ptr<ContentSettingBubbleWebContentsObserverBridge> observerBridge_; | 68 std::unique_ptr<ContentSettingBubbleWebContentsObserverBridge> |
| 69 observerBridge_; |
69 content_setting_bubble::PopupLinks popupLinks_; | 70 content_setting_bubble::PopupLinks popupLinks_; |
70 content_setting_bubble::MediaMenuPartsMap mediaMenus_; | 71 content_setting_bubble::MediaMenuPartsMap mediaMenus_; |
71 } | 72 } |
72 | 73 |
73 // Creates and shows a content blocked bubble. Takes ownership of | 74 // Creates and shows a content blocked bubble. Takes ownership of |
74 // |contentSettingBubbleModel| but not of the other objects. | 75 // |contentSettingBubbleModel| but not of the other objects. |
75 + (ContentSettingBubbleController*) | 76 + (ContentSettingBubbleController*) |
76 showForModel:(ContentSettingBubbleModel*)contentSettingBubbleModel | 77 showForModel:(ContentSettingBubbleModel*)contentSettingBubbleModel |
77 webContents:(content::WebContents*)webContents | 78 webContents:(content::WebContents*)webContents |
78 parentWindow:(NSWindow*)parentWindow | 79 parentWindow:(NSWindow*)parentWindow |
(...skipping 21 matching lines...) Expand all Loading... |
100 - (IBAction)mediaMenuChanged:(id)sender; | 101 - (IBAction)mediaMenuChanged:(id)sender; |
101 | 102 |
102 @end | 103 @end |
103 | 104 |
104 @interface ContentSettingBubbleController (TestingAPI) | 105 @interface ContentSettingBubbleController (TestingAPI) |
105 | 106 |
106 // Returns the weak reference to the |mediaMenus_|. | 107 // Returns the weak reference to the |mediaMenus_|. |
107 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus; | 108 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus; |
108 | 109 |
109 @end | 110 @end |
OLD | NEW |