Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / website_settings / permission_menu_model.h
blob527070758a030a2331443f65f8e6ad3ac5527e9a
1 // Copyright (c) 2012 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_WEBSITE_SETTINGS_PERMISSION_MENU_MODEL_H_
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_MENU_MODEL_H_
8 #include "chrome/browser/ui/website_settings/website_settings_ui.h"
9 #include "components/content_settings/core/common/content_settings.h"
10 #include "components/content_settings/core/common/content_settings_types.h"
11 #include "ui/base/models/simple_menu_model.h"
12 #include "url/gurl.h"
14 class PermissionMenuModel : public ui::SimpleMenuModel,
15 public ui::SimpleMenuModel::Delegate {
16 public:
17 typedef base::Callback<void(const WebsiteSettingsUI::PermissionInfo&)>
18 ChangeCallback;
20 // Create a new menu model for permission settings.
21 PermissionMenuModel(const GURL& url,
22 const WebsiteSettingsUI::PermissionInfo& info,
23 const ChangeCallback& callback);
24 // Creates a special-case menu model that only has the allow and block
25 // options. It does not track a permission type. |setting| is the
26 // initial selected option. It must be either CONTENT_SETTING_ALLOW or
27 // CONTENT_SETTING_BLOCK.
28 PermissionMenuModel(const GURL& url,
29 ContentSetting setting,
30 const ChangeCallback& callback);
31 ~PermissionMenuModel() override;
33 // Overridden from ui::SimpleMenuModel::Delegate:
34 bool IsCommandIdChecked(int command_id) const override;
35 bool IsCommandIdEnabled(int command_id) const override;
36 bool GetAcceleratorForCommandId(int command_id,
37 ui::Accelerator* accelerator) override;
38 void ExecuteCommand(int command_id, int event_flags) override;
40 private:
41 // The permission info represented by the menu model.
42 WebsiteSettingsUI::PermissionInfo permission_;
44 // Callback to be called when the permission's setting is changed.
45 ChangeCallback callback_;
47 DISALLOW_COPY_AND_ASSIGN(PermissionMenuModel);
50 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_MENU_MODEL_H_