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