| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_MENU_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_MENU_MODEL_H_ |
| 6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_MENU_MODEL_H_ | 6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_MENU_MODEL_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/ui/website_settings/website_settings_ui.h" | 8 #include "chrome/browser/ui/website_settings/website_settings_ui.h" |
| 9 #include "components/content_settings/core/common/content_settings.h" | 9 #include "components/content_settings/core/common/content_settings.h" |
| 10 #include "components/content_settings/core/common/content_settings_types.h" | 10 #include "components/content_settings/core/common/content_settings_types.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 PermissionMenuModel(const GURL& url, | 21 PermissionMenuModel(const GURL& url, |
| 22 const WebsiteSettingsUI::PermissionInfo& info, | 22 const WebsiteSettingsUI::PermissionInfo& info, |
| 23 const ChangeCallback& callback); | 23 const ChangeCallback& callback); |
| 24 // Creates a special-case menu model that only has the allow and block | 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 | 25 // options. It does not track a permission type. |setting| is the |
| 26 // initial selected option. It must be either CONTENT_SETTING_ALLOW or | 26 // initial selected option. It must be either CONTENT_SETTING_ALLOW or |
| 27 // CONTENT_SETTING_BLOCK. | 27 // CONTENT_SETTING_BLOCK. |
| 28 PermissionMenuModel(const GURL& url, | 28 PermissionMenuModel(const GURL& url, |
| 29 ContentSetting setting, | 29 ContentSetting setting, |
| 30 const ChangeCallback& callback); | 30 const ChangeCallback& callback); |
| 31 virtual ~PermissionMenuModel(); | 31 ~PermissionMenuModel() override; |
| 32 | 32 |
| 33 // Overridden from ui::SimpleMenuModel::Delegate: | 33 // Overridden from ui::SimpleMenuModel::Delegate: |
| 34 virtual bool IsCommandIdChecked(int command_id) const override; | 34 bool IsCommandIdChecked(int command_id) const override; |
| 35 virtual bool IsCommandIdEnabled(int command_id) const override; | 35 bool IsCommandIdEnabled(int command_id) const override; |
| 36 virtual bool GetAcceleratorForCommandId( | 36 bool GetAcceleratorForCommandId(int command_id, |
| 37 int command_id, | 37 ui::Accelerator* accelerator) override; |
| 38 ui::Accelerator* accelerator) override; | 38 void ExecuteCommand(int command_id, int event_flags) override; |
| 39 virtual void ExecuteCommand(int command_id, int event_flags) override; | |
| 40 | 39 |
| 41 private: | 40 private: |
| 42 // The permission info represented by the menu model. | 41 // The permission info represented by the menu model. |
| 43 WebsiteSettingsUI::PermissionInfo permission_; | 42 WebsiteSettingsUI::PermissionInfo permission_; |
| 44 | 43 |
| 45 // Callback to be called when the permission's setting is changed. | 44 // Callback to be called when the permission's setting is changed. |
| 46 ChangeCallback callback_; | 45 ChangeCallback callback_; |
| 47 | 46 |
| 48 DISALLOW_COPY_AND_ASSIGN(PermissionMenuModel); | 47 DISALLOW_COPY_AND_ASSIGN(PermissionMenuModel); |
| 49 }; | 48 }; |
| 50 | 49 |
| 51 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_MENU_MODEL_H_ | 50 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_MENU_MODEL_H_ |
| OLD | NEW |