| 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..fa56baccf1d25ea7b744771a56d21568e3757a13 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::Delegate {
|
| public:
|
| // Creates a |PermissionSelector| for the given permission |type|. |setting|
|
| // is the current permissions setting. It is possible to pass
|
| @@ -29,42 +32,59 @@ class PermissionSelector {
|
| PermissionSelector(GtkThemeService* theme_service_,
|
| ContentSettingsType type,
|
| ContentSetting setting,
|
| - ContentSetting default_setting);
|
| - ~PermissionSelector();
|
| + ContentSetting default_setting,
|
| + content_settings::SettingSource source);
|
| + virtual ~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*);
|
| + // Gtk callback to intercept mouse clicks to the menu buttons.
|
| + CHROMEGTK_CALLBACK_1(PermissionSelector, gboolean, OnMenuButtonPressEvent,
|
| + GdkEventButton*);
|
|
|
| - GtkThemeService* theme_service_;
|
| + // PermissionMenuModel::PermissionMenuDelegate implementation.
|
| + virtual void ExecuteCommand(int command_id) OVERRIDE;
|
| + virtual bool IsCommandIdChecked(int command_id) OVERRIDE;
|
|
|
| - // 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_;
|
| + // 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.
|
| // Owned by the widget hierarchy created by the CreateUI method.
|
| GtkWidget* icon_;
|
|
|
| + // The site permission (the |ContentSettingsType|) for which the menu model
|
| + // provides settings.
|
| + ContentSettingsType type_;
|
| +
|
| + // The global default setting for the permission |type_|.
|
| + ContentSetting default_setting_;
|
| +
|
| + // The currently active setting for the permission |type_|.
|
| + ContentSetting setting_;
|
| +
|
| ObserverList<PermissionSelectorObserver, false> observer_list_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(PermissionSelector);
|
|
|