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 <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 #include "components/signin/core/browser/signin_manager.h" | 62 #include "components/signin/core/browser/signin_manager.h" |
63 #include "components/sync_driver/change_processor.h" | 63 #include "components/sync_driver/change_processor.h" |
64 #include "components/sync_driver/data_type_controller.h" | 64 #include "components/sync_driver/data_type_controller.h" |
65 #include "components/sync_driver/pref_names.h" | 65 #include "components/sync_driver/pref_names.h" |
66 #include "components/sync_driver/system_encryptor.h" | 66 #include "components/sync_driver/system_encryptor.h" |
67 #include "components/sync_driver/user_selectable_sync_type.h" | 67 #include "components/sync_driver/user_selectable_sync_type.h" |
68 #include "components/user_prefs/pref_registry_syncable.h" | 68 #include "components/user_prefs/pref_registry_syncable.h" |
69 #include "content/public/browser/notification_details.h" | 69 #include "content/public/browser/notification_details.h" |
70 #include "content/public/browser/notification_service.h" | 70 #include "content/public/browser/notification_service.h" |
71 #include "content/public/browser/notification_source.h" | 71 #include "content/public/browser/notification_source.h" |
72 #include "google_apis/gaia/gaia_constants.h" | |
73 #include "grit/generated_resources.h" | 72 #include "grit/generated_resources.h" |
74 #include "net/cookies/cookie_monster.h" | 73 #include "net/cookies/cookie_monster.h" |
75 #include "net/url_request/url_request_context_getter.h" | 74 #include "net/url_request/url_request_context_getter.h" |
76 #include "sync/api/sync_error.h" | 75 #include "sync/api/sync_error.h" |
77 #include "sync/internal_api/public/configure_reason.h" | 76 #include "sync/internal_api/public/configure_reason.h" |
78 #include "sync/internal_api/public/http_bridge_network_resources.h" | 77 #include "sync/internal_api/public/http_bridge_network_resources.h" |
79 #include "sync/internal_api/public/network_resources.h" | 78 #include "sync/internal_api/public/network_resources.h" |
80 #include "sync/internal_api/public/sessions/type_debug_info_observer.h" | 79 #include "sync/internal_api/public/sessions/type_debug_info_observer.h" |
81 #include "sync/internal_api/public/sync_core_proxy.h" | 80 #include "sync/internal_api/public/sync_core_proxy.h" |
82 #include "sync/internal_api/public/sync_encryption_handler.h" | 81 #include "sync/internal_api/public/sync_encryption_handler.h" |
83 #include "sync/internal_api/public/util/experiments.h" | 82 #include "sync/internal_api/public/util/experiments.h" |
84 #include "sync/internal_api/public/util/sync_string_conversions.h" | 83 #include "sync/internal_api/public/util/sync_string_conversions.h" |
85 #include "sync/js/js_event_details.h" | 84 #include "sync/js/js_event_details.h" |
86 #include "sync/util/cryptographer.h" | 85 #include "sync/util/cryptographer.h" |
87 #include "ui/base/l10n/l10n_util.h" | 86 #include "ui/base/l10n/l10n_util.h" |
88 #include "ui/base/l10n/time_format.h" | 87 #include "ui/base/l10n/time_format.h" |
89 | 88 |
90 #if defined(ENABLE_MANAGED_USERS) | |
91 #include "chrome/browser/managed_mode/managed_user_constants.h" | |
92 #endif | |
93 | |
94 #if defined(OS_ANDROID) | 89 #if defined(OS_ANDROID) |
95 #include "sync/internal_api/public/read_transaction.h" | 90 #include "sync/internal_api/public/read_transaction.h" |
96 #endif | 91 #endif |
97 | 92 |
98 using browser_sync::ChangeProcessor; | 93 using browser_sync::ChangeProcessor; |
99 using browser_sync::DataTypeController; | 94 using browser_sync::DataTypeController; |
100 using browser_sync::DataTypeManager; | 95 using browser_sync::DataTypeManager; |
101 using browser_sync::FailedDataTypesHandler; | 96 using browser_sync::FailedDataTypesHandler; |
102 using browser_sync::NotificationServiceSessionsRouter; | 97 using browser_sync::NotificationServiceSessionsRouter; |
103 using browser_sync::ProfileSyncServiceStartBehavior; | 98 using browser_sync::ProfileSyncServiceStartBehavior; |
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1969 if (!IsUsingSecondaryPassphrase()) | 1964 if (!IsUsingSecondaryPassphrase()) |
1970 SetEncryptionPassphrase(passphrase, IMPLICIT); | 1965 SetEncryptionPassphrase(passphrase, IMPLICIT); |
1971 } | 1966 } |
1972 | 1967 |
1973 void ProfileSyncService::RequestAccessToken() { | 1968 void ProfileSyncService::RequestAccessToken() { |
1974 // Only one active request at a time. | 1969 // Only one active request at a time. |
1975 if (access_token_request_ != NULL) | 1970 if (access_token_request_ != NULL) |
1976 return; | 1971 return; |
1977 request_access_token_retry_timer_.Stop(); | 1972 request_access_token_retry_timer_.Stop(); |
1978 OAuth2TokenService::ScopeSet oauth2_scopes; | 1973 OAuth2TokenService::ScopeSet oauth2_scopes; |
1979 if (profile_->IsManaged()) { | 1974 oauth2_scopes.insert(signin_->GetSyncScopeToUse()); |
1980 oauth2_scopes.insert(GaiaConstants::kChromeSyncManagedOAuth2Scope); | |
1981 } else { | |
1982 oauth2_scopes.insert(GaiaConstants::kChromeSyncOAuth2Scope); | |
1983 } | |
1984 | 1975 |
1985 // Invalidate previous token, otherwise token service will return the same | 1976 // Invalidate previous token, otherwise token service will return the same |
1986 // token again. | 1977 // token again. |
1987 const std::string& account_id = signin_->GetAccountIdToUse(); | 1978 const std::string& account_id = signin_->GetAccountIdToUse(); |
1988 if (!access_token_.empty()) { | 1979 if (!access_token_.empty()) { |
1989 oauth2_token_service_->InvalidateToken( | 1980 oauth2_token_service_->InvalidateToken( |
1990 account_id, oauth2_scopes, access_token_); | 1981 account_id, oauth2_scopes, access_token_); |
1991 } | 1982 } |
1992 | 1983 |
1993 access_token_.clear(); | 1984 access_token_.clear(); |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 status.last_get_token_error = last_get_token_error_; | 2365 status.last_get_token_error = last_get_token_error_; |
2375 if (request_access_token_retry_timer_.IsRunning()) | 2366 if (request_access_token_retry_timer_.IsRunning()) |
2376 status.next_token_request_time = next_token_request_time_; | 2367 status.next_token_request_time = next_token_request_time_; |
2377 return status; | 2368 return status; |
2378 } | 2369 } |
2379 | 2370 |
2380 void ProfileSyncService::OverrideNetworkResourcesForTest( | 2371 void ProfileSyncService::OverrideNetworkResourcesForTest( |
2381 scoped_ptr<syncer::NetworkResources> network_resources) { | 2372 scoped_ptr<syncer::NetworkResources> network_resources) { |
2382 network_resources_ = network_resources.Pass(); | 2373 network_resources_ = network_resources.Pass(); |
2383 } | 2374 } |
OLD | NEW |