OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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. | |
4 | |
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_ | |
7 | |
8 #include <map> | |
9 | |
10 #include "content/public/common/media_stream_request.h" | |
11 #include "ui/base/models/simple_menu_model.h" | |
12 | |
13 class ContentSettingBubbleModel; | |
14 class Profile; | |
15 | |
16 // A menu model that builds the contents of the media capture devices menu in | |
17 // the content setting bubble. | |
18 class ContentSettingMediaMenuModel | |
19 : public ui::SimpleMenuModel, | |
20 public ui::SimpleMenuModel::Delegate { | |
21 public: | |
22 // This is the observer interface class that the client implements to | |
23 // observe the change on the menu model. | |
24 class Observer { | |
tfarina
2013/02/06 13:31:36
Don't use nested classes for Observer/Listener (wh
no longer working on chromium
2013/02/06 14:35:02
Thanks tfarina, I got hint from the thread you att
| |
25 public: | |
26 // Derived implementations must call shared_memory_.Map appropriately | |
27 // before Process can be called. | |
28 virtual void UpdateMenuLabel(content::MediaStreamType type, | |
29 const std::string& label) = 0; | |
30 }; | |
31 | |
32 ContentSettingMediaMenuModel( | |
33 Profile* profile, | |
34 content::MediaStreamType type, | |
35 ContentSettingBubbleModel* bubble_model, | |
36 Observer* observer); | |
37 | |
38 virtual ~ContentSettingMediaMenuModel(); | |
39 | |
40 // ui::SimpleMenuModel::Delegate implementation: | |
41 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | |
42 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | |
43 virtual bool GetAcceleratorForCommandId( | |
44 int command_id, | |
45 ui::Accelerator* accelerator) OVERRIDE; | |
46 virtual void ExecuteCommand(int command_id) OVERRIDE; | |
47 | |
48 private: | |
49 typedef std::map<int, content::MediaStreamDevice> CommandMap; | |
50 | |
51 // Internal method to build the menu. | |
52 void BuildMenu(); | |
53 | |
54 Profile* profile_; | |
55 content::MediaStreamType type_; | |
56 ContentSettingBubbleModel* media_bubble_model_; // Weak. | |
57 Observer* observer_; | |
markusheintz_
2013/02/06 11:03:26
This is a weak pointer too.
no longer working on chromium
2013/02/06 13:31:52
Done.
| |
58 | |
59 // Map of command IDs to devices. | |
60 CommandMap commands_; | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaMenuModel); | |
63 }; | |
64 | |
65 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_MEDIA_MENU_MODEL_H _ | |
OLD | NEW |