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

Side by Side Diff: chrome/browser/ui/options/options_util.cc

Issue 6803012: Profile shouldn't own DesktopNotificationService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/options/options_util.h" 5 #include "chrome/browser/ui/options/options_util.h"
6 6
7 #include "base/threading/thread_restrictions.h" 7 #include "base/threading/thread_restrictions.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/content_settings/host_content_settings_map.h" 9 #include "chrome/browser/content_settings/host_content_settings_map.h"
10 #include "chrome/browser/download/download_manager.h" 10 #include "chrome/browser/download/download_manager.h"
11 #include "chrome/browser/download/download_prefs.h" 11 #include "chrome/browser/download/download_prefs.h"
12 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" 12 #include "chrome/browser/geolocation/geolocation_content_settings_map.h"
13 #include "chrome/browser/metrics/metrics_service.h" 13 #include "chrome/browser/metrics/metrics_service.h"
14 #include "chrome/browser/notifications/desktop_notification_service.h" 14 #include "chrome/browser/notifications/desktop_notification_service.h"
15 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
15 #include "chrome/browser/prefs/pref_service.h" 16 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
18 #include "chrome/installer/util/google_update_settings.h" 19 #include "chrome/installer/util/google_update_settings.h"
19 #include "content/browser/host_zoom_map.h" 20 #include "content/browser/host_zoom_map.h"
20 21
21 // static 22 // static
22 void OptionsUtil::ResetToDefaults(Profile* profile) { 23 void OptionsUtil::ResetToDefaults(Profile* profile) {
23 // TODO(tc): It would be nice if we could generate this list automatically so 24 // TODO(tc): It would be nice if we could generate this list automatically so
24 // changes to any of the options pages doesn't require updating this list 25 // changes to any of the options pages doesn't require updating this list
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 prefs::kWebKitSansSerifFontFamily, 77 prefs::kWebKitSansSerifFontFamily,
77 prefs::kWebKitSerifFontFamily, 78 prefs::kWebKitSerifFontFamily,
78 prefs::kWebKitMinimumFontSize, 79 prefs::kWebKitMinimumFontSize,
79 prefs::kWebKitMinimumLogicalFontSize, 80 prefs::kWebKitMinimumLogicalFontSize,
80 prefs::kWebkitTabsToLinks, 81 prefs::kWebkitTabsToLinks,
81 }; 82 };
82 profile->GetDownloadManager()->download_prefs()->ResetToDefaults(); 83 profile->GetDownloadManager()->download_prefs()->ResetToDefaults();
83 profile->GetHostContentSettingsMap()->ResetToDefaults(); 84 profile->GetHostContentSettingsMap()->ResetToDefaults();
84 profile->GetGeolocationContentSettingsMap()->ResetToDefault(); 85 profile->GetGeolocationContentSettingsMap()->ResetToDefault();
85 profile->GetHostZoomMap()->ResetToDefaults(); 86 profile->GetHostZoomMap()->ResetToDefaults();
86 profile->GetDesktopNotificationService()->ResetToDefaultContentSetting(); 87 DesktopNotificationServiceFactory::GetForProfile(profile)->
88 ResetToDefaultContentSetting();
87 for (size_t i = 0; i < arraysize(kUserPrefs); ++i) 89 for (size_t i = 0; i < arraysize(kUserPrefs); ++i)
88 prefs->ClearPref(kUserPrefs[i]); 90 prefs->ClearPref(kUserPrefs[i]);
89 91
90 PrefService* local_state = g_browser_process->local_state(); 92 PrefService* local_state = g_browser_process->local_state();
91 // Note that we don't reset the kMetricsReportingEnabled preference here 93 // Note that we don't reset the kMetricsReportingEnabled preference here
92 // because the reset will reset it to the default setting specified in Chrome 94 // because the reset will reset it to the default setting specified in Chrome
93 // source, not the default setting selected by the user on the web page where 95 // source, not the default setting selected by the user on the web page where
94 // they downloaded Chrome. This means that if the user ever resets their 96 // they downloaded Chrome. This means that if the user ever resets their
95 // settings they'll either inadvertedly enable this logging or disable it. 97 // settings they'll either inadvertedly enable this logging or disable it.
96 // One is undesirable for them, one is undesirable for us. For now, we just 98 // One is undesirable for them, one is undesirable for us. For now, we just
(...skipping 30 matching lines...) Expand all
127 if (metrics) { 129 if (metrics) {
128 metrics->SetUserPermitsUpload(enabled); 130 metrics->SetUserPermitsUpload(enabled);
129 if (enabled) 131 if (enabled)
130 metrics->Start(); 132 metrics->Start();
131 else 133 else
132 metrics->Stop(); 134 metrics->Stop();
133 } 135 }
134 136
135 return enabled; 137 return enabled;
136 } 138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698