| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 return screenlock::AUTH_TYPE_OFFLINEPASSWORD; | 49 return screenlock::AUTH_TYPE_OFFLINEPASSWORD; |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace | 52 } // namespace |
| 53 | 53 |
| 54 ScreenlockPrivateGetLockedFunction::ScreenlockPrivateGetLockedFunction() {} | 54 ScreenlockPrivateGetLockedFunction::ScreenlockPrivateGetLockedFunction() {} |
| 55 | 55 |
| 56 ScreenlockPrivateGetLockedFunction::~ScreenlockPrivateGetLockedFunction() {} | 56 ScreenlockPrivateGetLockedFunction::~ScreenlockPrivateGetLockedFunction() {} |
| 57 | 57 |
| 58 bool ScreenlockPrivateGetLockedFunction::RunAsync() { | 58 bool ScreenlockPrivateGetLockedFunction::RunAsync() { |
| 59 SetResult(base::MakeUnique<base::FundamentalValue>( | 59 SetResult(base::MakeUnique<base::Value>( |
| 60 proximity_auth::ScreenlockBridge::Get()->IsLocked())); | 60 proximity_auth::ScreenlockBridge::Get()->IsLocked())); |
| 61 SendResponse(error_.empty()); | 61 SendResponse(error_.empty()); |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 ScreenlockPrivateSetLockedFunction::ScreenlockPrivateSetLockedFunction() {} | 65 ScreenlockPrivateSetLockedFunction::ScreenlockPrivateSetLockedFunction() {} |
| 66 | 66 |
| 67 ScreenlockPrivateSetLockedFunction::~ScreenlockPrivateSetLockedFunction() {} | 67 ScreenlockPrivateSetLockedFunction::~ScreenlockPrivateSetLockedFunction() {} |
| 68 | 68 |
| 69 bool ScreenlockPrivateSetLockedFunction::RunAsync() { | 69 bool ScreenlockPrivateSetLockedFunction::RunAsync() { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 : browser_context_(context) { | 114 : browser_context_(context) { |
| 115 proximity_auth::ScreenlockBridge::Get()->AddObserver(this); | 115 proximity_auth::ScreenlockBridge::Get()->AddObserver(this); |
| 116 } | 116 } |
| 117 | 117 |
| 118 ScreenlockPrivateEventRouter::~ScreenlockPrivateEventRouter() {} | 118 ScreenlockPrivateEventRouter::~ScreenlockPrivateEventRouter() {} |
| 119 | 119 |
| 120 void ScreenlockPrivateEventRouter::OnScreenDidLock( | 120 void ScreenlockPrivateEventRouter::OnScreenDidLock( |
| 121 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) { | 121 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) { |
| 122 DispatchEvent(events::SCREENLOCK_PRIVATE_ON_CHANGED, | 122 DispatchEvent(events::SCREENLOCK_PRIVATE_ON_CHANGED, |
| 123 screenlock::OnChanged::kEventName, | 123 screenlock::OnChanged::kEventName, |
| 124 base::MakeUnique<base::FundamentalValue>(true)); | 124 base::MakeUnique<base::Value>(true)); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void ScreenlockPrivateEventRouter::OnScreenDidUnlock( | 127 void ScreenlockPrivateEventRouter::OnScreenDidUnlock( |
| 128 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) { | 128 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) { |
| 129 DispatchEvent(events::SCREENLOCK_PRIVATE_ON_CHANGED, | 129 DispatchEvent(events::SCREENLOCK_PRIVATE_ON_CHANGED, |
| 130 screenlock::OnChanged::kEventName, | 130 screenlock::OnChanged::kEventName, |
| 131 base::MakeUnique<base::FundamentalValue>(false)); | 131 base::MakeUnique<base::Value>(false)); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void ScreenlockPrivateEventRouter::OnFocusedUserChanged( | 134 void ScreenlockPrivateEventRouter::OnFocusedUserChanged( |
| 135 const AccountId& account_id) {} | 135 const AccountId& account_id) {} |
| 136 | 136 |
| 137 void ScreenlockPrivateEventRouter::DispatchEvent( | 137 void ScreenlockPrivateEventRouter::DispatchEvent( |
| 138 events::HistogramValue histogram_value, | 138 events::HistogramValue histogram_value, |
| 139 const std::string& event_name, | 139 const std::string& event_name, |
| 140 std::unique_ptr<base::Value> arg) { | 140 std::unique_ptr<base::Value> arg) { |
| 141 std::unique_ptr<base::ListValue> args(new base::ListValue()); | 141 std::unique_ptr<base::ListValue> args(new base::ListValue()); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 172 args->AppendString(value); | 172 args->AppendString(value); |
| 173 | 173 |
| 174 std::unique_ptr<Event> event( | 174 std::unique_ptr<Event> event( |
| 175 new Event(events::SCREENLOCK_PRIVATE_ON_AUTH_ATTEMPTED, | 175 new Event(events::SCREENLOCK_PRIVATE_ON_AUTH_ATTEMPTED, |
| 176 screenlock::OnAuthAttempted::kEventName, std::move(args))); | 176 screenlock::OnAuthAttempted::kEventName, std::move(args))); |
| 177 router->BroadcastEvent(std::move(event)); | 177 router->BroadcastEvent(std::move(event)); |
| 178 return true; | 178 return true; |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace extensions | 181 } // namespace extensions |
| OLD | NEW |