OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/notifications/message_center_settings_controller.h" | 5 #include "chrome/browser/notifications/message_center_settings_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 } else { | 348 } else { |
349 LOG(ERROR) << "Invalid url pattern: " | 349 LOG(ERROR) << "Invalid url pattern: " |
350 << notifier.notifier_id.url.spec(); | 350 << notifier.notifier_id.url.spec(); |
351 } | 351 } |
352 | 352 |
353 if (pattern.IsValid()) { | 353 if (pattern.IsValid()) { |
354 // Note that we don't use DesktopNotificationProfileUtil::ClearSetting() | 354 // Note that we don't use DesktopNotificationProfileUtil::ClearSetting() |
355 // here because pattern might be from user manual input and not match | 355 // here because pattern might be from user manual input and not match |
356 // the default one used by ClearSetting(). | 356 // the default one used by ClearSetting(). |
357 HostContentSettingsMapFactory::GetForProfile(profile) | 357 HostContentSettingsMapFactory::GetForProfile(profile) |
358 ->SetContentSetting(pattern, ContentSettingsPattern::Wildcard(), | 358 ->SetContentSettingCustomScope( |
359 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 359 pattern, ContentSettingsPattern::Wildcard(), |
360 content_settings::ResourceIdentifier(), | 360 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
361 CONTENT_SETTING_DEFAULT); | 361 content_settings::ResourceIdentifier(), |
| 362 CONTENT_SETTING_DEFAULT); |
362 } | 363 } |
363 } | 364 } |
364 } else { | 365 } else { |
365 NotifierStateTrackerFactory::GetForProfile(profile) | 366 NotifierStateTrackerFactory::GetForProfile(profile) |
366 ->SetNotifierEnabled(notifier.notifier_id, enabled); | 367 ->SetNotifierEnabled(notifier.notifier_id, enabled); |
367 } | 368 } |
368 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, | 369 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, |
369 observers_, | 370 observers_, |
370 NotifierEnabledChanged(notifier.notifier_id, enabled)); | 371 NotifierEnabledChanged(notifier.notifier_id, enabled)); |
371 } | 372 } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 weak_factory_.GetWeakPtr())); | 564 weak_factory_.GetWeakPtr())); |
564 } | 565 } |
565 #endif | 566 #endif |
566 | 567 |
567 if (notify) { | 568 if (notify) { |
568 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, | 569 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, |
569 observers_, | 570 observers_, |
570 NotifierGroupChanged()); | 571 NotifierGroupChanged()); |
571 } | 572 } |
572 } | 573 } |
OLD | NEW |