| 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 "ui/base/models/simple_menu_model.h" | 8 #include "ui/base/models/simple_menu_model.h" |
| 9 #include "chrome/common/content_settings.h" | 9 #include "chrome/common/content_settings.h" |
| 10 #include "chrome/common/content_settings_types.h" | 10 #include "chrome/common/content_settings_types.h" |
| 11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 12 | 12 |
| 13 class PermissionMenuModel : public ui::SimpleMenuModel, | 13 class PermissionMenuModel : public ui::SimpleMenuModel, |
| 14 public ui::SimpleMenuModel::Delegate { | 14 public ui::SimpleMenuModel::Delegate { |
| 15 public: | 15 public: |
| 16 enum CommandID { | 16 enum CommandID { |
| 17 COMMAND_SET_TO_DEFAULT, | 17 COMMAND_SET_TO_DEFAULT, |
| 18 COMMAND_SET_TO_ALLOW, | 18 COMMAND_SET_TO_ALLOW, |
| 19 COMMAND_SET_TO_BLOCK, | 19 COMMAND_SET_TO_BLOCK, |
| 20 }; | 20 }; |
| 21 | 21 |
| 22 class Delegate { | 22 class Delegate { |
| 23 public: | 23 public: |
| 24 virtual ~Delegate() { } | |
| 25 | |
| 26 // Executes the command with the given |command_id|. | 24 // Executes the command with the given |command_id|. |
| 27 virtual void ExecuteCommand(int command_id) = 0; | 25 virtual void ExecuteCommand(int command_id) = 0; |
| 28 // Returns true if the command with the given |command_id| should be | 26 // Returns true if the command with the given |command_id| should be |
| 29 // checked. | 27 // checked. |
| 30 virtual bool IsCommandIdChecked(int command_id) = 0; | 28 virtual bool IsCommandIdChecked(int command_id) = 0; |
| 31 }; | 29 }; |
| 32 | 30 |
| 33 PermissionMenuModel(Delegate* delegate, | 31 PermissionMenuModel(Delegate* delegate, |
| 34 const GURL& url, | 32 const GURL& url, |
| 35 ContentSettingsType type, | 33 ContentSettingsType type, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 48 // The delegate of the |PermissionMenuModel|. |delegate_| can be NULL. | 46 // The delegate of the |PermissionMenuModel|. |delegate_| can be NULL. |
| 49 Delegate* delegate_; | 47 Delegate* delegate_; |
| 50 | 48 |
| 51 // The URL of the website for which to display site permissions. | 49 // The URL of the website for which to display site permissions. |
| 52 GURL site_url_; | 50 GURL site_url_; |
| 53 | 51 |
| 54 DISALLOW_COPY_AND_ASSIGN(PermissionMenuModel); | 52 DISALLOW_COPY_AND_ASSIGN(PermissionMenuModel); |
| 55 }; | 53 }; |
| 56 | 54 |
| 57 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_MENU_MODEL_H_ | 55 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_MENU_MODEL_H_ |
| OLD | NEW |