| 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/profile_resetter/profile_resetter.h" | 5 #include "chrome/browser/profile_resetter/profile_resetter.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
| 11 #include "base/synchronization/cancellation_flag.h" | 11 #include "base/synchronization/cancellation_flag.h" |
| 12 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 12 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 13 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/google/google_url_tracker_factory.h" | 15 #include "chrome/browser/google/google_url_tracker_factory.h" |
| 15 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" | 16 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/search_engines/template_url_service_factory.h" | 18 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 18 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/browser_iterator.h" | 20 #include "chrome/browser/ui/browser_iterator.h" |
| 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 21 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 22 #include "chrome/installer/util/browser_distribution.h" | 23 #include "chrome/installer/util/browser_distribution.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 if (master_settings_->GetShowHomeButton(&show_home_button)) | 212 if (master_settings_->GetShowHomeButton(&show_home_button)) |
| 212 prefs->SetBoolean(prefs::kShowHomeButton, show_home_button); | 213 prefs->SetBoolean(prefs::kShowHomeButton, show_home_button); |
| 213 else | 214 else |
| 214 prefs->ClearPref(prefs::kShowHomeButton); | 215 prefs->ClearPref(prefs::kShowHomeButton); |
| 215 MarkAsDone(HOMEPAGE); | 216 MarkAsDone(HOMEPAGE); |
| 216 } | 217 } |
| 217 | 218 |
| 218 void ProfileResetter::ResetContentSettings() { | 219 void ProfileResetter::ResetContentSettings() { |
| 219 DCHECK(CalledOnValidThread()); | 220 DCHECK(CalledOnValidThread()); |
| 220 PrefService* prefs = profile_->GetPrefs(); | 221 PrefService* prefs = profile_->GetPrefs(); |
| 221 HostContentSettingsMap* map = profile_->GetHostContentSettingsMap(); | 222 HostContentSettingsMap* map = |
| 223 HostContentSettingsMapFactory::GetForProfile(profile_); |
| 222 | 224 |
| 223 content_settings::WebsiteSettingsRegistry* registry = | 225 content_settings::WebsiteSettingsRegistry* registry = |
| 224 content_settings::WebsiteSettingsRegistry::GetInstance(); | 226 content_settings::WebsiteSettingsRegistry::GetInstance(); |
| 225 for (const content_settings::WebsiteSettingsInfo* info : *registry) { | 227 for (const content_settings::WebsiteSettingsInfo* info : *registry) { |
| 226 map->ClearSettingsForOneType(info->type()); | 228 map->ClearSettingsForOneType(info->type()); |
| 227 if (HostContentSettingsMap::IsSettingAllowedForType( | 229 if (HostContentSettingsMap::IsSettingAllowedForType( |
| 228 prefs, CONTENT_SETTING_DEFAULT, info->type())) { | 230 prefs, CONTENT_SETTING_DEFAULT, info->type())) { |
| 229 // TODO(raymes): Why don't we just set this to | 231 // TODO(raymes): Why don't we just set this to |
| 230 // info->intial_default_value(). | 232 // info->intial_default_value(). |
| 231 map->SetDefaultContentSetting(info->type(), CONTENT_SETTING_DEFAULT); | 233 map->SetDefaultContentSetting(info->type(), CONTENT_SETTING_DEFAULT); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 chrome_exe, | 352 chrome_exe, |
| 351 false, | 353 false, |
| 352 cancel, | 354 cancel, |
| 353 &shortcuts); | 355 &shortcuts); |
| 354 } | 356 } |
| 355 return shortcuts; | 357 return shortcuts; |
| 356 #else | 358 #else |
| 357 return std::vector<ShortcutCommand>(); | 359 return std::vector<ShortcutCommand>(); |
| 358 #endif | 360 #endif |
| 359 } | 361 } |
| OLD | NEW |