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

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

Issue 446743003: Hook up new API for easy unlock to update lock screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: v Created 6 years, 4 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 | Annotate | Revision Log
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.h" 5 #include "chrome/browser/signin/easy_unlock_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/extensions/component_loader.h" 13 #include "chrome/browser/extensions/component_loader.h"
14 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h"
16 #include "chrome/browser/signin/easy_unlock_service_factory.h" 17 #include "chrome/browser/signin/easy_unlock_service_factory.h"
18 #include "chrome/browser/signin/screenlock_bridge.h"
17 #include "chrome/browser/ui/extensions/application_launch.h" 19 #include "chrome/browser/ui/extensions/application_launch.h"
18 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
20 #include "components/pref_registry/pref_registry_syncable.h" 22 #include "components/pref_registry/pref_registry_syncable.h"
21 #include "extensions/browser/extension_system.h" 23 #include "extensions/browser/extension_system.h"
22 #include "extensions/common/one_shot_event.h" 24 #include "extensions/common/one_shot_event.h"
23 #include "grit/browser_resources.h" 25 #include "grit/browser_resources.h"
24 26
25 #if defined(OS_CHROMEOS) 27 #if defined(OS_CHROMEOS)
26 #include "chrome/browser/chromeos/login/users/user_manager.h" 28 #include "chrome/browser/chromeos/login/users/user_manager.h"
(...skipping 11 matching lines...) Expand all
38 } 40 }
39 41
40 } // namespace 42 } // namespace
41 43
42 // static 44 // static
43 EasyUnlockService* EasyUnlockService::Get(Profile* profile) { 45 EasyUnlockService* EasyUnlockService::Get(Profile* profile) {
44 return EasyUnlockServiceFactory::GetForProfile(profile); 46 return EasyUnlockServiceFactory::GetForProfile(profile);
45 } 47 }
46 48
47 EasyUnlockService::EasyUnlockService(Profile* profile) 49 EasyUnlockService::EasyUnlockService(Profile* profile)
48 : profile_(profile), weak_ptr_factory_(this) { 50 : profile_(profile),
51 screenlock_state_handler_(new EasyUnlockScreenlockStateHandler(
52 ScreenlockBridge::GetAuthenticatedUserEmail(profile),
xiyuan 2014/08/12 18:09:47 EasyUnlockService is created with profile. Authent
tbarzic 2014/08/12 19:14:36 Done. Now creating |screenlock_state_handler_| laz
dzhioev (left Google) 2014/08/12 19:36:09 Confirm. Authenticated user name definitely is not
tbarzic 2014/08/12 21:40:58 OK, changed the app loading logic to allow the app
dzhioev (left Google) 2014/08/13 15:43:19 I'm not sure, but I would not rely on it. Why do y
xiyuan 2014/08/13 15:53:41 Tony has changed to lazily create |screenlock_stat
53 profile->GetPrefs(),
54 ScreenlockBridge::Get())),
55 weak_ptr_factory_(this) {
49 extensions::ExtensionSystem::Get(profile_)->ready().Post( 56 extensions::ExtensionSystem::Get(profile_)->ready().Post(
50 FROM_HERE, 57 FROM_HERE,
51 base::Bind(&EasyUnlockService::Initialize, 58 base::Bind(&EasyUnlockService::Initialize,
52 weak_ptr_factory_.GetWeakPtr())); 59 weak_ptr_factory_.GetWeakPtr()));
53 } 60 }
54 61
55 EasyUnlockService::~EasyUnlockService() { 62 EasyUnlockService::~EasyUnlockService() {
56 } 63 }
57 64
58 // static 65 // static
59 void EasyUnlockService::RegisterProfilePrefs( 66 void EasyUnlockService::RegisterProfilePrefs(
60 user_prefs::PrefRegistrySyncable* registry) { 67 user_prefs::PrefRegistrySyncable* registry) {
61 registry->RegisterBooleanPref( 68 registry->RegisterBooleanPref(
62 prefs::kEasyUnlockEnabled, 69 prefs::kEasyUnlockEnabled,
dzhioev (left Google) 2014/08/12 19:36:09 I can't find where this pref is used. Is it needed
tbarzic 2014/08/12 21:40:58 I don't think it's currently used, but xiyuan is w
63 false, 70 false,
64 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 71 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
65 registry->RegisterBooleanPref( 72 registry->RegisterBooleanPref(
66 prefs::kEasyUnlockShowTutorial, 73 prefs::kEasyUnlockShowTutorial,
67 false, 74 false,
68 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 75 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
69 registry->RegisterDictionaryPref( 76 registry->RegisterDictionaryPref(
70 prefs::kEasyUnlockPairing, 77 prefs::kEasyUnlockPairing,
71 new base::DictionaryValue(), 78 new base::DictionaryValue(),
72 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 79 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 void EasyUnlockService::UnloadApp() { 148 void EasyUnlockService::UnloadApp() {
142 GetComponentLoader(profile_)->Remove(extension_misc::kEasyUnlockAppId); 149 GetComponentLoader(profile_)->Remove(extension_misc::kEasyUnlockAppId);
143 } 150 }
144 151
145 void EasyUnlockService::OnPrefsChanged() { 152 void EasyUnlockService::OnPrefsChanged() {
146 if (IsAllowed()) 153 if (IsAllowed())
147 LoadApp(); 154 LoadApp();
148 else 155 else
149 UnloadApp(); 156 UnloadApp();
150 } 157 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698