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

Side by Side Diff: chrome/browser/ui/content_settings/content_setting_media_menu_model.h

Issue 12208010: Adding device selection menus to the content setting bubble (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_MEDIA_MENU_MODEL_H_
6 #define CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_MEDIA_MENU_MODEL_H_
7
8 #include <map>
9
10 #include "base/callback.h"
11 #include "content/public/common/media_stream_request.h"
12 #include "ui/base/models/simple_menu_model.h"
13
14 class ContentSettingBubbleModel;
15 class PrefService;
16
17 // A menu model that builds the contents of the media capture devices menu in
18 // the content setting bubble.
19 class ContentSettingMediaMenuModel : public ui::SimpleMenuModel,
20 public ui::SimpleMenuModel::Delegate {
21 public:
22 // Callback to update the label of the menu in the UI.
23 typedef base::Callback<void(content::MediaStreamType, const std::string&)>
24 MenuLabelChangedCallback;
25
26 ContentSettingMediaMenuModel(
27 PrefService* prefs,
28 content::MediaStreamType type,
29 ContentSettingBubbleModel* bubble_model,
30 const MenuLabelChangedCallback& callback);
31 virtual ~ContentSettingMediaMenuModel();
32
33 // ui::SimpleMenuModel::Delegate:
34 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
35 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
36 virtual bool GetAcceleratorForCommandId(
37 int command_id,
38 ui::Accelerator* accelerator) OVERRIDE;
39 virtual void ExecuteCommand(int command_id) OVERRIDE;
40
41 private:
42 typedef std::map<int, content::MediaStreamDevice> CommandMap;
43
44 PrefService* prefs_; // Weak.
45 content::MediaStreamType type_;
46 ContentSettingBubbleModel* media_bubble_model_; // Weak.
47 MenuLabelChangedCallback callback_;
48 CommandMap commands_;
49
50 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaMenuModel);
51 };
52
53 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_MEDIA_MENU_MODEL_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698