| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <cstddef> | 7 #include <cstddef> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 using syncer::JsController; | 116 using syncer::JsController; |
| 117 using syncer::JsEventDetails; | 117 using syncer::JsEventDetails; |
| 118 using syncer::JsEventHandler; | 118 using syncer::JsEventHandler; |
| 119 using syncer::ModelSafeRoutingInfo; | 119 using syncer::ModelSafeRoutingInfo; |
| 120 using syncer::SyncCredentials; | 120 using syncer::SyncCredentials; |
| 121 using syncer::SyncProtocolError; | 121 using syncer::SyncProtocolError; |
| 122 using syncer::WeakHandle; | 122 using syncer::WeakHandle; |
| 123 | 123 |
| 124 typedef GoogleServiceAuthError AuthError; | 124 typedef GoogleServiceAuthError AuthError; |
| 125 | 125 |
| 126 const char* ProfileSyncService::kSyncServerUrl = | 126 const char ProfileSyncService::kSyncServerUrl[] = |
| 127 "https://clients4.google.com/chrome-sync"; | 127 "https://clients4.google.com/chrome-sync"; |
| 128 | 128 |
| 129 const char* ProfileSyncService::kDevServerUrl = | 129 const char ProfileSyncService::kDevServerUrl[] = |
| 130 "https://clients4.google.com/chrome-sync/dev"; | 130 "https://clients4.google.com/chrome-sync/dev"; |
| 131 | 131 |
| 132 const char kSyncUnrecoverableErrorHistogram[] = | 132 const char kSyncUnrecoverableErrorHistogram[] = |
| 133 "Sync.UnrecoverableErrors"; | 133 "Sync.UnrecoverableErrors"; |
| 134 | 134 |
| 135 const net::BackoffEntry::Policy kRequestAccessTokenBackoffPolicy = { | 135 const net::BackoffEntry::Policy kRequestAccessTokenBackoffPolicy = { |
| 136 // Number of initial errors (in sequence) to ignore before applying | 136 // Number of initial errors (in sequence) to ignore before applying |
| 137 // exponential back-off rules. | 137 // exponential back-off rules. |
| 138 0, | 138 0, |
| 139 | 139 |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 FOR_EACH_OBSERVER(ProfileSyncServiceBase::Observer, observers_, | 923 FOR_EACH_OBSERVER(ProfileSyncServiceBase::Observer, observers_, |
| 924 OnSyncCycleCompleted()); | 924 OnSyncCycleCompleted()); |
| 925 } | 925 } |
| 926 | 926 |
| 927 void ProfileSyncService::ClearStaleErrors() { | 927 void ProfileSyncService::ClearStaleErrors() { |
| 928 ClearUnrecoverableError(); | 928 ClearUnrecoverableError(); |
| 929 last_actionable_error_ = SyncProtocolError(); | 929 last_actionable_error_ = SyncProtocolError(); |
| 930 // Clear the data type errors as well. | 930 // Clear the data type errors as well. |
| 931 if (directory_data_type_manager_.get()) | 931 if (directory_data_type_manager_.get()) |
| 932 directory_data_type_manager_->ResetDataTypeErrors(); | 932 directory_data_type_manager_->ResetDataTypeErrors(); |
| 933 | |
| 934 } | 933 } |
| 935 | 934 |
| 936 void ProfileSyncService::ClearUnrecoverableError() { | 935 void ProfileSyncService::ClearUnrecoverableError() { |
| 937 unrecoverable_error_reason_ = ERROR_REASON_UNSET; | 936 unrecoverable_error_reason_ = ERROR_REASON_UNSET; |
| 938 unrecoverable_error_message_.clear(); | 937 unrecoverable_error_message_.clear(); |
| 939 unrecoverable_error_location_ = tracked_objects::Location(); | 938 unrecoverable_error_location_ = tracked_objects::Location(); |
| 940 } | 939 } |
| 941 | 940 |
| 942 void ProfileSyncService::RegisterNewDataType(syncer::ModelType data_type) { | 941 void ProfileSyncService::RegisterNewDataType(syncer::ModelType data_type) { |
| 943 if (directory_data_type_controllers_.count(data_type) > 0) | 942 if (directory_data_type_controllers_.count(data_type) > 0) |
| (...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); | 2022 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); |
| 2024 it != routing_info.end(); ++it) { | 2023 it != routing_info.end(); ++it) { |
| 2025 if (it->second == syncer::GROUP_PASSIVE) { | 2024 if (it->second == syncer::GROUP_PASSIVE) { |
| 2026 passive_types.Put(it->first); | 2025 passive_types.Put(it->first); |
| 2027 } else { | 2026 } else { |
| 2028 active_types.Put(it->first); | 2027 active_types.Put(it->first); |
| 2029 } | 2028 } |
| 2030 } | 2029 } |
| 2031 | 2030 |
| 2032 SyncBackendHost::Status detailed_status = backend_->GetDetailedStatus(); | 2031 SyncBackendHost::Status detailed_status = backend_->GetDetailedStatus(); |
| 2033 ModelTypeSet &throttled_types(detailed_status.throttled_types); | 2032 ModelTypeSet& throttled_types(detailed_status.throttled_types); |
| 2034 ModelTypeSet registered = GetRegisteredDataTypes(); | 2033 ModelTypeSet registered = GetRegisteredDataTypes(); |
| 2035 scoped_ptr<base::DictionaryValue> type_status_header( | 2034 scoped_ptr<base::DictionaryValue> type_status_header( |
| 2036 new base::DictionaryValue()); | 2035 new base::DictionaryValue()); |
| 2037 | 2036 |
| 2038 type_status_header->SetString("name", "Model Type"); | 2037 type_status_header->SetString("name", "Model Type"); |
| 2039 type_status_header->SetString("status", "header"); | 2038 type_status_header->SetString("status", "header"); |
| 2040 type_status_header->SetString("value", "Group Type"); | 2039 type_status_header->SetString("value", "Group Type"); |
| 2041 type_status_header->SetString("num_entries", "Total Entries"); | 2040 type_status_header->SetString("num_entries", "Total Entries"); |
| 2042 type_status_header->SetString("num_live", "Live Entries"); | 2041 type_status_header->SetString("num_live", "Live Entries"); |
| 2043 result->Append(type_status_header.release()); | 2042 result->Append(type_status_header.release()); |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2744 | 2743 |
| 2745 base::MessageLoop* ProfileSyncService::GetSyncLoopForTest() const { | 2744 base::MessageLoop* ProfileSyncService::GetSyncLoopForTest() const { |
| 2746 if (sync_thread_) { | 2745 if (sync_thread_) { |
| 2747 return sync_thread_->message_loop(); | 2746 return sync_thread_->message_loop(); |
| 2748 } else if (backend_) { | 2747 } else if (backend_) { |
| 2749 return backend_->GetSyncLoopForTesting(); | 2748 return backend_->GetSyncLoopForTesting(); |
| 2750 } else { | 2749 } else { |
| 2751 return NULL; | 2750 return NULL; |
| 2752 } | 2751 } |
| 2753 } | 2752 } |
| OLD | NEW |