Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: chrome/browser/signin/easy_unlock_service_regular.cc

Issue 1096293003: Move screenlock_bridge to components/proximity_auth (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix linux build Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
18 #include "chrome/browser/signin/signin_manager_factory.h" 17 #include "chrome/browser/signin/signin_manager_factory.h"
19 #include "chrome/common/chrome_version_info.h" 18 #include "chrome/common/chrome_version_info.h"
20 #include "chrome/common/extensions/api/easy_unlock_private.h" 19 #include "chrome/common/extensions/api/easy_unlock_private.h"
21 #include "chrome/common/extensions/extension_constants.h" 20 #include "chrome/common/extensions/extension_constants.h"
22 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
23 #include "chromeos/login/user_names.h" 22 #include "chromeos/login/user_names.h"
24 #include "components/pref_registry/pref_registry_syncable.h" 23 #include "components/pref_registry/pref_registry_syncable.h"
25 #include "components/proximity_auth/cryptauth/cryptauth_access_token_fetcher.h" 24 #include "components/proximity_auth/cryptauth/cryptauth_access_token_fetcher.h"
26 #include "components/proximity_auth/cryptauth/cryptauth_client_impl.h" 25 #include "components/proximity_auth/cryptauth/cryptauth_client_impl.h"
27 #include "components/proximity_auth/switches.h" 26 #include "components/proximity_auth/switches.h"
27 #include "components/signin/content/screenlock_bridge.h"
28 #include "components/signin/core/browser/profile_oauth2_token_service.h" 28 #include "components/signin/core/browser/profile_oauth2_token_service.h"
29 #include "components/signin/core/browser/signin_manager.h" 29 #include "components/signin/core/browser/signin_manager.h"
30 #include "content/public/browser/browser_thread.h" 30 #include "content/public/browser/browser_thread.h"
31 #include "extensions/browser/event_router.h" 31 #include "extensions/browser/event_router.h"
32 #include "extensions/common/constants.h" 32 #include "extensions/common/constants.h"
33 33
34 #if defined(OS_CHROMEOS) 34 #if defined(OS_CHROMEOS)
35 #include "apps/app_lifetime_monitor_factory.h" 35 #include "apps/app_lifetime_monitor_factory.h"
36 #include "base/thread_task_runner_handle.h" 36 #include "base/thread_task_runner_handle.h"
37 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" 37 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 EasyUnlockServiceRegular::~EasyUnlockServiceRegular() { 87 EasyUnlockServiceRegular::~EasyUnlockServiceRegular() {
88 } 88 }
89 89
90 EasyUnlockService::Type EasyUnlockServiceRegular::GetType() const { 90 EasyUnlockService::Type EasyUnlockServiceRegular::GetType() const {
91 return EasyUnlockService::TYPE_REGULAR; 91 return EasyUnlockService::TYPE_REGULAR;
92 } 92 }
93 93
94 std::string EasyUnlockServiceRegular::GetUserEmail() const { 94 std::string EasyUnlockServiceRegular::GetUserEmail() const {
95 return ScreenlockBridge::GetAuthenticatedUserEmail(profile()); 95 return SigninManagerFactory::GetForProfileIfExists(profile())
96 ->GetAuthenticatedUsername();
Ilya Sherman 2015/04/21 23:02:39 Please keep the comment from screenlock_bridge.cc
msarda 2015/04/22 16:42:42 Done.
96 } 97 }
97 98
98 void EasyUnlockServiceRegular::LaunchSetup() { 99 void EasyUnlockServiceRegular::LaunchSetup() {
99 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 100 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
100 #if defined(OS_CHROMEOS) 101 #if defined(OS_CHROMEOS)
101 // Force the user to reauthenticate by showing a modal overlay (similar to the 102 // Force the user to reauthenticate by showing a modal overlay (similar to the
102 // lock screen). The password obtained from the reauth is cached for a short 103 // lock screen). The password obtained from the reauth is cached for a short
103 // period of time and used to create the cryptohome keys for sign-in. 104 // period of time and used to create the cryptohome keys for sign-in.
104 if (short_lived_user_context_ && short_lived_user_context_->user_context()) { 105 if (short_lived_user_context_ && short_lived_user_context_->user_context()) {
105 OpenSetupApp(); 106 OpenSetupApp();
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 new base::DictionaryValue()); 427 new base::DictionaryValue());
427 user_prefs_dict->SetBooleanWithoutPathExpansion( 428 user_prefs_dict->SetBooleanWithoutPathExpansion(
428 prefs::kEasyUnlockProximityRequired, 429 prefs::kEasyUnlockProximityRequired,
429 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired)); 430 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired));
430 431
431 DictionaryPrefUpdate update(local_state, 432 DictionaryPrefUpdate update(local_state,
432 prefs::kEasyUnlockLocalStateUserPrefs); 433 prefs::kEasyUnlockLocalStateUserPrefs);
433 std::string user_email = GetUserEmail(); 434 std::string user_email = GetUserEmail();
434 update->SetWithoutPathExpansion(user_email, user_prefs_dict.Pass()); 435 update->SetWithoutPathExpansion(user_email, user_prefs_dict.Pass());
435 } 436 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698