| 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_brand.h" |
| 20 #include "chrome/browser/google/google_util.h" | 21 #include "chrome/browser/google/google_util.h" |
| 21 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" | 22 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" |
| 22 #include "chrome/browser/profile_resetter/profile_reset_global_error.h" | 23 #include "chrome/browser/profile_resetter/profile_reset_global_error.h" |
| 23 #include "chrome/browser/profile_resetter/profile_resetter.h" | 24 #include "chrome/browser/profile_resetter/profile_resetter.h" |
| 24 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" | 25 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 27 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
| 27 #include "chrome/browser/search_engines/template_url_service.h" | 28 #include "chrome/browser/search_engines/template_url_service.h" |
| 28 #include "chrome/browser/search_engines/template_url_service_factory.h" | 29 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 29 #include "chrome/browser/ui/browser.h" | 30 #include "chrome/browser/ui/browser.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 template_url_service_ready_event_.Post(FROM_HERE, ready_callback); | 187 template_url_service_ready_event_.Post(FROM_HERE, ready_callback); |
| 187 } | 188 } |
| 188 | 189 |
| 189 void AutomaticProfileResetterDelegateImpl:: | 190 void AutomaticProfileResetterDelegateImpl:: |
| 190 FetchBrandcodedDefaultSettingsIfNeeded() { | 191 FetchBrandcodedDefaultSettingsIfNeeded() { |
| 191 if (brandcoded_config_fetcher_ || | 192 if (brandcoded_config_fetcher_ || |
| 192 brandcoded_defaults_fetched_event_.is_signaled()) | 193 brandcoded_defaults_fetched_event_.is_signaled()) |
| 193 return; | 194 return; |
| 194 | 195 |
| 195 std::string brandcode; | 196 std::string brandcode; |
| 196 google_util::GetBrand(&brandcode); | 197 google_brand::GetBrand(&brandcode); |
| 197 if (brandcode.empty()) { | 198 if (brandcode.empty()) { |
| 198 brandcoded_defaults_.reset(new BrandcodedDefaultSettings); | 199 brandcoded_defaults_.reset(new BrandcodedDefaultSettings); |
| 199 brandcoded_defaults_fetched_event_.Signal(); | 200 brandcoded_defaults_fetched_event_.Signal(); |
| 200 } else { | 201 } else { |
| 201 brandcoded_config_fetcher_.reset(new BrandcodeConfigFetcher( | 202 brandcoded_config_fetcher_.reset(new BrandcodeConfigFetcher( |
| 202 base::Bind( | 203 base::Bind( |
| 203 &AutomaticProfileResetterDelegateImpl::OnBrandcodedDefaultsFetched, | 204 &AutomaticProfileResetterDelegateImpl::OnBrandcodedDefaultsFetched, |
| 204 base::Unretained(this)), | 205 base::Unretained(this)), |
| 205 GURL("https://tools.google.com/service/update2"), | 206 GURL("https://tools.google.com/service/update2"), |
| 206 brandcode)); | 207 brandcode)); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 if (difference) { | 389 if (difference) { |
| 389 old_settings_snapshot->Subtract(new_settings_snapshot); | 390 old_settings_snapshot->Subtract(new_settings_snapshot); |
| 390 std::string report = | 391 std::string report = |
| 391 SerializeSettingsReport(*old_settings_snapshot, difference); | 392 SerializeSettingsReport(*old_settings_snapshot, difference); |
| 392 SendFeedback(report); | 393 SendFeedback(report); |
| 393 } | 394 } |
| 394 } | 395 } |
| 395 content::BrowserThread::PostTask( | 396 content::BrowserThread::PostTask( |
| 396 content::BrowserThread::UI, FROM_HERE, user_callback); | 397 content::BrowserThread::UI, FROM_HERE, user_callback); |
| 397 } | 398 } |
| OLD | NEW |