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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/base64url.h" | 10 #include "base/base64url.h" |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
14 #include "base/prefs/scoped_user_pref_update.h" | 15 #include "base/prefs/scoped_user_pref_update.h" |
15 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
16 #include "base/time/default_clock.h" | 17 #include "base/time/default_clock.h" |
17 #include "base/values.h" | 18 #include "base/values.h" |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 callback.Run(false, std::string()); | 393 callback.Run(false, std::string()); |
393 return; | 394 return; |
394 } | 395 } |
395 | 396 |
396 auto_pairing_callback_ = callback; | 397 auto_pairing_callback_ = callback; |
397 | 398 |
398 scoped_ptr<base::ListValue> args(new base::ListValue()); | 399 scoped_ptr<base::ListValue> args(new base::ListValue()); |
399 scoped_ptr<extensions::Event> event(new extensions::Event( | 400 scoped_ptr<extensions::Event> event(new extensions::Event( |
400 extensions::events::EASY_UNLOCK_PRIVATE_ON_START_AUTO_PAIRING, | 401 extensions::events::EASY_UNLOCK_PRIVATE_ON_START_AUTO_PAIRING, |
401 extensions::api::easy_unlock_private::OnStartAutoPairing::kEventName, | 402 extensions::api::easy_unlock_private::OnStartAutoPairing::kEventName, |
402 args.Pass())); | 403 std::move(args))); |
403 extensions::EventRouter::Get(profile())->DispatchEventWithLazyListener( | 404 extensions::EventRouter::Get(profile())->DispatchEventWithLazyListener( |
404 extension_misc::kEasyUnlockAppId, event.Pass()); | 405 extension_misc::kEasyUnlockAppId, std::move(event)); |
405 } | 406 } |
406 | 407 |
407 void EasyUnlockServiceRegular::SetAutoPairingResult( | 408 void EasyUnlockServiceRegular::SetAutoPairingResult( |
408 bool success, | 409 bool success, |
409 const std::string& error) { | 410 const std::string& error) { |
410 DCHECK(!auto_pairing_callback_.is_null()); | 411 DCHECK(!auto_pairing_callback_.is_null()); |
411 | 412 |
412 auto_pairing_callback_.Run(success, error); | 413 auto_pairing_callback_.Run(success, error); |
413 auto_pairing_callback_.Reset(); | 414 auto_pairing_callback_.Reset(); |
414 } | 415 } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 // items in the dictionary are the same profile prefs used for Easy Unlock. | 589 // items in the dictionary are the same profile prefs used for Easy Unlock. |
589 scoped_ptr<base::DictionaryValue> user_prefs_dict( | 590 scoped_ptr<base::DictionaryValue> user_prefs_dict( |
590 new base::DictionaryValue()); | 591 new base::DictionaryValue()); |
591 user_prefs_dict->SetBooleanWithoutPathExpansion( | 592 user_prefs_dict->SetBooleanWithoutPathExpansion( |
592 prefs::kEasyUnlockProximityRequired, | 593 prefs::kEasyUnlockProximityRequired, |
593 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired)); | 594 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired)); |
594 | 595 |
595 DictionaryPrefUpdate update(local_state, | 596 DictionaryPrefUpdate update(local_state, |
596 prefs::kEasyUnlockLocalStateUserPrefs); | 597 prefs::kEasyUnlockLocalStateUserPrefs); |
597 update->SetWithoutPathExpansion(GetAccountId().GetUserEmail(), | 598 update->SetWithoutPathExpansion(GetAccountId().GetUserEmail(), |
598 user_prefs_dict.Pass()); | 599 std::move(user_prefs_dict)); |
599 } | 600 } |
600 | 601 |
601 cryptauth::GcmDeviceInfo EasyUnlockServiceRegular::GetGcmDeviceInfo() { | 602 cryptauth::GcmDeviceInfo EasyUnlockServiceRegular::GetGcmDeviceInfo() { |
602 cryptauth::GcmDeviceInfo device_info; | 603 cryptauth::GcmDeviceInfo device_info; |
603 device_info.set_long_device_id(EasyUnlockService::GetDeviceId()); | 604 device_info.set_long_device_id(EasyUnlockService::GetDeviceId()); |
604 device_info.set_device_type(cryptauth::CHROME); | 605 device_info.set_device_type(cryptauth::CHROME); |
605 device_info.set_device_software_version(version_info::GetVersionNumber()); | 606 device_info.set_device_software_version(version_info::GetVersionNumber()); |
606 google::protobuf::int64 software_version_code = | 607 google::protobuf::int64 software_version_code = |
607 proximity_auth::HashStringToInt64(version_info::GetLastChange()); | 608 proximity_auth::HashStringToInt64(version_info::GetLastChange()); |
608 device_info.set_device_software_version_code(software_version_code); | 609 device_info.set_device_software_version_code(software_version_code); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 PA_LOG(INFO) << "Refresh token not yet available, " | 677 PA_LOG(INFO) << "Refresh token not yet available, " |
677 << "waiting before starting CryptAuth managers"; | 678 << "waiting before starting CryptAuth managers"; |
678 token_service->AddObserver(this); | 679 token_service->AddObserver(this); |
679 } | 680 } |
680 | 681 |
681 device_manager_->AddObserver(this); | 682 device_manager_->AddObserver(this); |
682 enrollment_manager_->Start(); | 683 enrollment_manager_->Start(); |
683 device_manager_->Start(); | 684 device_manager_->Start(); |
684 } | 685 } |
685 #endif | 686 #endif |
OLD | NEW |