| 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/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/signin/chrome_proximity_auth_client.h" |
| 14 #include "chrome/browser/signin/signin_manager_factory.h" | 15 #include "chrome/browser/signin/signin_manager_factory.h" |
| 15 #include "chrome/common/extensions/api/easy_unlock_private.h" | 16 #include "chrome/common/extensions/api/easy_unlock_private.h" |
| 16 #include "chrome/common/extensions/extension_constants.h" | 17 #include "chrome/common/extensions/extension_constants.h" |
| 17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 18 #include "chromeos/login/user_names.h" | 19 #include "chromeos/login/user_names.h" |
| 19 #include "components/pref_registry/pref_registry_syncable.h" | 20 #include "components/pref_registry/pref_registry_syncable.h" |
| 20 #include "components/proximity_auth/cryptauth/cryptauth_access_token_fetcher.h" | 21 #include "components/proximity_auth/cryptauth/cryptauth_access_token_fetcher.h" |
| 21 #include "components/proximity_auth/cryptauth/cryptauth_client_impl.h" | 22 #include "components/proximity_auth/cryptauth/cryptauth_client_impl.h" |
| 22 #include "components/proximity_auth/screenlock_bridge.h" | 23 #include "components/proximity_auth/screenlock_bridge.h" |
| 23 #include "components/proximity_auth/switches.h" | 24 #include "components/proximity_auth/switches.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 194 } |
| 194 | 195 |
| 195 void EasyUnlockServiceRegular::RunTurnOffFlow() { | 196 void EasyUnlockServiceRegular::RunTurnOffFlow() { |
| 196 if (turn_off_flow_status_ == PENDING) | 197 if (turn_off_flow_status_ == PENDING) |
| 197 return; | 198 return; |
| 198 DCHECK(!cryptauth_client_); | 199 DCHECK(!cryptauth_client_); |
| 199 | 200 |
| 200 SetTurnOffFlowStatus(PENDING); | 201 SetTurnOffFlowStatus(PENDING); |
| 201 | 202 |
| 202 scoped_ptr<proximity_auth::CryptAuthClientFactory> factory = | 203 scoped_ptr<proximity_auth::CryptAuthClientFactory> factory = |
| 203 CreateCryptAuthClientFactory(); | 204 proximity_auth_client()->CreateCryptAuthClientFactory(); |
| 204 cryptauth_client_ = factory->CreateInstance(); | 205 cryptauth_client_ = factory->CreateInstance(); |
| 205 | 206 |
| 206 cryptauth::ToggleEasyUnlockRequest request; | 207 cryptauth::ToggleEasyUnlockRequest request; |
| 207 request.set_enable(false); | 208 request.set_enable(false); |
| 208 request.set_apply_to_all(true); | 209 request.set_apply_to_all(true); |
| 209 cryptauth_client_->ToggleEasyUnlock( | 210 cryptauth_client_->ToggleEasyUnlock( |
| 210 request, | 211 request, |
| 211 base::Bind(&EasyUnlockServiceRegular::OnToggleEasyUnlockApiComplete, | 212 base::Bind(&EasyUnlockServiceRegular::OnToggleEasyUnlockApiComplete, |
| 212 weak_ptr_factory_.GetWeakPtr()), | 213 weak_ptr_factory_.GetWeakPtr()), |
| 213 base::Bind(&EasyUnlockServiceRegular::OnToggleEasyUnlockApiFailed, | 214 base::Bind(&EasyUnlockServiceRegular::OnToggleEasyUnlockApiFailed, |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 new base::DictionaryValue()); | 402 new base::DictionaryValue()); |
| 402 user_prefs_dict->SetBooleanWithoutPathExpansion( | 403 user_prefs_dict->SetBooleanWithoutPathExpansion( |
| 403 prefs::kEasyUnlockProximityRequired, | 404 prefs::kEasyUnlockProximityRequired, |
| 404 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired)); | 405 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired)); |
| 405 | 406 |
| 406 DictionaryPrefUpdate update(local_state, | 407 DictionaryPrefUpdate update(local_state, |
| 407 prefs::kEasyUnlockLocalStateUserPrefs); | 408 prefs::kEasyUnlockLocalStateUserPrefs); |
| 408 std::string user_email = GetUserEmail(); | 409 std::string user_email = GetUserEmail(); |
| 409 update->SetWithoutPathExpansion(user_email, user_prefs_dict.Pass()); | 410 update->SetWithoutPathExpansion(user_email, user_prefs_dict.Pass()); |
| 410 } | 411 } |
| OLD | NEW |