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

Unified Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 7655019: Migrate Obsolete NotificationsSettings and remove content_settings::NotificationsProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 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/webui/options/content_settings_handler.cc
diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc
index 4b80c94865573c31d8696f464fca094acaa7b2ea..d43fd44e2aecb577c504158237cc84a6f57bfb59 100644
--- a/chrome/browser/ui/webui/options/content_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/content_settings_handler.cc
@@ -24,7 +24,6 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/content_settings_helper.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "content/browser/tab_contents/tab_contents.h"
@@ -168,13 +167,13 @@ DictionaryValue* GetGeolocationExceptionForPage(
// in the desktop notifications exceptions table. Ownership of the pointer is
// passed to the caller.
DictionaryValue* GetNotificationExceptionForPage(
- const GURL& url,
+ const ContentSettingsPattern& pattern,
ContentSetting setting) {
DictionaryValue* exception = new DictionaryValue();
exception->SetString(kDisplayPattern,
- content_settings_helper::OriginToString(url));
+ pattern.ToString());
battre 2011/08/29 17:44:04 nit: single line
markusheintz_ 2011/08/30 15:14:02 Done.
exception->SetString(kSetting, ContentSettingToString(setting));
- exception->SetString(kOrigin, url.spec());
+ exception->SetString(kOrigin, pattern.ToString());
return exception;
}
@@ -510,17 +509,17 @@ void ContentSettingsHandler::UpdateNotificationExceptionsView() {
DesktopNotificationService* service =
DesktopNotificationServiceFactory::GetForProfile(profile);
- std::vector<GURL> allowed(service->GetAllowedOrigins());
- std::vector<GURL> blocked(service->GetBlockedOrigins());
+ HostContentSettingsMap::SettingsForOneType settings;
+ service->GetNotificationsSettings(&settings);
ListValue exceptions;
- for (size_t i = 0; i < allowed.size(); ++i) {
- exceptions.Append(
- GetNotificationExceptionForPage(allowed[i], CONTENT_SETTING_ALLOW));
- }
- for (size_t i = 0; i < blocked.size(); ++i) {
+ for (HostContentSettingsMap::SettingsForOneType::const_iterator i =
+ settings.begin();
+ i != settings.end();
+ ++i) {
+ const HostContentSettingsMap::PatternSettingSourceTuple& tuple(*i);
exceptions.Append(
- GetNotificationExceptionForPage(blocked[i], CONTENT_SETTING_BLOCK));
+ GetNotificationExceptionForPage(tuple.a, tuple.c));
battre 2011/08/29 17:44:04 please add a TODO, to HostContentSettingsMap::Patt
markusheintz_ 2011/08/30 15:14:02 Added TODO in host_content_settings_map.h where th
}
StringValue type_string(
@@ -653,11 +652,11 @@ void ContentSettingsHandler::RemoveException(const ListValue* args) {
ContentSetting content_setting = ContentSettingFromString(setting);
if (content_setting == CONTENT_SETTING_ALLOW) {
battre 2011/08/29 17:44:04 this can be simplified if ResetAllowedOrigin and R
markusheintz_ 2011/08/30 15:14:02 You are right. I was afraid that this CL might gro
DesktopNotificationServiceFactory::GetForProfile(profile)->
- ResetAllowedOrigin(GURL(origin));
+ ResetAllowedOrigin(ContentSettingsPattern::FromString(origin));
} else {
DCHECK_EQ(content_setting, CONTENT_SETTING_BLOCK);
DesktopNotificationServiceFactory::GetForProfile(profile)->
- ResetBlockedOrigin(GURL(origin));
+ ResetBlockedOrigin(ContentSettingsPattern::FromString(origin));
}
} else {
std::string mode;

Powered by Google App Engine
This is Rietveld 408576698