| 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/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 using PopupLinks = std::map<NSButton*, int>; |
| 27 | 27 |
| 28 // For every media menu button, remember the components assosiated with the | 28 // For every media menu button, remember the components associated 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 std::unique_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 } |
| 47 }; | 47 }; |
| 48 typedef std::map<NSPopUpButton*, MediaMenuParts*, compare_button> | 48 using MediaMenuPartsMap = |
| 49 MediaMenuPartsMap; | 49 std::map<NSPopUpButton*, std::unique_ptr<MediaMenuParts>, compare_button>; |
| 50 } // namespace content_setting_bubble | 50 } // namespace content_setting_bubble |
| 51 | 51 |
| 52 // Manages a "content blocked" bubble. | 52 // Manages a "content blocked" bubble. |
| 53 @interface ContentSettingBubbleController : BaseBubbleController { | 53 @interface ContentSettingBubbleController : BaseBubbleController { |
| 54 @private | 54 @private |
| 55 IBOutlet NSTextField* titleLabel_; | 55 IBOutlet NSTextField* titleLabel_; |
| 56 IBOutlet NSTextField* messageLabel_; | 56 IBOutlet NSTextField* messageLabel_; |
| 57 IBOutlet NSMatrix* allowBlockRadioGroup_; | 57 IBOutlet NSMatrix* allowBlockRadioGroup_; |
| 58 | 58 |
| 59 IBOutlet NSButton* manageButton_; | 59 IBOutlet NSButton* manageButton_; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 - (IBAction)mediaMenuChanged:(id)sender; | 102 - (IBAction)mediaMenuChanged:(id)sender; |
| 103 | 103 |
| 104 @end | 104 @end |
| 105 | 105 |
| 106 @interface ContentSettingBubbleController (TestingAPI) | 106 @interface ContentSettingBubbleController (TestingAPI) |
| 107 | 107 |
| 108 // Returns the weak reference to the |mediaMenus_|. | 108 // Returns the weak reference to the |mediaMenus_|. |
| 109 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus; | 109 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus; |
| 110 | 110 |
| 111 @end | 111 @end |
| OLD | NEW |