OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/screenlock_private/screenlock_private_ap i.h" | 5 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap i.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/signin/chrome_proximity_auth_client.h" | |
10 #include "chrome/browser/signin/easy_unlock_service.h" | 11 #include "chrome/browser/signin/easy_unlock_service.h" |
11 #include "chrome/browser/signin/proximity_auth_facade.h" | 12 #include "chrome/browser/signin/proximity_auth_facade.h" |
12 #include "chrome/common/extensions/api/screenlock_private.h" | 13 #include "chrome/common/extensions/api/screenlock_private.h" |
13 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
14 #include "extensions/browser/app_window/app_window_registry.h" | 15 #include "extensions/browser/app_window/app_window_registry.h" |
15 #include "extensions/browser/event_router.h" | 16 #include "extensions/browser/event_router.h" |
16 | 17 |
17 namespace screenlock = extensions::api::screenlock_private; | 18 namespace screenlock = extensions::api::screenlock_private; |
18 | 19 |
19 namespace extensions { | 20 namespace extensions { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 } | 59 } |
59 | 60 |
60 ScreenlockPrivateSetLockedFunction::ScreenlockPrivateSetLockedFunction() {} | 61 ScreenlockPrivateSetLockedFunction::ScreenlockPrivateSetLockedFunction() {} |
61 | 62 |
62 ScreenlockPrivateSetLockedFunction::~ScreenlockPrivateSetLockedFunction() {} | 63 ScreenlockPrivateSetLockedFunction::~ScreenlockPrivateSetLockedFunction() {} |
63 | 64 |
64 bool ScreenlockPrivateSetLockedFunction::RunAsync() { | 65 bool ScreenlockPrivateSetLockedFunction::RunAsync() { |
65 scoped_ptr<screenlock::SetLocked::Params> params( | 66 scoped_ptr<screenlock::SetLocked::Params> params( |
66 screenlock::SetLocked::Params::Create(*args_)); | 67 screenlock::SetLocked::Params::Create(*args_)); |
67 EXTENSION_FUNCTION_VALIDATE(params.get()); | 68 EXTENSION_FUNCTION_VALIDATE(params.get()); |
69 EasyUnlockService* service = EasyUnlockService::Get(GetProfile()); | |
68 if (params->locked) { | 70 if (params->locked) { |
69 if (extension()->id() == extension_misc::kEasyUnlockAppId && | 71 if (extension()->id() == extension_misc::kEasyUnlockAppId && |
70 AppWindowRegistry::Get(browser_context()) | 72 AppWindowRegistry::Get(browser_context()) |
71 ->GetAppWindowForAppAndKey(extension()->id(), | 73 ->GetAppWindowForAppAndKey(extension()->id(), |
72 "easy_unlock_pairing")) { | 74 "easy_unlock_pairing")) { |
73 // Mark the Easy Unlock behaviour on the lock screen as the one initiated | 75 // Mark the Easy Unlock behaviour on the lock screen as the one initiated |
74 // by the Easy Unlock setup app as a trial one. | 76 // by the Easy Unlock setup app as a trial one. |
75 // TODO(tbarzic): Move this logic to a new easyUnlockPrivate function. | 77 // TODO(tbarzic): Move this logic to a new easyUnlockPrivate function. |
76 EasyUnlockService* service = EasyUnlockService::Get(GetProfile()); | 78 service->SetTrialRun(); |
77 if (service) | |
78 service->SetTrialRun(); | |
79 } | 79 } |
80 GetScreenlockBridgeInstance()->Lock(GetProfile()); | 80 GetScreenlockBridgeInstance()->Lock(); |
81 } else { | 81 } else { |
82 GetScreenlockBridgeInstance()->Unlock(GetProfile()); | 82 GetScreenlockBridgeInstance()->Unlock( |
83 service->proximity_auth_client()->GetAuthenticatedUsername()); | |
Marijn Kruisselbrink
2015/06/29 18:15:04
Can you add a comment to that Unlock method to des
Ilya Sherman
2015/06/30 00:22:00
Done, though I'm not sure how much it helps. I th
Ilya Sherman
2015/06/30 01:36:58
To address the other part of your reply: Tim speci
| |
83 } | 84 } |
84 SendResponse(error_.empty()); | 85 SendResponse(error_.empty()); |
85 return true; | 86 return true; |
86 } | 87 } |
87 | 88 |
88 ScreenlockPrivateAcceptAuthAttemptFunction:: | 89 ScreenlockPrivateAcceptAuthAttemptFunction:: |
89 ScreenlockPrivateAcceptAuthAttemptFunction() {} | 90 ScreenlockPrivateAcceptAuthAttemptFunction() {} |
90 | 91 |
91 ScreenlockPrivateAcceptAuthAttemptFunction:: | 92 ScreenlockPrivateAcceptAuthAttemptFunction:: |
92 ~ScreenlockPrivateAcceptAuthAttemptFunction() {} | 93 ~ScreenlockPrivateAcceptAuthAttemptFunction() {} |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 args->AppendString(value); | 165 args->AppendString(value); |
165 | 166 |
166 scoped_ptr<extensions::Event> event(new extensions::Event( | 167 scoped_ptr<extensions::Event> event(new extensions::Event( |
167 extensions::events::UNKNOWN, screenlock::OnAuthAttempted::kEventName, | 168 extensions::events::UNKNOWN, screenlock::OnAuthAttempted::kEventName, |
168 args.Pass())); | 169 args.Pass())); |
169 router->BroadcastEvent(event.Pass()); | 170 router->BroadcastEvent(event.Pass()); |
170 return true; | 171 return true; |
171 } | 172 } |
172 | 173 |
173 } // namespace extensions | 174 } // namespace extensions |
OLD | NEW |