| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/synchronization/cancellation_flag.h" | 13 #include "base/synchronization/cancellation_flag.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 15 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 16 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 16 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 17 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 17 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 18 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 18 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 19 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
| 20 #include "chrome/browser/google/google_url_tracker_factory.h" | |
| 21 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" | 20 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/search_engines/template_url_service_factory.h" | 22 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 24 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 25 #include "chrome/browser/ui/browser_list.h" | 24 #include "chrome/browser/ui/browser_list.h" |
| 26 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 25 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 27 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/installer/util/browser_distribution.h" | 27 #include "chrome/installer/util/browser_distribution.h" |
| 29 #include "components/content_settings/core/browser/content_settings_info.h" | 28 #include "components/content_settings/core/browser/content_settings_info.h" |
| 30 #include "components/content_settings/core/browser/content_settings_registry.h" | 29 #include "components/content_settings/core/browser/content_settings_registry.h" |
| 31 #include "components/content_settings/core/browser/host_content_settings_map.h" | 30 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 32 #include "components/content_settings/core/browser/website_settings_info.h" | 31 #include "components/content_settings/core/browser/website_settings_info.h" |
| 33 #include "components/content_settings/core/browser/website_settings_registry.h" | 32 #include "components/content_settings/core/browser/website_settings_registry.h" |
| 34 #include "components/google/core/browser/google_url_tracker.h" | |
| 35 #include "components/prefs/pref_service.h" | 33 #include "components/prefs/pref_service.h" |
| 36 #include "components/prefs/scoped_user_pref_update.h" | 34 #include "components/prefs/scoped_user_pref_update.h" |
| 37 #include "components/search_engines/search_engines_pref_names.h" | 35 #include "components/search_engines/search_engines_pref_names.h" |
| 38 #include "components/search_engines/template_url_prepopulate_data.h" | 36 #include "components/search_engines/template_url_prepopulate_data.h" |
| 39 #include "components/search_engines/template_url_service.h" | 37 #include "components/search_engines/template_url_service.h" |
| 40 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
| 41 #include "extensions/browser/extension_registry.h" | 39 #include "extensions/browser/extension_registry.h" |
| 42 #include "extensions/browser/extension_system.h" | 40 #include "extensions/browser/extension_system.h" |
| 43 #include "extensions/browser/management_policy.h" | 41 #include "extensions/browser/management_policy.h" |
| 44 #include "extensions/common/extension_id.h" | 42 #include "extensions/common/extension_id.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 master_settings_->GetSearchProviderOverrides()); | 173 master_settings_->GetSearchProviderOverrides()); |
| 176 if (search_engines) { | 174 if (search_engines) { |
| 177 // This Chrome distribution channel provides a custom search engine. We | 175 // This Chrome distribution channel provides a custom search engine. We |
| 178 // must reset to it. | 176 // must reset to it. |
| 179 ListPrefUpdate update(prefs, prefs::kSearchProviderOverrides); | 177 ListPrefUpdate update(prefs, prefs::kSearchProviderOverrides); |
| 180 update->Swap(search_engines.get()); | 178 update->Swap(search_engines.get()); |
| 181 } | 179 } |
| 182 | 180 |
| 183 template_url_service_->RepairPrepopulatedSearchEngines(); | 181 template_url_service_->RepairPrepopulatedSearchEngines(); |
| 184 | 182 |
| 185 // Reset Google search URL. | |
| 186 const TemplateURL* default_search_provider = | |
| 187 template_url_service_->GetDefaultSearchProvider(); | |
| 188 if (default_search_provider && | |
| 189 default_search_provider->HasGoogleBaseURLs( | |
| 190 template_url_service_->search_terms_data())) { | |
| 191 GoogleURLTracker* tracker = | |
| 192 GoogleURLTrackerFactory::GetForProfile(profile_); | |
| 193 if (tracker) | |
| 194 tracker->RequestServerCheck(true); | |
| 195 } | |
| 196 | |
| 197 MarkAsDone(DEFAULT_SEARCH_ENGINE); | 183 MarkAsDone(DEFAULT_SEARCH_ENGINE); |
| 198 } else { | 184 } else { |
| 199 template_url_service_sub_ = | 185 template_url_service_sub_ = |
| 200 template_url_service_->RegisterOnLoadedCallback( | 186 template_url_service_->RegisterOnLoadedCallback( |
| 201 base::Bind(&ProfileResetter::OnTemplateURLServiceLoaded, | 187 base::Bind(&ProfileResetter::OnTemplateURLServiceLoaded, |
| 202 weak_ptr_factory_.GetWeakPtr())); | 188 weak_ptr_factory_.GetWeakPtr())); |
| 203 template_url_service_->Load(); | 189 template_url_service_->Load(); |
| 204 } | 190 } |
| 205 } | 191 } |
| 206 | 192 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 chrome_exe, | 367 chrome_exe, |
| 382 false, | 368 false, |
| 383 cancel, | 369 cancel, |
| 384 &shortcuts); | 370 &shortcuts); |
| 385 } | 371 } |
| 386 return shortcuts; | 372 return shortcuts; |
| 387 #else | 373 #else |
| 388 return std::vector<ShortcutCommand>(); | 374 return std::vector<ShortcutCommand>(); |
| 389 #endif | 375 #endif |
| 390 } | 376 } |
| OLD | NEW |