Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 | |
|
Peter Kasting
2013/02/16 02:55:13
Nit: Blank line probably not necessary
no longer working on chromium
2013/02/18 17:20:04
Done.
| |
| 32 virtual ~ContentSettingMediaMenuModel(); | |
| 33 | |
| 34 // ui::SimpleMenuModel::Delegate implementation: | |
|
Peter Kasting
2013/02/16 02:55:13
Nit: I suggest just "// ui::SimpleMenuModel::Deleg
no longer working on chromium
2013/02/18 17:20:04
Done.
| |
| 35 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | |
| 36 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | |
| 37 virtual bool GetAcceleratorForCommandId( | |
| 38 int command_id, | |
| 39 ui::Accelerator* accelerator) OVERRIDE; | |
| 40 virtual void ExecuteCommand(int command_id) OVERRIDE; | |
| 41 | |
| 42 private: | |
| 43 typedef std::map<int, content::MediaStreamDevice> CommandMap; | |
| 44 | |
| 45 // Internal method to build the menu. | |
|
Peter Kasting
2013/02/16 02:55:13
Nit: This comment adds nothing.
no longer working on chromium
2013/02/18 17:20:04
Removed.
| |
| 46 void BuildMenu(); | |
| 47 | |
| 48 PrefService* prefs_; // Weak. | |
| 49 content::MediaStreamType type_; | |
| 50 ContentSettingBubbleModel* media_bubble_model_; // Weak. | |
| 51 MenuLabelChangedCallback callback_; | |
| 52 | |
| 53 // Map of command IDs to devices. | |
|
Peter Kasting
2013/02/16 02:55:13
Nit: This comment also adds very little.
no longer working on chromium
2013/02/18 17:20:04
Removed.
| |
| 54 CommandMap commands_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaMenuModel); | |
| 57 }; | |
| 58 | |
| 59 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_MEDIA_MENU_MODEL_H _ | |
| OLD | NEW |