OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/signin/easy_unlock_service_regular.h" | 5 #include "chrome/browser/signin/easy_unlock_service_regular.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
11 #include "base/sys_info.h" | 11 #include "base/sys_info.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "base/version.h" | 13 #include "base/version.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
17 #include "chrome/browser/signin/screenlock_bridge.h" | 17 #include "chrome/browser/signin/screenlock_bridge.h" |
18 #include "chrome/browser/signin/signin_manager_factory.h" | 18 #include "chrome/browser/signin/signin_manager_factory.h" |
19 #include "chrome/common/chrome_version_info.h" | 19 #include "chrome/common/chrome_version_info.h" |
20 #include "chrome/common/extensions/api/easy_unlock_private.h" | 20 #include "chrome/common/extensions/api/easy_unlock_private.h" |
21 #include "chrome/common/extensions/extension_constants.h" | 21 #include "chrome/common/extensions/extension_constants.h" |
22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
23 #include "chromeos/login/user_names.h" | 23 #include "chromeos/login/user_names.h" |
24 #include "components/pref_registry/pref_registry_syncable.h" | 24 #include "components/pref_registry/pref_registry_syncable.h" |
25 #include "components/proximity_auth/cryptauth/cryptauth_account_token_fetcher.h" | 25 #include "components/proximity_auth/cryptauth/cryptauth_access_token_fetcher.h" |
26 #include "components/proximity_auth/cryptauth/cryptauth_client.h" | 26 #include "components/proximity_auth/cryptauth/cryptauth_client_impl.h" |
27 #include "components/proximity_auth/cryptauth/cryptauth_client_factory.h" | |
28 #include "components/proximity_auth/switches.h" | 27 #include "components/proximity_auth/switches.h" |
29 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 28 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
30 #include "components/signin/core/browser/signin_manager.h" | 29 #include "components/signin/core/browser/signin_manager.h" |
31 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
32 #include "extensions/browser/event_router.h" | 31 #include "extensions/browser/event_router.h" |
33 #include "extensions/common/constants.h" | 32 #include "extensions/common/constants.h" |
34 | 33 |
35 #if defined(OS_CHROMEOS) | 34 #if defined(OS_CHROMEOS) |
36 #include "apps/app_lifetime_monitor_factory.h" | 35 #include "apps/app_lifetime_monitor_factory.h" |
37 #include "base/thread_task_runner_handle.h" | 36 #include "base/thread_task_runner_handle.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 #endif | 215 #endif |
217 } | 216 } |
218 | 217 |
219 void EasyUnlockServiceRegular::RunTurnOffFlow() { | 218 void EasyUnlockServiceRegular::RunTurnOffFlow() { |
220 if (turn_off_flow_status_ == PENDING) | 219 if (turn_off_flow_status_ == PENDING) |
221 return; | 220 return; |
222 DCHECK(!cryptauth_client_); | 221 DCHECK(!cryptauth_client_); |
223 | 222 |
224 SetTurnOffFlowStatus(PENDING); | 223 SetTurnOffFlowStatus(PENDING); |
225 | 224 |
226 proximity_auth::CryptAuthClientFactory factory( | 225 proximity_auth::CryptAuthClientFactoryImpl factory( |
227 ProfileOAuth2TokenServiceFactory::GetForProfile(profile()), | 226 ProfileOAuth2TokenServiceFactory::GetForProfile(profile()), |
228 SigninManagerFactory::GetForProfile(profile()) | 227 SigninManagerFactory::GetForProfile(profile()) |
229 ->GetAuthenticatedAccountId(), | 228 ->GetAuthenticatedAccountId(), |
230 profile()->GetRequestContext(), GetDeviceClassifier()); | 229 profile()->GetRequestContext(), GetDeviceClassifier()); |
231 cryptauth_client_ = factory.CreateInstance(); | 230 cryptauth_client_ = factory.CreateInstance(); |
232 | 231 |
233 cryptauth::ToggleEasyUnlockRequest request; | 232 cryptauth::ToggleEasyUnlockRequest request; |
234 request.set_enable(false); | 233 request.set_enable(false); |
235 request.set_apply_to_all(true); | 234 request.set_apply_to_all(true); |
236 cryptauth_client_->ToggleEasyUnlock( | 235 cryptauth_client_->ToggleEasyUnlock( |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 new base::DictionaryValue()); | 426 new base::DictionaryValue()); |
428 user_prefs_dict->SetBooleanWithoutPathExpansion( | 427 user_prefs_dict->SetBooleanWithoutPathExpansion( |
429 prefs::kEasyUnlockProximityRequired, | 428 prefs::kEasyUnlockProximityRequired, |
430 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired)); | 429 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired)); |
431 | 430 |
432 DictionaryPrefUpdate update(local_state, | 431 DictionaryPrefUpdate update(local_state, |
433 prefs::kEasyUnlockLocalStateUserPrefs); | 432 prefs::kEasyUnlockLocalStateUserPrefs); |
434 std::string user_email = GetUserEmail(); | 433 std::string user_email = GetUserEmail(); |
435 update->SetWithoutPathExpansion(user_email, user_prefs_dict.Pass()); | 434 update->SetWithoutPathExpansion(user_email, user_prefs_dict.Pass()); |
436 } | 435 } |
OLD | NEW |