Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / content_settings / content_setting_media_menu_model.h
blob6a630b9867057689304dcabcc99b89046944f2af
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.
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_
8 #include <map>
10 #include "base/callback.h"
11 #include "content/public/common/media_stream_request.h"
12 #include "ui/base/models/simple_menu_model.h"
14 class ContentSettingBubbleModel;
16 // A menu model that builds the contents of the media capture devices menu in
17 // the content setting bubble.
18 class ContentSettingMediaMenuModel : public ui::SimpleMenuModel,
19 public ui::SimpleMenuModel::Delegate {
20 public:
21 // Callback to update the label of the menu in the UI.
22 typedef base::Callback<void(content::MediaStreamType, const std::string&)>
23 MenuLabelChangedCallback;
25 ContentSettingMediaMenuModel(
26 content::MediaStreamType type,
27 ContentSettingBubbleModel* bubble_model,
28 const MenuLabelChangedCallback& callback);
29 virtual ~ContentSettingMediaMenuModel();
31 // ui::SimpleMenuModel::Delegate:
32 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
33 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
34 virtual bool GetAcceleratorForCommandId(
35 int command_id,
36 ui::Accelerator* accelerator) OVERRIDE;
37 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
39 private:
40 typedef std::map<int, content::MediaStreamDevice> CommandMap;
42 content::MediaStreamType type_;
43 ContentSettingBubbleModel* media_bubble_model_; // Weak.
44 MenuLabelChangedCallback callback_;
45 CommandMap commands_;
47 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaMenuModel);
50 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_MEDIA_MENU_MODEL_H_