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/extensions/api/easy_unlock_private/easy_unlock_private_
api.h" | 5 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_
api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
13 #include "base/numerics/safe_conversions.h" | 13 #include "base/numerics/safe_conversions.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_
crypto_delegate.h" | 16 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_
crypto_delegate.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" | 18 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" |
19 #include "chrome/browser/signin/easy_unlock_service.h" | 19 #include "chrome/browser/signin/easy_unlock_service.h" |
20 #include "chrome/browser/signin/screenlock_bridge.h" | 20 #include "chrome/browser/signin/screenlock_bridge.h" |
21 #include "chrome/browser/ui/proximity_auth/proximity_auth_error_bubble.h" | 21 #include "chrome/browser/ui/proximity_auth/proximity_auth_error_bubble.h" |
22 #include "chrome/common/extensions/api/easy_unlock_private.h" | 22 #include "chrome/common/extensions/api/easy_unlock_private.h" |
23 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
24 #include "components/proximity_auth/bluetooth_util.h" | 24 #include "components/proximity_auth/bluetooth_util.h" |
| 25 #include "components/proximity_auth/cryptauth/cryptauth_enrollment_utils.h" |
25 #include "components/proximity_auth/switches.h" | 26 #include "components/proximity_auth/switches.h" |
26 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
27 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
28 #include "extensions/browser/browser_context_keyed_api_factory.h" | 29 #include "extensions/browser/browser_context_keyed_api_factory.h" |
29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
30 #include "ui/gfx/geometry/rect.h" | 31 #include "ui/gfx/geometry/rect.h" |
31 #include "ui/gfx/range/range.h" | 32 #include "ui/gfx/range/range.h" |
32 | 33 |
33 #if defined(OS_CHROMEOS) | 34 #if defined(OS_CHROMEOS) |
34 #include "chrome/browser/chromeos/chromeos_utils.h" | 35 #include "chrome/browser/chromeos/chromeos_utils.h" |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 linked_ptr<easy_unlock_private::UserInfo>( | 679 linked_ptr<easy_unlock_private::UserInfo>( |
679 new easy_unlock_private::UserInfo())); | 680 new easy_unlock_private::UserInfo())); |
680 users[0]->user_id = user_id; | 681 users[0]->user_id = user_id; |
681 users[0]->logged_in = service->GetType() == EasyUnlockService::TYPE_REGULAR; | 682 users[0]->logged_in = service->GetType() == EasyUnlockService::TYPE_REGULAR; |
682 users[0]->data_ready = users[0]->logged_in || | 683 users[0]->data_ready = users[0]->logged_in || |
683 service->GetRemoteDevices() != NULL; | 684 service->GetRemoteDevices() != NULL; |
684 | 685 |
685 EasyUnlockService::UserSettings user_settings = | 686 EasyUnlockService::UserSettings user_settings = |
686 EasyUnlockService::GetUserSettings(user_id); | 687 EasyUnlockService::GetUserSettings(user_id); |
687 users[0]->require_close_proximity = user_settings.require_close_proximity; | 688 users[0]->require_close_proximity = user_settings.require_close_proximity; |
| 689 |
| 690 users[0]->device_user_id = proximity_auth::CalculateDeviceUserId( |
| 691 EasyUnlockService::GetDeviceId(), user_id); |
688 } | 692 } |
689 results_ = easy_unlock_private::GetUserInfo::Results::Create(users); | 693 results_ = easy_unlock_private::GetUserInfo::Results::Create(users); |
690 return true; | 694 return true; |
691 } | 695 } |
692 | 696 |
693 EasyUnlockPrivateGetConnectionInfoFunction:: | 697 EasyUnlockPrivateGetConnectionInfoFunction:: |
694 EasyUnlockPrivateGetConnectionInfoFunction() { | 698 EasyUnlockPrivateGetConnectionInfoFunction() { |
695 } | 699 } |
696 | 700 |
697 EasyUnlockPrivateGetConnectionInfoFunction:: | 701 EasyUnlockPrivateGetConnectionInfoFunction:: |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 | 799 |
796 Profile* profile = Profile::FromBrowserContext(browser_context()); | 800 Profile* profile = Profile::FromBrowserContext(browser_context()); |
797 EasyUnlockService::Get(profile) | 801 EasyUnlockService::Get(profile) |
798 ->SetAutoPairingResult(params->result.success, error_message); | 802 ->SetAutoPairingResult(params->result.success, error_message); |
799 | 803 |
800 return true; | 804 return true; |
801 } | 805 } |
802 | 806 |
803 } // namespace api | 807 } // namespace api |
804 } // namespace extensions | 808 } // namespace extensions |
OLD | NEW |