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

Unified Diff: chrome/browser/ui/gtk/website_settings/permission_selector.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/gtk/website_settings/permission_selector.h
diff --git a/chrome/browser/ui/gtk/website_settings/permission_selector.h b/chrome/browser/ui/gtk/website_settings/permission_selector.h
index 629fea90d696dd021dde8199327c3c3320b52b87..e92b8d0174ca69290c6199b1684b00a414b2704b 100644
--- a/chrome/browser/ui/gtk/website_settings/permission_selector.h
+++ b/chrome/browser/ui/gtk/website_settings/permission_selector.h
@@ -5,21 +5,24 @@
#ifndef CHROME_BROWSER_UI_GTK_WEBSITE_SETTINGS_PERMISSION_SELECTOR_H_
#define CHROME_BROWSER_UI_GTK_WEBSITE_SETTINGS_PERMISSION_SELECTOR_H_
+#include <gtk/gtk.h>
+
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
+#include "chrome/browser/ui/website_settings/permission_menu_model.h"
#include "chrome/browser/ui/gtk/website_settings/permission_selector_observer.h"
#include "chrome/common/content_settings.h"
#include "chrome/common/content_settings_types.h"
#include "ui/base/gtk/gtk_signal.h"
+class MenuGtk;
class GtkThemeService;
-typedef struct _GParamSpec GParamSpec;
-typedef struct _GtkWidget GtkWidget;
// The class |PermissionSelector| allows to change the permission |setting| of a
// given permission |type|.
-class PermissionSelector {
+class PermissionSelector : public PermissionMenuModel::PermissionMenuDelegate {
public:
// Creates a |PermissionSelector| for the given permission |type|. |setting|
// is the current permissions setting. It is possible to pass
@@ -29,36 +32,40 @@ class PermissionSelector {
PermissionSelector(GtkThemeService* theme_service_,
ContentSettingsType type,
ContentSetting setting,
- ContentSetting default_setting);
+ ContentSetting default_setting,
+ content_settings::SettingSource source);
~PermissionSelector();
- // Creates the UI for the |PermissionSelector| and returns the widget that
- // contains the UI elements. The ownership of the widget is transfered to the
- // caller.
- GtkWidget* CreateUI();
+ // Returns the container widget that contains all |PermissionSelector| UI
+ // widgets.
+ GtkWidget* widget() { return widget_; }
// Adds an |observer|.
void AddObserver(PermissionSelectorObserver* observer);
// Returns the current permission setting.
- ContentSetting setting() const { return setting_; }
+ ContentSetting GetSetting() const;
// Returns the permissions type.
- ContentSettingsType type() const { return type_; }
+ ContentSettingsType GetType() const;
private:
- CHROMEGTK_CALLBACK_0(PermissionSelector, void, OnPermissionChanged);
- CHROMEGTK_CALLBACK_1(PermissionSelector, void, OnComboBoxShown, GParamSpec*);
-
- GtkThemeService* theme_service_;
-
- // The permission type.
- ContentSettingsType type_;
- // The current permission setting.
- ContentSetting setting_;
- // The effective default setting. This is required to create the proper UI
- // string for the default setting.
- ContentSetting default_setting_;
+ // Gtk callback to intercept mouse clicks to the menu buttons.
+ CHROMEGTK_CALLBACK_1(PermissionSelector, gboolean, OnMenuButtonPressEvent,
+ GdkEventButton*);
+
+ // PermissionMenuModel::PermissionMenuDelegate implementation.
+ virtual void OnPermissionSelected() OVERRIDE;
+
+ // The container widget that contains the PermissionSelecter UI widgets.
+ GtkWidget* widget_; // Owned by the widget hierarchy.
+
+ // The button that toggles the permission |menu_|.
+ GtkWidget* menu_button_; // Owned by the widget hierarchy.
+ // The menu that provides the permission settings.
+ scoped_ptr<MenuGtk> menu_;
+ // The model for the permission |menu_|.
+ scoped_ptr<PermissionMenuModel> menu_model_;
// The permission type icon. The icon is changed depending on the selected
// setting.

Powered by Google App Engine
This is Rietveld 408576698