diff options
author | markusheintz@chromium.org <markusheintz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-27 21:27:34 +0000 |
---|---|---|
committer | markusheintz@chromium.org <markusheintz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-27 21:27:34 +0000 |
commit | b1d113d1b8912c16dcc23aff43512c4568225f46 (patch) | |
tree | 1b65ef584150fd23facdc41f1361291aea9f533b /chrome/browser | |
parent | 0e75d4f883e270bacd1a9b96e30bd0ee26d195ef (diff) | |
download | chromium_src-b1d113d1b8912c16dcc23aff43512c4568225f46.zip chromium_src-b1d113d1b8912c16dcc23aff43512c4568225f46.tar.gz chromium_src-b1d113d1b8912c16dcc23aff43512c4568225f46.tar.bz2 |
Add the following additional content settings types to the permissions list of the Website Settings UI: Images, JavaScript, Fullscreen, MouseLock and MediaStream.
Display the Location and Notification settings always. Before this CL Location and Notification settings are only displayed if their setting is other than CONTENT_SETTING_ASK.
BUG=113688
TEST=The Website Settings popup shows the following additional permissions: Images, JavaScript, Fullscreen, Mouse lock, Mediastream. Location and Notification settings are always displayed.
Review URL: https://chromiumcodereview.appspot.com/10698005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144561 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
4 files changed, 68 insertions, 31 deletions
diff --git a/chrome/browser/ui/gtk/website_settings_popup_gtk.cc b/chrome/browser/ui/gtk/website_settings_popup_gtk.cc index c1cb985..10dd9d2 100644 --- a/chrome/browser/ui/gtk/website_settings_popup_gtk.cc +++ b/chrome/browser/ui/gtk/website_settings_popup_gtk.cc @@ -394,18 +394,8 @@ void WebsiteSettingsPopupGtk::SetPermissionInfo( GtkListStore* store = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT); GtkTreeIter iter; - // Add option for permission "Allow" to the combobox model. - std::string setting_str = PermissionValueToString(CONTENT_SETTING_ALLOW); - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, setting_str.c_str(), 1, - CONTENT_SETTING_ALLOW, 2, permission->type, -1); - // Add option for permission "BLOCK" to the combobox model. - setting_str = PermissionValueToString(CONTENT_SETTING_BLOCK); - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, setting_str.c_str(), 1, - CONTENT_SETTING_BLOCK, 2, permission->type, -1); // Add option for permission "Global Default" to the combobox model. - setting_str = + std::string setting_str = l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_PERMISSION_DEFAULT); setting_str += " (" + PermissionValueToString(permission->default_setting); setting_str += ")"; @@ -413,6 +403,20 @@ void WebsiteSettingsPopupGtk::SetPermissionInfo( gtk_list_store_set(store, &iter, 0, setting_str.c_str(), 1, CONTENT_SETTING_DEFAULT, 2, permission->type, -1); GtkWidget* combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); + // Add option for permission "Allow" to the combobox model. + setting_str = PermissionValueToString(CONTENT_SETTING_ALLOW); + gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, 0, setting_str.c_str(), 1, + CONTENT_SETTING_ALLOW, 2, permission->type, -1); + // The content settings type fullscreen does not support the concept of + // blocking. + if (permission->type != CONTENT_SETTINGS_TYPE_FULLSCREEN) { + // Add option for permission "BLOCK" to the combobox model. + setting_str = PermissionValueToString(CONTENT_SETTING_BLOCK); + gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, 0, setting_str.c_str(), 1, + CONTENT_SETTING_BLOCK, 2, permission->type, -1); + } // Remove reference to the store to prevent leaking. g_object_unref(G_OBJECT(store)); @@ -424,11 +428,11 @@ void WebsiteSettingsPopupGtk::SetPermissionInfo( // Select the combobox entry for the currently configured permission value. int active = -1; switch (permission->setting) { - case CONTENT_SETTING_DEFAULT: active = 2; + case CONTENT_SETTING_DEFAULT: active = 0; break; - case CONTENT_SETTING_ALLOW: active = 0; + case CONTENT_SETTING_ALLOW: active = 1; break; - case CONTENT_SETTING_BLOCK: active = 1; + case CONTENT_SETTING_BLOCK: active = 2; break; default: NOTREACHED() << "Bad content setting:" << permission->setting; diff --git a/chrome/browser/ui/views/website_settings/permission_selector_view.cc b/chrome/browser/ui/views/website_settings/permission_selector_view.cc index 0835742..649da74 100644 --- a/chrome/browser/ui/views/website_settings/permission_selector_view.cc +++ b/chrome/browser/ui/views/website_settings/permission_selector_view.cc @@ -155,10 +155,12 @@ PermissionMenuModel::PermissionMenuModel( l10n_util::GetStringFUTF16( IDS_WEBSITE_SETTINGS_PERMISSION_LABEL, PermissionValueToString(CONTENT_SETTING_ALLOW))); - AddCheckItem(COMMAND_SET_TO_BLOCK, - l10n_util::GetStringFUTF16( - IDS_WEBSITE_SETTINGS_PERMISSION_LABEL, - PermissionValueToString(CONTENT_SETTING_BLOCK))); + if (site_permission != CONTENT_SETTINGS_TYPE_FULLSCREEN) { + AddCheckItem(COMMAND_SET_TO_BLOCK, + l10n_util::GetStringFUTF16( + IDS_WEBSITE_SETTINGS_PERMISSION_LABEL, + PermissionValueToString(CONTENT_SETTING_BLOCK))); + } } bool PermissionMenuModel::IsCommandIdChecked(int command_id) const { diff --git a/chrome/browser/ui/website_settings/website_settings.cc b/chrome/browser/ui/website_settings/website_settings.cc index cd2035b..b75a2f2 100644 --- a/chrome/browser/ui/website_settings/website_settings.cc +++ b/chrome/browser/ui/website_settings/website_settings.cc @@ -44,11 +44,17 @@ using content::BrowserThread; namespace { +// The list of content settings types to display on the Website Settings UI. ContentSettingsType kPermissionType[] = { - CONTENT_SETTINGS_TYPE_POPUPS, + CONTENT_SETTINGS_TYPE_IMAGES, + CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTINGS_TYPE_PLUGINS, - CONTENT_SETTINGS_TYPE_NOTIFICATIONS, + CONTENT_SETTINGS_TYPE_POPUPS, CONTENT_SETTINGS_TYPE_GEOLOCATION, + CONTENT_SETTINGS_TYPE_NOTIFICATIONS, + CONTENT_SETTINGS_TYPE_FULLSCREEN, + CONTENT_SETTINGS_TYPE_MOUSELOCK, + CONTENT_SETTINGS_TYPE_MEDIASTREAM, }; } // namespace @@ -105,8 +111,13 @@ void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, primary_pattern = ContentSettingsPattern::FromURLNoWildcard(site_url_); secondary_pattern = ContentSettingsPattern::Wildcard(); break; + case CONTENT_SETTINGS_TYPE_IMAGES: + case CONTENT_SETTINGS_TYPE_JAVASCRIPT: case CONTENT_SETTINGS_TYPE_PLUGINS: case CONTENT_SETTINGS_TYPE_POPUPS: + case CONTENT_SETTINGS_TYPE_FULLSCREEN: + case CONTENT_SETTINGS_TYPE_MOUSELOCK: + case CONTENT_SETTINGS_TYPE_MEDIASTREAM: primary_pattern = ContentSettingsPattern::FromURL(site_url_); secondary_pattern = ContentSettingsPattern::Wildcard(); break; @@ -402,18 +413,16 @@ void WebsiteSettings::PresentSitePermissions() { permission_info.setting = content_settings::ValueToContentSetting(value.get()); - if (permission_info.setting != CONTENT_SETTING_ASK) { - if (info.primary_pattern == ContentSettingsPattern::Wildcard() && - info.secondary_pattern == ContentSettingsPattern::Wildcard()) { - permission_info.default_setting = permission_info.setting; - permission_info.setting = CONTENT_SETTING_DEFAULT; - } else { - permission_info.default_setting = - content_settings_->GetDefaultContentSetting(permission_info.type, - NULL); - } - permission_info_list.push_back(permission_info); + if (info.primary_pattern == ContentSettingsPattern::Wildcard() && + info.secondary_pattern == ContentSettingsPattern::Wildcard()) { + permission_info.default_setting = permission_info.setting; + permission_info.setting = CONTENT_SETTING_DEFAULT; + } else { + permission_info.default_setting = + content_settings_->GetDefaultContentSetting(permission_info.type, + NULL); } + permission_info_list.push_back(permission_info); } ui_->SetPermissionInfo(permission_info_list); diff --git a/chrome/browser/ui/website_settings/website_settings_ui.cc b/chrome/browser/ui/website_settings/website_settings_ui.cc index 366ad8b..a1deabb 100644 --- a/chrome/browser/ui/website_settings/website_settings_ui.cc +++ b/chrome/browser/ui/website_settings/website_settings_ui.cc @@ -37,6 +37,10 @@ WebsiteSettingsUI::~WebsiteSettingsUI() { // static int WebsiteSettingsUI::PermissionTypeToUIStringID(ContentSettingsType type) { switch (type) { + case CONTENT_SETTINGS_TYPE_IMAGES: + return IDS_WEBSITE_SETTINGS_TYPE_IMAGES; + case CONTENT_SETTINGS_TYPE_JAVASCRIPT: + return IDS_WEBSITE_SETTINGS_TYPE_JAVASCRIPT; case CONTENT_SETTINGS_TYPE_POPUPS: return IDS_WEBSITE_SETTINGS_TYPE_POPUPS; case CONTENT_SETTINGS_TYPE_PLUGINS: @@ -45,6 +49,12 @@ int WebsiteSettingsUI::PermissionTypeToUIStringID(ContentSettingsType type) { return IDS_WEBSITE_SETTINGS_TYPE_LOCATION; case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: return IDS_WEBSITE_SETTINGS_TYPE_NOTIFICATIONS; + case CONTENT_SETTINGS_TYPE_FULLSCREEN: + return IDS_WEBSITE_SETTINGS_TYPE_FULLSCREEN; + case CONTENT_SETTINGS_TYPE_MOUSELOCK: + return IDS_WEBSITE_SETTINGS_TYPE_MOUSELOCK; + case CONTENT_SETTINGS_TYPE_MEDIASTREAM: + return IDS_WEBSITE_SETTINGS_TYPE_MEDIASTREAM; default: NOTREACHED(); return kInvalidRessourceID; @@ -88,6 +98,14 @@ const gfx::Image& WebsiteSettingsUI::GetPermissionIcon( bool use_blocked = (setting == CONTENT_SETTING_BLOCK); int resource_id = IDR_INFO; switch (type) { + case CONTENT_SETTINGS_TYPE_IMAGES: + resource_id = use_blocked ? IDR_BLOCKED_IMAGES + : IDR_INFO; + break; + case CONTENT_SETTINGS_TYPE_JAVASCRIPT: + resource_id = use_blocked ? IDR_BLOCKED_JAVASCRIPT + : IDR_INFO; + break; case CONTENT_SETTINGS_TYPE_COOKIES: resource_id = use_blocked ? IDR_BLOCKED_COOKIES : IDR_COOKIE_ICON; @@ -105,6 +123,10 @@ const gfx::Image& WebsiteSettingsUI::GetPermissionIcon( : IDR_GEOLOCATION_ALLOWED_LOCATIONBAR_ICON; break; case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: + case CONTENT_SETTINGS_TYPE_FULLSCREEN: + case CONTENT_SETTINGS_TYPE_MOUSELOCK: + case CONTENT_SETTINGS_TYPE_MEDIASTREAM: + resource_id = IDR_INFO; break; default: NOTREACHED(); |