| 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/chrome_proximity_auth_client.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 AppWindowRegistry::Get(browser_context()) | 72 AppWindowRegistry::Get(browser_context()) |
| 73 ->GetAppWindowForAppAndKey(extension()->id(), | 73 ->GetAppWindowForAppAndKey(extension()->id(), |
| 74 "easy_unlock_pairing")) { | 74 "easy_unlock_pairing")) { |
| 75 // 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 |
| 76 // by the Easy Unlock setup app as a trial one. | 76 // by the Easy Unlock setup app as a trial one. |
| 77 // TODO(tbarzic): Move this logic to a new easyUnlockPrivate function. | 77 // TODO(tbarzic): Move this logic to a new easyUnlockPrivate function. |
| 78 service->SetTrialRun(); | 78 service->SetTrialRun(); |
| 79 } | 79 } |
| 80 proximity_auth::ScreenlockBridge::Get()->Lock(); | 80 proximity_auth::ScreenlockBridge::Get()->Lock(); |
| 81 } else { | 81 } else { |
| 82 proximity_auth::ScreenlockBridge::Get()->Unlock( | 82 proximity_auth::ScreenlockBridge::Get()->Unlock(AccountId::FromUserEmail( |
| 83 service->proximity_auth_client()->GetAuthenticatedUsername()); | 83 service->proximity_auth_client()->GetAuthenticatedUsername())); |
| 84 } | 84 } |
| 85 SendResponse(error_.empty()); | 85 SendResponse(error_.empty()); |
| 86 return true; | 86 return true; |
| 87 } | 87 } |
| 88 | 88 |
| 89 ScreenlockPrivateAcceptAuthAttemptFunction:: | 89 ScreenlockPrivateAcceptAuthAttemptFunction:: |
| 90 ScreenlockPrivateAcceptAuthAttemptFunction() {} | 90 ScreenlockPrivateAcceptAuthAttemptFunction() {} |
| 91 | 91 |
| 92 ScreenlockPrivateAcceptAuthAttemptFunction:: | 92 ScreenlockPrivateAcceptAuthAttemptFunction:: |
| 93 ~ScreenlockPrivateAcceptAuthAttemptFunction() {} | 93 ~ScreenlockPrivateAcceptAuthAttemptFunction() {} |
| (...skipping 26 matching lines...) Expand all Loading... |
| 120 } | 120 } |
| 121 | 121 |
| 122 void ScreenlockPrivateEventRouter::OnScreenDidUnlock( | 122 void ScreenlockPrivateEventRouter::OnScreenDidUnlock( |
| 123 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) { | 123 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) { |
| 124 DispatchEvent(events::SCREENLOCK_PRIVATE_ON_CHANGED, | 124 DispatchEvent(events::SCREENLOCK_PRIVATE_ON_CHANGED, |
| 125 screenlock::OnChanged::kEventName, | 125 screenlock::OnChanged::kEventName, |
| 126 new base::FundamentalValue(false)); | 126 new base::FundamentalValue(false)); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void ScreenlockPrivateEventRouter::OnFocusedUserChanged( | 129 void ScreenlockPrivateEventRouter::OnFocusedUserChanged( |
| 130 const std::string& user_id) { | 130 const AccountId& account_id) {} |
| 131 } | |
| 132 | 131 |
| 133 void ScreenlockPrivateEventRouter::DispatchEvent( | 132 void ScreenlockPrivateEventRouter::DispatchEvent( |
| 134 events::HistogramValue histogram_value, | 133 events::HistogramValue histogram_value, |
| 135 const std::string& event_name, | 134 const std::string& event_name, |
| 136 base::Value* arg) { | 135 base::Value* arg) { |
| 137 scoped_ptr<base::ListValue> args(new base::ListValue()); | 136 scoped_ptr<base::ListValue> args(new base::ListValue()); |
| 138 if (arg) | 137 if (arg) |
| 139 args->Append(arg); | 138 args->Append(arg); |
| 140 scoped_ptr<Event> event(new Event(histogram_value, event_name, args.Pass())); | 139 scoped_ptr<Event> event(new Event(histogram_value, event_name, args.Pass())); |
| 141 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); | 140 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 167 args->AppendString(value); | 166 args->AppendString(value); |
| 168 | 167 |
| 169 scoped_ptr<Event> event( | 168 scoped_ptr<Event> event( |
| 170 new Event(events::SCREENLOCK_PRIVATE_ON_AUTH_ATTEMPTED, | 169 new Event(events::SCREENLOCK_PRIVATE_ON_AUTH_ATTEMPTED, |
| 171 screenlock::OnAuthAttempted::kEventName, args.Pass())); | 170 screenlock::OnAuthAttempted::kEventName, args.Pass())); |
| 172 router->BroadcastEvent(event.Pass()); | 171 router->BroadcastEvent(event.Pass()); |
| 173 return true; | 172 return true; |
| 174 } | 173 } |
| 175 | 174 |
| 176 } // namespace extensions | 175 } // namespace extensions |
| OLD | NEW |