| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_app_manager.h" | 5 #include "chrome/browser/signin/easy_unlock_app_manager.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 #include "base/location.h" | 10 #include "base/location.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 11 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" | 13 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" |
| 12 #include "chrome/browser/extensions/component_loader.h" | 14 #include "chrome/browser/extensions/component_loader.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/extensions/application_launch.h" | 17 #include "chrome/browser/ui/extensions/application_launch.h" |
| 16 #include "chrome/common/extensions/api/easy_unlock_private.h" | 18 #include "chrome/common/extensions/api/easy_unlock_private.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 162 |
| 161 extensions::api::easy_unlock_private::UserInfo info; | 163 extensions::api::easy_unlock_private::UserInfo info; |
| 162 info.user_id = user_id; | 164 info.user_id = user_id; |
| 163 info.logged_in = is_logged_in; | 165 info.logged_in = is_logged_in; |
| 164 info.data_ready = data_ready; | 166 info.data_ready = data_ready; |
| 165 | 167 |
| 166 scoped_ptr<base::ListValue> args(new base::ListValue()); | 168 scoped_ptr<base::ListValue> args(new base::ListValue()); |
| 167 args->Append(info.ToValue().release()); | 169 args->Append(info.ToValue().release()); |
| 168 | 170 |
| 169 scoped_ptr<extensions::Event> event( | 171 scoped_ptr<extensions::Event> event( |
| 170 new extensions::Event(histogram_value, event_name, args.Pass())); | 172 new extensions::Event(histogram_value, event_name, std::move(args))); |
| 171 | 173 |
| 172 event_router->DispatchEventToExtension(app_id_, event.Pass()); | 174 event_router->DispatchEventToExtension(app_id_, std::move(event)); |
| 173 return true; | 175 return true; |
| 174 } | 176 } |
| 175 | 177 |
| 176 bool EasyUnlockAppManagerImpl::SendAuthAttemptEvent() { | 178 bool EasyUnlockAppManagerImpl::SendAuthAttemptEvent() { |
| 177 ExtensionService* extension_service = extension_system_->extension_service(); | 179 ExtensionService* extension_service = extension_system_->extension_service(); |
| 178 if (!extension_service) | 180 if (!extension_service) |
| 179 return false; | 181 return false; |
| 180 | 182 |
| 181 // TODO(tbarzic): Restrict this to EasyUnlock app. | 183 // TODO(tbarzic): Restrict this to EasyUnlock app. |
| 182 extensions::ScreenlockPrivateEventRouter* screenlock_router = | 184 extensions::ScreenlockPrivateEventRouter* screenlock_router = |
| 183 extensions::ScreenlockPrivateEventRouter::GetFactoryInstance()->Get( | 185 extensions::ScreenlockPrivateEventRouter::GetFactoryInstance()->Get( |
| 184 extension_service->profile()); | 186 extension_service->profile()); |
| 185 return screenlock_router->OnAuthAttempted( | 187 return screenlock_router->OnAuthAttempted( |
| 186 proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, std::string()); | 188 proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, std::string()); |
| 187 } | 189 } |
| 188 | 190 |
| 189 } // namespace | 191 } // namespace |
| 190 | 192 |
| 191 EasyUnlockAppManager::~EasyUnlockAppManager() { | 193 EasyUnlockAppManager::~EasyUnlockAppManager() { |
| 192 } | 194 } |
| 193 | 195 |
| 194 // static | 196 // static |
| 195 scoped_ptr<EasyUnlockAppManager> EasyUnlockAppManager::Create( | 197 scoped_ptr<EasyUnlockAppManager> EasyUnlockAppManager::Create( |
| 196 extensions::ExtensionSystem* extension_system, | 198 extensions::ExtensionSystem* extension_system, |
| 197 int manifest_id, | 199 int manifest_id, |
| 198 const base::FilePath& app_path) { | 200 const base::FilePath& app_path) { |
| 199 return scoped_ptr<EasyUnlockAppManager>( | 201 return scoped_ptr<EasyUnlockAppManager>( |
| 200 new EasyUnlockAppManagerImpl(extension_system, manifest_id, app_path)); | 202 new EasyUnlockAppManagerImpl(extension_system, manifest_id, app_path)); |
| 201 } | 203 } |
| OLD | NEW |