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

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

Issue 5398001: Allow default desktop content settings to be managed via policy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove Cocoa UI-changes Created 10 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/desktop_notification_service.h" 5 #include "chrome/browser/notifications/desktop_notification_service.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/thread.h" 10 #include "base/thread.h"
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 445
446 void DesktopNotificationService::SetDefaultContentSetting( 446 void DesktopNotificationService::SetDefaultContentSetting(
447 ContentSetting setting) { 447 ContentSetting setting) {
448 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 448 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
449 profile_->GetPrefs()->SetInteger( 449 profile_->GetPrefs()->SetInteger(
450 prefs::kDesktopNotificationDefaultContentSetting, 450 prefs::kDesktopNotificationDefaultContentSetting,
451 setting == CONTENT_SETTING_DEFAULT ? kDefaultSetting : setting); 451 setting == CONTENT_SETTING_DEFAULT ? kDefaultSetting : setting);
452 // The cache is updated through the notification observer. 452 // The cache is updated through the notification observer.
453 } 453 }
454 454
455 bool DesktopNotificationService::IsDefaultContentSettingManaged() const {
456 return profile_->GetPrefs()->IsManagedPreference(
457 prefs::kDesktopNotificationDefaultContentSetting);
458 }
459
455 void DesktopNotificationService::ResetToDefaultContentSetting() { 460 void DesktopNotificationService::ResetToDefaultContentSetting() {
456 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 461 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
457 462
458 PrefService* prefs = profile_->GetPrefs(); 463 PrefService* prefs = profile_->GetPrefs();
459 prefs->ClearPref(prefs::kDesktopNotificationDefaultContentSetting); 464 prefs->ClearPref(prefs::kDesktopNotificationDefaultContentSetting);
460 } 465 }
461 466
462 std::vector<GURL> DesktopNotificationService::GetAllowedOrigins() { 467 std::vector<GURL> DesktopNotificationService::GetAllowedOrigins() {
463 std::vector<GURL> allowed_origins; 468 std::vector<GURL> allowed_origins;
464 PrefService* prefs = profile_->GetPrefs(); 469 PrefService* prefs = profile_->GetPrefs();
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 } 629 }
625 return UTF8ToUTF16(origin.host()); 630 return UTF8ToUTF16(origin.host());
626 } 631 }
627 632
628 void DesktopNotificationService::NotifySettingsChange() { 633 void DesktopNotificationService::NotifySettingsChange() {
629 NotificationService::current()->Notify( 634 NotificationService::current()->Notify(
630 NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED, 635 NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED,
631 Source<DesktopNotificationService>(this), 636 Source<DesktopNotificationService>(this),
632 NotificationService::NoDetails()); 637 NotificationService::NoDetails());
633 } 638 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/desktop_notification_service.h ('k') | chrome/browser/policy/configuration_policy_pref_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698