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

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

Issue 444903002: [cros] user_manager component - move UserManagerBase and UserManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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_screenlock_state_handler.h"
17 #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" 18 #include "chrome/browser/signin/screenlock_bridge.h"
19 #include "chrome/browser/ui/extensions/application_launch.h" 19 #include "chrome/browser/ui/extensions/application_launch.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
22 #include "components/pref_registry/pref_registry_syncable.h" 22 #include "components/pref_registry/pref_registry_syncable.h"
23 #include "extensions/browser/extension_system.h" 23 #include "extensions/browser/extension_system.h"
24 #include "extensions/common/one_shot_event.h" 24 #include "extensions/common/one_shot_event.h"
25 #include "grit/browser_resources.h" 25 #include "grit/browser_resources.h"
26 26
27 #if defined(OS_CHROMEOS) 27 #if defined(OS_CHROMEOS)
28 #include "chrome/browser/chromeos/login/users/user_manager.h"
29 #include "chrome/browser/chromeos/profiles/profile_helper.h" 28 #include "chrome/browser/chromeos/profiles/profile_helper.h"
29 #include "components/user_manager/user_manager.h"
30 #endif 30 #endif
31 31
32 namespace { 32 namespace {
33 33
34 extensions::ComponentLoader* GetComponentLoader( 34 extensions::ComponentLoader* GetComponentLoader(
35 content::BrowserContext* context) { 35 content::BrowserContext* context) {
36 extensions::ExtensionSystem* extension_system = 36 extensions::ExtensionSystem* extension_system =
37 extensions::ExtensionSystem::Get(context); 37 extensions::ExtensionSystem::Get(context);
38 ExtensionService* extension_service = extension_system->extension_service(); 38 ExtensionService* extension_service = extension_system->extension_service();
39 return extension_service->component_loader(); 39 return extension_service->component_loader();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 extensions::ExtensionSystem::Get(profile_)->extension_service(); 84 extensions::ExtensionSystem::Get(profile_)->extension_service();
85 const extensions::Extension* extension = 85 const extensions::Extension* extension =
86 service->GetExtensionById(extension_misc::kEasyUnlockAppId, false); 86 service->GetExtensionById(extension_misc::kEasyUnlockAppId, false);
87 87
88 OpenApplication(AppLaunchParams( 88 OpenApplication(AppLaunchParams(
89 profile_, extension, extensions::LAUNCH_CONTAINER_WINDOW, NEW_WINDOW)); 89 profile_, extension, extensions::LAUNCH_CONTAINER_WINDOW, NEW_WINDOW));
90 } 90 }
91 91
92 bool EasyUnlockService::IsAllowed() { 92 bool EasyUnlockService::IsAllowed() {
93 #if defined(OS_CHROMEOS) 93 #if defined(OS_CHROMEOS)
94 if (!chromeos::UserManager::Get()->IsLoggedInAsRegularUser()) 94 if (!user_manager::UserManager::Get()->IsLoggedInAsRegularUser())
95 return false; 95 return false;
96 96
97 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile_)) 97 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile_))
98 return false; 98 return false;
99 99
100 if (!profile_->GetPrefs()->GetBoolean(prefs::kEasyUnlockAllowed)) 100 if (!profile_->GetPrefs()->GetBoolean(prefs::kEasyUnlockAllowed))
101 return false; 101 return false;
102 102
103 // It is only disabled when the trial exists and is in "Disable" group. 103 // It is only disabled when the trial exists and is in "Disable" group.
104 return base::FieldTrialList::FindFullName("EasyUnlock") != "Disable"; 104 return base::FieldTrialList::FindFullName("EasyUnlock") != "Disable";
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 void EasyUnlockService::OnPrefsChanged() { 162 void EasyUnlockService::OnPrefsChanged() {
163 if (IsAllowed()) { 163 if (IsAllowed()) {
164 LoadApp(); 164 LoadApp();
165 } else { 165 } else {
166 UnloadApp(); 166 UnloadApp();
167 // Reset the screenlock state handler to make sure Screenlock state set 167 // Reset the screenlock state handler to make sure Screenlock state set
168 // by Easy Unlock app is reset. 168 // by Easy Unlock app is reset.
169 screenlock_state_handler_.reset(); 169 screenlock_state_handler_.reset();
170 } 170 }
171 } 171 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/chrome_signin_client.cc ('k') | chrome/browser/signin/easy_unlock_service_browsertest_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698