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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
343 if (iter != patterns_.end()) { | 343 if (iter != patterns_.end()) { |
344 pattern = iter->second; | 344 pattern = iter->second; |
345 } else if (notifier.notifier_id.url.is_valid()) { | 345 } else if (notifier.notifier_id.url.is_valid()) { |
346 pattern = | 346 pattern = |
347 ContentSettingsPattern::FromURLNoWildcard(notifier.notifier_id.url); | 347 ContentSettingsPattern::FromURLNoWildcard(notifier.notifier_id.url); |
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 DesktopNotificationProfileUtil::ClearSetting(profile, pattern); | 354 // Note that we don't use DesktopNotificationProfileUtil::ClearSetting |
355 // here because pattern may from user manual input. | |
Bernhard Bauer
2016/03/16 10:25:22
Nit: this subordinate clause no verb 😃. "[...] bec
lshang
2016/03/16 23:56:58
Done.
| |
356 HostContentSettingsMapFactory::GetForProfile(profile) | |
357 ->SetContentSetting(pattern, ContentSettingsPattern::Wildcard(), | |
358 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | |
359 content_settings::ResourceIdentifier(), | |
360 CONTENT_SETTING_DEFAULT); | |
361 } | |
355 } | 362 } |
356 } else { | 363 } else { |
357 NotifierStateTrackerFactory::GetForProfile(profile) | 364 NotifierStateTrackerFactory::GetForProfile(profile) |
358 ->SetNotifierEnabled(notifier.notifier_id, enabled); | 365 ->SetNotifierEnabled(notifier.notifier_id, enabled); |
359 } | 366 } |
360 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, | 367 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, |
361 observers_, | 368 observers_, |
362 NotifierEnabledChanged(notifier.notifier_id, enabled)); | 369 NotifierEnabledChanged(notifier.notifier_id, enabled)); |
363 } | 370 } |
364 | 371 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
555 weak_factory_.GetWeakPtr())); | 562 weak_factory_.GetWeakPtr())); |
556 } | 563 } |
557 #endif | 564 #endif |
558 | 565 |
559 if (notify) { | 566 if (notify) { |
560 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, | 567 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, |
561 observers_, | 568 observers_, |
562 NotifierGroupChanged()); | 569 NotifierGroupChanged()); |
563 } | 570 } |
564 } | 571 } |
OLD | NEW |