| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/automatic_profile_resetter_delegate.h" | 5 #include "chrome/browser/profile_resetter/automatic_profile_resetter_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/md5.h" | 13 #include "base/md5.h" |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "chrome/app/chrome_command_ids.h" | 18 #include "chrome/app/chrome_command_ids.h" |
| 19 #include "chrome/browser/chrome_notification_types.h" | 19 #include "chrome/browser/chrome_notification_types.h" |
| 20 #include "chrome/browser/google/google_util.h" | 20 #include "chrome/browser/google/google_brand.h" |
| 21 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" | 21 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" |
| 22 #include "chrome/browser/profile_resetter/profile_reset_global_error.h" | 22 #include "chrome/browser/profile_resetter/profile_reset_global_error.h" |
| 23 #include "chrome/browser/profile_resetter/profile_resetter.h" | 23 #include "chrome/browser/profile_resetter/profile_resetter.h" |
| 24 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" | 24 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 26 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
| 27 #include "chrome/browser/search_engines/template_url_service.h" | 27 #include "chrome/browser/search_engines/template_url_service.h" |
| 28 #include "chrome/browser/search_engines/template_url_service_factory.h" | 28 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 29 #include "chrome/browser/ui/browser.h" | 29 #include "chrome/browser/ui/browser.h" |
| 30 #include "chrome/browser/ui/browser_finder.h" | 30 #include "chrome/browser/ui/browser_finder.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 template_url_service_ready_event_.Post(FROM_HERE, ready_callback); | 186 template_url_service_ready_event_.Post(FROM_HERE, ready_callback); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void AutomaticProfileResetterDelegateImpl:: | 189 void AutomaticProfileResetterDelegateImpl:: |
| 190 FetchBrandcodedDefaultSettingsIfNeeded() { | 190 FetchBrandcodedDefaultSettingsIfNeeded() { |
| 191 if (brandcoded_config_fetcher_ || | 191 if (brandcoded_config_fetcher_ || |
| 192 brandcoded_defaults_fetched_event_.is_signaled()) | 192 brandcoded_defaults_fetched_event_.is_signaled()) |
| 193 return; | 193 return; |
| 194 | 194 |
| 195 std::string brandcode; | 195 std::string brandcode; |
| 196 google_util::GetBrand(&brandcode); | 196 google_brand::GetBrand(&brandcode); |
| 197 if (brandcode.empty()) { | 197 if (brandcode.empty()) { |
| 198 brandcoded_defaults_.reset(new BrandcodedDefaultSettings); | 198 brandcoded_defaults_.reset(new BrandcodedDefaultSettings); |
| 199 brandcoded_defaults_fetched_event_.Signal(); | 199 brandcoded_defaults_fetched_event_.Signal(); |
| 200 } else { | 200 } else { |
| 201 brandcoded_config_fetcher_.reset(new BrandcodeConfigFetcher( | 201 brandcoded_config_fetcher_.reset(new BrandcodeConfigFetcher( |
| 202 base::Bind( | 202 base::Bind( |
| 203 &AutomaticProfileResetterDelegateImpl::OnBrandcodedDefaultsFetched, | 203 &AutomaticProfileResetterDelegateImpl::OnBrandcodedDefaultsFetched, |
| 204 base::Unretained(this)), | 204 base::Unretained(this)), |
| 205 GURL("https://tools.google.com/service/update2"), | 205 GURL("https://tools.google.com/service/update2"), |
| 206 brandcode)); | 206 brandcode)); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 if (difference) { | 388 if (difference) { |
| 389 old_settings_snapshot->Subtract(new_settings_snapshot); | 389 old_settings_snapshot->Subtract(new_settings_snapshot); |
| 390 std::string report = | 390 std::string report = |
| 391 SerializeSettingsReport(*old_settings_snapshot, difference); | 391 SerializeSettingsReport(*old_settings_snapshot, difference); |
| 392 SendFeedback(report); | 392 SendFeedback(report); |
| 393 } | 393 } |
| 394 } | 394 } |
| 395 content::BrowserThread::PostTask( | 395 content::BrowserThread::PostTask( |
| 396 content::BrowserThread::UI, FROM_HERE, user_callback); | 396 content::BrowserThread::UI, FROM_HERE, user_callback); |
| 397 } | 397 } |
| OLD | NEW |