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_UI_WEBUI_OPTIONS_MEDIA_DEVICES_SELECTION_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_DEVICES_SELECTION_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_DEVICES_SELECTION_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_DEVICES_SELECTION_HANDLER_H_ |
7 | 7 |
8 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | |
9 #include "chrome/browser/ui/webui/options/options_ui.h" | 8 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 9 #include "content/public/browser/media_capture_devices.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
11 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
12 | 12 |
13 namespace options { | 13 namespace options { |
14 | 14 |
15 // Handler for media devices selection in content settings. | 15 // Handler for media devices selection in content settings. |
16 class MediaDevicesSelectionHandler | 16 class MediaDevicesSelectionHandler |
17 : public MediaCaptureDevicesDispatcher::Observer, | 17 : public content::MediaCaptureDevices::Observer, |
18 public OptionsPageUIHandler { | 18 public OptionsPageUIHandler { |
19 public: | 19 public: |
20 MediaDevicesSelectionHandler(); | 20 MediaDevicesSelectionHandler(); |
21 virtual ~MediaDevicesSelectionHandler(); | 21 virtual ~MediaDevicesSelectionHandler(); |
22 | 22 |
23 // OptionsPageUIHandler implementation. | 23 // OptionsPageUIHandler implementation. |
24 virtual void GetLocalizedValues(base::DictionaryValue* values) OVERRIDE; | 24 virtual void GetLocalizedValues(base::DictionaryValue* values) OVERRIDE; |
25 virtual void InitializePage() OVERRIDE; | 25 virtual void InitializePage() OVERRIDE; |
26 virtual void RegisterMessages() OVERRIDE; | 26 virtual void RegisterMessages() OVERRIDE; |
27 | 27 |
28 // MediaCaptureDevicesDispatcher::Observer implementation. | 28 // MediaCaptureDevices::Observer implementation. |
29 virtual void OnUpdateAudioDevices( | 29 virtual void OnUpdateAudioDevices( |
30 const content::MediaStreamDevices& devices) OVERRIDE; | 30 const content::MediaStreamDevices& devices) OVERRIDE; |
31 virtual void OnUpdateVideoDevices( | 31 virtual void OnUpdateVideoDevices( |
32 const content::MediaStreamDevices& devices) OVERRIDE; | 32 const content::MediaStreamDevices& devices) OVERRIDE; |
33 | 33 |
34 private: | 34 private: |
35 enum DeviceType { | 35 enum DeviceType { |
36 AUDIO, | 36 AUDIO, |
37 VIDEO, | 37 VIDEO, |
38 }; | 38 }; |
39 | 39 |
40 // Sets the default audio/video capture device for media. |args| includes the | 40 // Sets the default audio/video capture device for media. |args| includes the |
41 // media type (kAuudio/kVideo) and the unique id of the new default device | 41 // media type (kAuudio/kVideo) and the unique id of the new default device |
42 // that the user has chosen. | 42 // that the user has chosen. |
43 void SetDefaultCaptureDevice(const base::ListValue* args); | 43 void SetDefaultCaptureDevice(const base::ListValue* args); |
44 | 44 |
45 // Helpers methods to update the device menus. | 45 // Helpers methods to update the device menus. |
46 void UpdateDevicesMenuForType(DeviceType type); | 46 void UpdateDevicesMenuForType(DeviceType type); |
47 void UpdateDevicesMenu(DeviceType type, | 47 void UpdateDevicesMenu(DeviceType type, |
48 const content::MediaStreamDevices& devices); | 48 const content::MediaStreamDevices& devices); |
49 | 49 |
50 DISALLOW_COPY_AND_ASSIGN(MediaDevicesSelectionHandler); | 50 DISALLOW_COPY_AND_ASSIGN(MediaDevicesSelectionHandler); |
51 }; | 51 }; |
52 | 52 |
53 } // namespace options | 53 } // namespace options |
54 | 54 |
55 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_DEVICES_SELECTION_HANDLER_H_ | 55 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_DEVICES_SELECTION_HANDLER_H_ |
OLD | NEW |