Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7757)

Unified Diff: chrome/browser/ui/website_settings/permission_menu_model.h

Issue 10887027: (GTK only) Replace checkboxes with menus and add support for managed settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/website_settings/permission_menu_model.h
diff --git a/chrome/browser/ui/website_settings/permission_menu_model.h b/chrome/browser/ui/website_settings/permission_menu_model.h
new file mode 100644
index 0000000000000000000000000000000000000000..79ddb27b294d7d6d4145152677d0a60f2108ca74
--- /dev/null
+++ b/chrome/browser/ui/website_settings/permission_menu_model.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_MENU_MODEL_H_
+#define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_MENU_MODEL_H_
+
+#include "ui/base/models/simple_menu_model.h"
+#include "chrome/common/content_settings.h"
+#include "chrome/common/content_settings_types.h"
+
+class PermissionMenuModel : public ui::SimpleMenuModel,
+ public ui::SimpleMenuModel::Delegate {
+ public:
+ class PermissionMenuDelegate {
Ben Goodger (Google) 2012/08/29 15:52:29 Delegate or Observer?
markusheintz_ 2012/08/29 16:15:22 Done.
+ public:
+ virtual void OnPermissionSelected() = 0;
+ };
+
+ PermissionMenuModel(PermissionMenuDelegate* delegate,
+ ContentSettingsType site_permission,
+ ContentSetting default_setting,
+ ContentSetting current_setting);
+
+ ContentSettingsType type() const { return type_; }
+ ContentSetting default_setting() const { return default_setting_; }
+ ContentSetting current_setting() const { return current_setting_; }
+
+ // Overridden from ui::SimpleMenuModel::Delegate:
+ virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
+ virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
+ virtual bool GetAcceleratorForCommandId(
+ int command_id,
+ ui::Accelerator* accelerator) OVERRIDE;
+ virtual void ExecuteCommand(int command_id) OVERRIDE;
+
+ private:
+ enum CommandID {
+ COMMAND_SET_TO_DEFAULT,
+ COMMAND_SET_TO_ALLOW,
+ COMMAND_SET_TO_BLOCK,
+ };
+
+ // The delegate of the |PermissionMenuModel|. |delegate_| can be NULL.
+ PermissionMenuDelegate* delegate_;
+
+ // The site permission (the |ContentSettingsType|) for which the menu model
+ // provides settings.
+ ContentSettingsType type_;
+
+ // The global default setting for the |site_permission_|.
+ ContentSetting default_setting_;
+
+ // The currently active setting for the |site_permission|.
+ ContentSetting current_setting_;
+
+ DISALLOW_COPY_AND_ASSIGN(PermissionMenuModel);
+};
+
+#endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_MENU_MODEL_H_

Powered by Google App Engine
This is Rietveld 408576698