OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_MEDIA_MENU_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_MEDIA_MENU_MODEL_H_ |
6 #define CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_MEDIA_MENU_MODEL_H_ | 6 #define CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_MEDIA_MENU_MODEL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "content/public/common/media_stream_request.h" | 11 #include "content/public/common/media_stream_request.h" |
12 #include "ui/base/models/simple_menu_model.h" | 12 #include "ui/base/models/simple_menu_model.h" |
13 | 13 |
14 class ContentSettingBubbleModel; | 14 class ContentSettingBubbleModel; |
15 | 15 |
16 // A menu model that builds the contents of the media capture devices menu in | 16 // A menu model that builds the contents of the media capture devices menu in |
17 // the content setting bubble. | 17 // the content setting bubble. |
18 class ContentSettingMediaMenuModel : public ui::SimpleMenuModel, | 18 class ContentSettingMediaMenuModel : public ui::SimpleMenuModel, |
19 public ui::SimpleMenuModel::Delegate { | 19 public ui::SimpleMenuModel::Delegate { |
20 public: | 20 public: |
21 // Callback to update the label of the menu in the UI. | 21 // Callback to update the label of the menu in the UI. |
22 typedef base::Callback<void(content::MediaStreamType, const std::string&)> | 22 typedef base::Callback<void(content::MediaStreamType, const std::string&)> |
23 MenuLabelChangedCallback; | 23 MenuLabelChangedCallback; |
24 | 24 |
25 ContentSettingMediaMenuModel( | 25 ContentSettingMediaMenuModel( |
26 content::MediaStreamType type, | 26 content::MediaStreamType type, |
27 ContentSettingBubbleModel* bubble_model, | 27 ContentSettingBubbleModel* bubble_model, |
28 const MenuLabelChangedCallback& callback); | 28 const MenuLabelChangedCallback& callback); |
29 virtual ~ContentSettingMediaMenuModel(); | 29 ~ContentSettingMediaMenuModel() override; |
30 | 30 |
31 // ui::SimpleMenuModel::Delegate: | 31 // ui::SimpleMenuModel::Delegate: |
32 virtual bool IsCommandIdChecked(int command_id) const override; | 32 bool IsCommandIdChecked(int command_id) const override; |
33 virtual bool IsCommandIdEnabled(int command_id) const override; | 33 bool IsCommandIdEnabled(int command_id) const override; |
34 virtual bool GetAcceleratorForCommandId( | 34 bool GetAcceleratorForCommandId(int command_id, |
35 int command_id, | 35 ui::Accelerator* accelerator) override; |
36 ui::Accelerator* accelerator) override; | 36 void ExecuteCommand(int command_id, int event_flags) override; |
37 virtual void ExecuteCommand(int command_id, int event_flags) override; | |
38 | 37 |
39 private: | 38 private: |
40 typedef std::map<int, content::MediaStreamDevice> CommandMap; | 39 typedef std::map<int, content::MediaStreamDevice> CommandMap; |
41 | 40 |
42 content::MediaStreamType type_; | 41 content::MediaStreamType type_; |
43 ContentSettingBubbleModel* media_bubble_model_; // Weak. | 42 ContentSettingBubbleModel* media_bubble_model_; // Weak. |
44 MenuLabelChangedCallback callback_; | 43 MenuLabelChangedCallback callback_; |
45 CommandMap commands_; | 44 CommandMap commands_; |
46 | 45 |
47 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaMenuModel); | 46 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaMenuModel); |
48 }; | 47 }; |
49 | 48 |
50 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_MEDIA_MENU_MODEL_H
_ | 49 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_MEDIA_MENU_MODEL_H
_ |
OLD | NEW |