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_
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
{
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 ~ContentSettingMediaMenuModel() override
;
31 // ui::SimpleMenuModel::Delegate:
32 bool IsCommandIdChecked(int command_id
) const override
;
33 bool IsCommandIdEnabled(int command_id
) const override
;
34 bool GetAcceleratorForCommandId(int command_id
,
35 ui::Accelerator
* accelerator
) override
;
36 void ExecuteCommand(int command_id
, int event_flags
) override
;
39 typedef std::map
<int, content::MediaStreamDevice
> CommandMap
;
41 content::MediaStreamType type_
;
42 ContentSettingBubbleModel
* media_bubble_model_
; // Weak.
43 MenuLabelChangedCallback callback_
;
46 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaMenuModel
);
49 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_MEDIA_MENU_MODEL_H_