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

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: add a note 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 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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698