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

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: fixed the windows code. 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 Profile;
16
17 // A menu model that builds the contents of the media capture devices menu in
18 // the content setting bubble.
19 class ContentSettingMediaMenuModel
20 : public ui::SimpleMenuModel,
Peter Kasting 2013/02/06 22:11:18 Can we use composition here or in the callers/user
no longer working on chromium 2013/02/07 16:25:19 Yes, we can, but then we need to expose the Simple
21 public ui::SimpleMenuModel::Delegate {
22 public:
23 // Callback to update the label of the menu in the UI.
24 typedef base::Callback<void(content::MediaStreamType, const std::string&)>
25 MenuLabelChangedCallback;
26
27 ContentSettingMediaMenuModel(
28 Profile* profile,
29 content::MediaStreamType type,
30 ContentSettingBubbleModel* bubble_model,
31 const MenuLabelChangedCallback& callback);
32
33 virtual ~ContentSettingMediaMenuModel();
34
35 // ui::SimpleMenuModel::Delegate implementation:
36 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
37 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
38 virtual bool GetAcceleratorForCommandId(
39 int command_id,
40 ui::Accelerator* accelerator) OVERRIDE;
41 virtual void ExecuteCommand(int command_id) OVERRIDE;
42
43 private:
44 typedef std::map<int, content::MediaStreamDevice> CommandMap;
45
46 // Internal method to build the menu.
47 void BuildMenu();
48
49 Profile* profile_; // Weak.
50 content::MediaStreamType type_;
51 ContentSettingBubbleModel* media_bubble_model_; // Weak.
52 MenuLabelChangedCallback callback_;
53
54 // Map of command IDs to devices.
55 CommandMap commands_;
56
57 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaMenuModel);
58 };
59
60 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_MEDIA_MENU_MODEL_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698