Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: chrome/browser/media/media_stream_devices_menu_model.h

Issue 10537099: add "always allow" option to the mediastream infobar and allow user to allow/not allow acces to devi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed sky's comment and replaced "Do not allow any site to" with "Do not allow sites to" Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 12 matching lines...) Expand all
23 const MediaStreamInfoBarDelegate* delegate); 23 const MediaStreamInfoBarDelegate* delegate);
24 virtual ~MediaStreamDevicesMenuModel(); 24 virtual ~MediaStreamDevicesMenuModel();
25 25
26 // Returns the |device_id| for the selected device of type |type|. Returns 26 // Returns the |device_id| for the selected device of type |type|. Returns
27 // true if a selected device of the requested |type| was found, and false if 27 // true if a selected device of the requested |type| was found, and false if
28 // none was found, in which case |device_id| remains untouched. 28 // none was found, in which case |device_id| remains untouched.
29 bool GetSelectedDeviceId( 29 bool GetSelectedDeviceId(
30 content::MediaStreamDeviceType type, 30 content::MediaStreamDeviceType type,
31 std::string* device_id) const; 31 std::string* device_id) const;
32 32
33 bool always_allow() const { return always_allow_; }
34
33 // ui::SimpleMenuModel::Delegate implementation: 35 // ui::SimpleMenuModel::Delegate implementation:
34 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; 36 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
35 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; 37 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
36 virtual bool GetAcceleratorForCommandId( 38 virtual bool GetAcceleratorForCommandId(
37 int command_id, 39 int command_id,
38 ui::Accelerator* accelerator) OVERRIDE; 40 ui::Accelerator* accelerator) OVERRIDE;
39 virtual void ExecuteCommand(int command_id) OVERRIDE; 41 virtual void ExecuteCommand(int command_id) OVERRIDE;
40 42
41 private: 43 private:
42 typedef std::map<int, content::MediaStreamDevice> CommandMap; 44 typedef std::map<int, content::MediaStreamDevice> CommandMap;
43 45
44 // Internal method to add the |devices| to the current menu. 46 // Internal method to add the |devices| to the current menu.
45 void AddDevices(const content::MediaStreamDevices& devices); 47 void AddDevices(const content::MediaStreamDevices& devices);
46 48
49 // Internal method to add "always allow" option to the current menu.
50 void AddAlwaysAllowOption(bool audio, bool video);
51
47 // Map of command IDs to devices. 52 // Map of command IDs to devices.
48 CommandMap commands_; 53 CommandMap commands_;
49 54
50 // These are the command IDs (key of above |commands_| map) of the selected 55 // These are the command IDs (key of above |commands_| map) of the selected
51 // devices entries in the menu, or -1 if there is no selected ID. 56 // devices entries in the menu, or -1 if there is no selected ID.
52 int selected_command_id_audio_; 57 int selected_command_id_audio_;
53 int selected_command_id_video_; 58 int selected_command_id_video_;
54 59
60 bool always_allow_;
61
55 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesMenuModel); 62 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesMenuModel);
56 }; 63 };
57 64
58 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_MENU_MODEL_H_ 65 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_MENU_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/media/media_stream_devices_controller.cc ('k') | chrome/browser/media/media_stream_devices_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698