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()) |
raymes
2016/03/16 03:17:45
nit: {}
Also, I think we should add a comment her
lshang
2016/03/16 04:59:14
Done.
| |
354 DesktopNotificationProfileUtil::ClearSetting(profile, pattern); | 354 HostContentSettingsMapFactory::GetForProfile(profile) |
355 ->SetContentSetting(pattern, ContentSettingsPattern::Wildcard(), | |
356 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | |
357 content_settings::ResourceIdentifier(), | |
358 CONTENT_SETTING_DEFAULT); | |
355 } | 359 } |
356 } else { | 360 } else { |
357 NotifierStateTrackerFactory::GetForProfile(profile) | 361 NotifierStateTrackerFactory::GetForProfile(profile) |
358 ->SetNotifierEnabled(notifier.notifier_id, enabled); | 362 ->SetNotifierEnabled(notifier.notifier_id, enabled); |
359 } | 363 } |
360 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, | 364 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, |
361 observers_, | 365 observers_, |
362 NotifierEnabledChanged(notifier.notifier_id, enabled)); | 366 NotifierEnabledChanged(notifier.notifier_id, enabled)); |
363 } | 367 } |
364 | 368 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
555 weak_factory_.GetWeakPtr())); | 559 weak_factory_.GetWeakPtr())); |
556 } | 560 } |
557 #endif | 561 #endif |
558 | 562 |
559 if (notify) { | 563 if (notify) { |
560 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, | 564 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, |
561 observers_, | 565 observers_, |
562 NotifierGroupChanged()); | 566 NotifierGroupChanged()); |
563 } | 567 } |
564 } | 568 } |
OLD | NEW |