Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
|
michaelpg
2016/06/07 16:03:30
remove (c)
Finnur
2016/06/07 16:48:24
Done.
michaelpg
2016/06/07 17:00:55
ping
Finnur
2016/06/08 12:40:40
I think this is Rietveld being weird. The file on
| |
| 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_SETTINGS_SETTINGS_MEDIA_DEVICES_SELECTION_HANDLE R_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_DEVICES_SELECTION_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_MEDIA_DEVICES_SELECTION_HANDLE R_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 9 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 10 #include "chrome/browser/ui/webui/options/options_ui.h" | 10 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 | 12 |
| 13 namespace options { | 13 namespace settings { |
| 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 |
|
michaelpg
2016/06/07 16:03:30
since this is in settings/ and isn't called Settin
Finnur
2016/06/07 16:48:24
I didn't want a settings_ prefix, per se, but GN b
michaelpg
2016/06/07 17:00:55
Ah. You're welcome to do whatever, then. Personall
Finnur
2016/06/08 12:40:40
Yeah, I was thinking along the same lines, but wit
| |
| 17 : public MediaCaptureDevicesDispatcher::Observer, | 17 : public MediaCaptureDevicesDispatcher::Observer, |
| 18 public OptionsPageUIHandler { | 18 public SettingsPageUIHandler { |
| 19 public: | 19 public: |
| 20 MediaDevicesSelectionHandler(); | 20 explicit MediaDevicesSelectionHandler(content::WebUI* webui); |
| 21 ~MediaDevicesSelectionHandler() override; | 21 ~MediaDevicesSelectionHandler() override; |
| 22 | 22 |
| 23 // OptionsPageUIHandler implementation. | 23 // SettingsPageUIHandler: |
| 24 void GetLocalizedValues(base::DictionaryValue* values) override; | 24 void OnJavascriptAllowed() override; |
| 25 void InitializePage() override; | 25 void OnJavascriptDisallowed() override; |
| 26 void RegisterMessages() override; | 26 void RegisterMessages() override; |
| 27 | 27 |
| 28 // MediaCaptureDevicesDispatcher::Observer implementation. | 28 // MediaCaptureDevicesDispatcher::Observer: |
| 29 void OnUpdateAudioDevices( | 29 void OnUpdateAudioDevices( |
| 30 const content::MediaStreamDevices& devices) override; | 30 const content::MediaStreamDevices& devices) override; |
| 31 void OnUpdateVideoDevices( | 31 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 // Fetches the list of default capture devices. | |
| 41 void GetDefaultCaptureDevices(const base::ListValue* args); | |
| 42 | |
| 40 // Sets the default audio/video capture device for media. |args| includes the | 43 // 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 | 44 // media type (kAuudio/kVideo) and the unique id of the new default device |
| 42 // that the user has chosen. | 45 // that the user has chosen. |
| 43 void SetDefaultCaptureDevice(const base::ListValue* args); | 46 void SetDefaultCaptureDevice(const base::ListValue* args); |
| 44 | 47 |
| 45 // Helpers methods to update the device menus. | 48 // Helpers methods to update the device menus. |
| 46 void UpdateDevicesMenuForType(DeviceType type); | 49 void UpdateDevicesMenuForType(DeviceType type); |
| 47 void UpdateDevicesMenu(DeviceType type, | 50 void UpdateDevicesMenu(DeviceType type, |
| 48 const content::MediaStreamDevices& devices); | 51 const content::MediaStreamDevices& devices); |
| 49 | 52 |
| 53 Profile* profile_; // Weak pointer. | |
| 54 | |
| 55 // This class is initialized lazily (on first request). This keeps track of | |
| 56 // whether that has happened. | |
| 57 bool initialized_; | |
| 58 | |
| 50 DISALLOW_COPY_AND_ASSIGN(MediaDevicesSelectionHandler); | 59 DISALLOW_COPY_AND_ASSIGN(MediaDevicesSelectionHandler); |
| 51 }; | 60 }; |
| 52 | 61 |
| 53 } // namespace options | 62 } // namespace settings |
| 54 | 63 |
| 55 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_DEVICES_SELECTION_HANDLER_H_ | 64 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_MEDIA_DEVICES_SELECTION_HAN DLER_H_ |
| OLD | NEW |