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 #ifndef CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_MENU_MODEL_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_MENU_MODEL_H_ |
6 #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_MENU_MODEL_H_ | 6 #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_MENU_MODEL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
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 MediaStreamInfoBarDelegate; | 14 class MediaStreamInfoBarDelegate; |
15 | 15 |
16 // A menu model that builds the contents of the devices menu in the media stream | 16 // A menu model that builds the contents of the devices menu in the media stream |
17 // infobar. This menu has only one level (no submenus). | 17 // infobar. This menu has only one level (no submenus). |
18 class MediaStreamDevicesMenuModel : public ui::SimpleMenuModel, | 18 class MediaStreamDevicesMenuModel : public ui::SimpleMenuModel, |
19 public ui::SimpleMenuModel::Delegate { | 19 public ui::SimpleMenuModel::Delegate { |
20 public: | 20 public: |
21 explicit MediaStreamDevicesMenuModel( | 21 explicit MediaStreamDevicesMenuModel( |
22 const MediaStreamInfoBarDelegate* delegate); | 22 const MediaStreamInfoBarDelegate* delegate); |
23 virtual ~MediaStreamDevicesMenuModel(); | 23 virtual ~MediaStreamDevicesMenuModel(); |
24 | 24 |
25 // Returns the |device_id| for the selected device of type |type|. Returns | 25 // Returns the |device_id| for the selected audio/video device. Returns true |
26 // true if a selected device of the requested |type| was found, and false if | 26 // if a selected device was found, or false if none was found, in which case |
27 // none was found, in which case |device_id| remains untouched. | 27 // |device_id| remains untouched. |
28 bool GetSelectedDeviceId( | 28 bool GetSelectedAudioDeviceId(std::string* device_id) const; |
29 content::MediaStreamDeviceType type, | 29 bool GetSelectedVideoDeviceId(std::string* device_id) const; |
30 std::string* device_id) const; | |
31 | 30 |
32 bool always_allow() const { return always_allow_; } | 31 bool always_allow() const { return always_allow_; } |
33 | 32 |
34 // ui::SimpleMenuModel::Delegate implementation: | 33 // ui::SimpleMenuModel::Delegate implementation: |
35 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 34 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
36 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 35 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
37 virtual bool GetAcceleratorForCommandId( | 36 virtual bool GetAcceleratorForCommandId( |
38 int command_id, | 37 int command_id, |
39 ui::Accelerator* accelerator) OVERRIDE; | 38 ui::Accelerator* accelerator) OVERRIDE; |
40 virtual void ExecuteCommand(int command_id) OVERRIDE; | 39 virtual void ExecuteCommand(int command_id) OVERRIDE; |
(...skipping 14 matching lines...) Expand all Loading... |
55 // devices entries in the menu, or -1 if there is no selected ID. | 54 // devices entries in the menu, or -1 if there is no selected ID. |
56 int selected_command_id_audio_; | 55 int selected_command_id_audio_; |
57 int selected_command_id_video_; | 56 int selected_command_id_video_; |
58 | 57 |
59 bool always_allow_; | 58 bool always_allow_; |
60 | 59 |
61 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesMenuModel); | 60 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesMenuModel); |
62 }; | 61 }; |
63 | 62 |
64 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_MENU_MODEL_H_ | 63 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_MENU_MODEL_H_ |
OLD | NEW |