| 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 | 5 |
| 6 #include "chrome/browser/content_settings/content_settings_notification_provider
.h" | 6 #include "chrome/browser/content_settings/content_settings_notification_provider
.h" |
| 7 | 7 |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 9 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 10 #include "chrome/browser/notifications/notification.h" | 10 #include "chrome/browser/notifications/notification.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 bool denied_changed = false; | 269 bool denied_changed = false; |
| 270 | 270 |
| 271 { | 271 { |
| 272 ListPrefUpdate update_allowed_sites( | 272 ListPrefUpdate update_allowed_sites( |
| 273 prefs, prefs::kDesktopNotificationAllowedOrigins); | 273 prefs, prefs::kDesktopNotificationAllowedOrigins); |
| 274 ListPrefUpdate update_denied_sites( | 274 ListPrefUpdate update_denied_sites( |
| 275 prefs, prefs::kDesktopNotificationDeniedOrigins); | 275 prefs, prefs::kDesktopNotificationDeniedOrigins); |
| 276 ListValue* allowed_sites = update_allowed_sites.Get(); | 276 ListValue* allowed_sites = update_allowed_sites.Get(); |
| 277 ListValue* denied_sites = update_denied_sites.Get(); | 277 ListValue* denied_sites = update_denied_sites.Get(); |
| 278 // |value| is passed to the preferences list, or deleted. | 278 // |value| is passed to the preferences list, or deleted. |
| 279 StringValue* value = new StringValue(origin.spec()); | 279 StringValue* value = base::StringValue::New(origin.spec()); |
| 280 | 280 |
| 281 // Remove from one list and add to the other. | 281 // Remove from one list and add to the other. |
| 282 if (is_allowed) { | 282 if (is_allowed) { |
| 283 // Remove from the denied list. | 283 // Remove from the denied list. |
| 284 if (denied_sites->Remove(*value, NULL)) | 284 if (denied_sites->Remove(*value, NULL)) |
| 285 denied_changed = true; | 285 denied_changed = true; |
| 286 | 286 |
| 287 // Add to the allowed list. | 287 // Add to the allowed list. |
| 288 if (allowed_sites->AppendIfNotPresent(value)) | 288 if (allowed_sites->AppendIfNotPresent(value)) |
| 289 allowed_changed = true; | 289 allowed_changed = true; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 prefs->ScheduleSavePersistentPrefs(); | 359 prefs->ScheduleSavePersistentPrefs(); |
| 360 } | 360 } |
| 361 | 361 |
| 362 void NotificationProvider::ResetAllOrigins() { | 362 void NotificationProvider::ResetAllOrigins() { |
| 363 PrefService* prefs = profile_->GetPrefs(); | 363 PrefService* prefs = profile_->GetPrefs(); |
| 364 prefs->ClearPref(prefs::kDesktopNotificationAllowedOrigins); | 364 prefs->ClearPref(prefs::kDesktopNotificationAllowedOrigins); |
| 365 prefs->ClearPref(prefs::kDesktopNotificationDeniedOrigins); | 365 prefs->ClearPref(prefs::kDesktopNotificationDeniedOrigins); |
| 366 } | 366 } |
| 367 | 367 |
| 368 } // namespace content_settings | 368 } // namespace content_settings |
| OLD | NEW |