Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: chrome/browser/notifications/message_center_settings_controller.cc

Issue 1694923004: Use GURLs instead of patterns in SetContentSetting in notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scoping_set_content_setting
Patch Set: minor change Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 might be from user manual input and not match
356 // the default one used by ClearSetting().
357 HostContentSettingsMapFactory::GetForProfile(profile)
358 ->SetContentSetting(pattern, ContentSettingsPattern::Wildcard(),
359 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
360 content_settings::ResourceIdentifier(),
361 CONTENT_SETTING_DEFAULT);
362 }
355 } 363 }
356 } else { 364 } else {
357 NotifierStateTrackerFactory::GetForProfile(profile) 365 NotifierStateTrackerFactory::GetForProfile(profile)
358 ->SetNotifierEnabled(notifier.notifier_id, enabled); 366 ->SetNotifierEnabled(notifier.notifier_id, enabled);
359 } 367 }
360 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, 368 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver,
361 observers_, 369 observers_,
362 NotifierEnabledChanged(notifier.notifier_id, enabled)); 370 NotifierEnabledChanged(notifier.notifier_id, enabled));
363 } 371 }
364 372
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 weak_factory_.GetWeakPtr())); 563 weak_factory_.GetWeakPtr()));
556 } 564 }
557 #endif 565 #endif
558 566
559 if (notify) { 567 if (notify) {
560 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, 568 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver,
561 observers_, 569 observers_,
562 NotifierGroupChanged()); 570 NotifierGroupChanged());
563 } 571 }
564 } 572 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698