| OLD | NEW |
| 1 // Copyright (c) 2010 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/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/stl_util-inl.h" | 16 #include "base/stl_util-inl.h" |
| 17 #include "base/string16.h" | 17 #include "base/string16.h" |
| 18 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
| 19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 20 #include "base/task.h" | 20 #include "base/task.h" |
| 21 #include "base/threading/thread_restrictions.h" |
| 21 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
| 22 #include "chrome/browser/browser_signin.h" | 23 #include "chrome/browser/browser_signin.h" |
| 23 #include "chrome/browser/history/history_types.h" | 24 #include "chrome/browser/history/history_types.h" |
| 24 #include "chrome/browser/platform_util.h" | 25 #include "chrome/browser/platform_util.h" |
| 25 #include "chrome/browser/prefs/pref_service.h" | 26 #include "chrome/browser/prefs/pref_service.h" |
| 26 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
| 27 #include "chrome/browser/net/gaia/token_service.h" | 28 #include "chrome/browser/net/gaia/token_service.h" |
| 28 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" | 29 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" |
| 29 #include "chrome/browser/sync/glue/change_processor.h" | 30 #include "chrome/browser/sync/glue/change_processor.h" |
| 30 #include "chrome/browser/sync/glue/data_type_controller.h" | 31 #include "chrome/browser/sync/glue/data_type_controller.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 DCHECK(factory); | 85 DCHECK(factory); |
| 85 DCHECK(profile); | 86 DCHECK(profile); |
| 86 registrar_.Add(this, | 87 registrar_.Add(this, |
| 87 NotificationType::SYNC_DATA_TYPES_UPDATED, | 88 NotificationType::SYNC_DATA_TYPES_UPDATED, |
| 88 Source<Profile>(profile)); | 89 Source<Profile>(profile)); |
| 89 | 90 |
| 90 // By default, dev & chromium users will go to the development servers. | 91 // By default, dev & chromium users will go to the development servers. |
| 91 // Dev servers have more features than standard sync servers. | 92 // Dev servers have more features than standard sync servers. |
| 92 // Chrome stable and beta builds will go to the standard sync servers. | 93 // Chrome stable and beta builds will go to the standard sync servers. |
| 93 #if defined(GOOGLE_CHROME_BUILD) | 94 #if defined(GOOGLE_CHROME_BUILD) |
| 95 // GetVersionStringModifier hits the registry. See http://crbug.com/70380. |
| 96 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 94 // For stable, this is "". For dev, this is "dev". For beta, this is "beta". | 97 // For stable, this is "". For dev, this is "dev". For beta, this is "beta". |
| 95 // For daily, this is "canary build". | 98 // For daily, this is "canary build". |
| 96 // For linux Chromium builds, this could be anything depending on the | 99 // For Linux Chromium builds, this could be anything depending on the |
| 97 // distribution, so always direct those users to dev server urls. | 100 // distribution, so always direct those users to dev server urls. |
| 98 // If this is an official build, it will always be one of the above. | 101 // If this is an official build, it will always be one of the above. |
| 99 std::string channel = platform_util::GetVersionStringModifier(); | 102 std::string channel = platform_util::GetVersionStringModifier(); |
| 100 if (channel.empty() || channel == "beta") { | 103 if (channel.empty() || channel == "beta") { |
| 101 sync_service_url_ = GURL(kSyncServerUrl); | 104 sync_service_url_ = GURL(kSyncServerUrl); |
| 102 } | 105 } |
| 103 #endif | 106 #endif |
| 104 | 107 |
| 105 tried_implicit_gaia_remove_when_bug_62103_fixed_ = false; | 108 tried_implicit_gaia_remove_when_bug_62103_fixed_ = false; |
| 106 } | 109 } |
| (...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 // is initialized, all enabled data types are consistent with one | 1227 // is initialized, all enabled data types are consistent with one |
| 1225 // another, and no unrecoverable error has transpired. | 1228 // another, and no unrecoverable error has transpired. |
| 1226 if (unrecoverable_error_detected_) | 1229 if (unrecoverable_error_detected_) |
| 1227 return false; | 1230 return false; |
| 1228 | 1231 |
| 1229 if (!data_type_manager_.get()) | 1232 if (!data_type_manager_.get()) |
| 1230 return false; | 1233 return false; |
| 1231 | 1234 |
| 1232 return data_type_manager_->state() == DataTypeManager::CONFIGURED; | 1235 return data_type_manager_->state() == DataTypeManager::CONFIGURED; |
| 1233 } | 1236 } |
| OLD | NEW |