| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/content_settings/content_settings_pref_provider.h" | 5 #include "chrome/browser/content_settings/content_settings_pref_provider.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 | 224 |
| 225 // Update the content settings preference. | 225 // Update the content settings preference. |
| 226 if (!is_incognito_) { | 226 if (!is_incognito_) { |
| 227 UpdatePref(primary_pattern, | 227 UpdatePref(primary_pattern, |
| 228 secondary_pattern, | 228 secondary_pattern, |
| 229 content_type, | 229 content_type, |
| 230 resource_identifier, | 230 resource_identifier, |
| 231 setting); | 231 setting); |
| 232 prefs_->ScheduleSavePersistentPrefs(); | |
| 233 } | 232 } |
| 234 | 233 |
| 235 NotifyObservers( | 234 NotifyObservers( |
| 236 primary_pattern, secondary_pattern, content_type, resource_identifier); | 235 primary_pattern, secondary_pattern, content_type, resource_identifier); |
| 237 } | 236 } |
| 238 | 237 |
| 239 void PrefProvider::ClearAllContentSettingsRules( | 238 void PrefProvider::ClearAllContentSettingsRules( |
| 240 ContentSettingsType content_type) { | 239 ContentSettingsType content_type) { |
| 241 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 240 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 242 DCHECK(prefs_); | 241 DCHECK(prefs_); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 263 entry->first.resource_identifier, | 262 entry->first.resource_identifier, |
| 264 CONTENT_SETTING_DEFAULT); | 263 CONTENT_SETTING_DEFAULT); |
| 265 } | 264 } |
| 266 // Delete current |entry| and set |entry| to the next value map entry. | 265 // Delete current |entry| and set |entry| to the next value map entry. |
| 267 entry = map_to_modify->erase(entry); | 266 entry = map_to_modify->erase(entry); |
| 268 } else { | 267 } else { |
| 269 ++entry; | 268 ++entry; |
| 270 } | 269 } |
| 271 } | 270 } |
| 272 } | 271 } |
| 273 prefs_->ScheduleSavePersistentPrefs(); | |
| 274 NotifyObservers(ContentSettingsPattern(), | 272 NotifyObservers(ContentSettingsPattern(), |
| 275 ContentSettingsPattern(), | 273 ContentSettingsPattern(), |
| 276 content_type, | 274 content_type, |
| 277 std::string()); | 275 std::string()); |
| 278 } | 276 } |
| 279 | 277 |
| 280 void PrefProvider::Observe( | 278 void PrefProvider::Observe( |
| 281 int type, | 279 int type, |
| 282 const NotificationSource& source, | 280 const NotificationSource& source, |
| 283 const NotificationDetails& details) { | 281 const NotificationDetails& details) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 299 } else if (*name == prefs::kGeolocationContentSettings) { | 297 } else if (*name == prefs::kGeolocationContentSettings) { |
| 300 MigrateObsoleteGeolocationPref(); | 298 MigrateObsoleteGeolocationPref(); |
| 301 } else if (*name == prefs::kDesktopNotificationAllowedOrigins || | 299 } else if (*name == prefs::kDesktopNotificationAllowedOrigins || |
| 302 *name == prefs::kDesktopNotificationDeniedOrigins) { | 300 *name == prefs::kDesktopNotificationDeniedOrigins) { |
| 303 MigrateObsoleteNotificationsPrefs(); | 301 MigrateObsoleteNotificationsPrefs(); |
| 304 } else { | 302 } else { |
| 305 NOTREACHED() << "Unexpected preference observed"; | 303 NOTREACHED() << "Unexpected preference observed"; |
| 306 return; | 304 return; |
| 307 } | 305 } |
| 308 } | 306 } |
| 309 prefs_->ScheduleSavePersistentPrefs(); | |
| 310 ReadContentSettingsFromPref(true); | 307 ReadContentSettingsFromPref(true); |
| 311 | 308 |
| 312 NotifyObservers(ContentSettingsPattern(), | 309 NotifyObservers(ContentSettingsPattern(), |
| 313 ContentSettingsPattern(), | 310 ContentSettingsPattern(), |
| 314 CONTENT_SETTINGS_TYPE_DEFAULT, | 311 CONTENT_SETTINGS_TYPE_DEFAULT, |
| 315 std::string()); | 312 std::string()); |
| 316 } else { | 313 } else { |
| 317 NOTREACHED() << "Unexpected notification"; | 314 NOTREACHED() << "Unexpected notification"; |
| 318 } | 315 } |
| 319 } | 316 } |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 if (settings_dictionary->GetInteger( | 1063 if (settings_dictionary->GetInteger( |
| 1067 GetTypeName(CONTENT_SETTINGS_TYPE_GEOLOCATION), &setting_value)) { | 1064 GetTypeName(CONTENT_SETTINGS_TYPE_GEOLOCATION), &setting_value)) { |
| 1068 UpdateObsoleteGeolocationPref(pattern_pair.first, | 1065 UpdateObsoleteGeolocationPref(pattern_pair.first, |
| 1069 pattern_pair.second, | 1066 pattern_pair.second, |
| 1070 ContentSetting(setting_value)); | 1067 ContentSetting(setting_value)); |
| 1071 } | 1068 } |
| 1072 } | 1069 } |
| 1073 } | 1070 } |
| 1074 | 1071 |
| 1075 } // namespace content_settings | 1072 } // namespace content_settings |
| OLD | NEW |