Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_factory.h" | 5 #include "chrome/browser/signin/easy_unlock_service_factory.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h" | 10 #include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 | 77 |
| 78 EasyUnlockServiceFactory::~EasyUnlockServiceFactory() { | 78 EasyUnlockServiceFactory::~EasyUnlockServiceFactory() { |
| 79 } | 79 } |
| 80 | 80 |
| 81 KeyedService* EasyUnlockServiceFactory::BuildServiceInstanceFor( | 81 KeyedService* EasyUnlockServiceFactory::BuildServiceInstanceFor( |
| 82 content::BrowserContext* context) const { | 82 content::BrowserContext* context) const { |
| 83 EasyUnlockService* service = NULL; | 83 EasyUnlockService* service = NULL; |
| 84 int manifest_id = 0; | 84 int manifest_id = 0; |
| 85 | 85 |
| 86 #if defined(OS_CHROMEOS) | 86 #if defined(OS_CHROMEOS) |
| 87 if (chromeos::ProfileHelper::IsLockScreenAppProfile( | |
| 88 Profile::FromBrowserContext(context))) { | |
| 89 return nullptr; | |
| 90 } | |
| 87 if (chromeos::ProfileHelper::IsSigninProfile( | 91 if (chromeos::ProfileHelper::IsSigninProfile( |
| 88 Profile::FromBrowserContext(context))) { | 92 Profile::FromBrowserContext(context))) { |
| 89 if (!context->IsOffTheRecord()) | 93 if (!context->IsOffTheRecord()) |
| 90 return NULL; | 94 return NULL; |
|
xiyuan
2017/06/22 20:15:25
nit: NULL -> nullptr since you are here.
| |
| 91 | 95 |
| 92 service = new EasyUnlockServiceSignin(Profile::FromBrowserContext(context)); | 96 service = new EasyUnlockServiceSignin(Profile::FromBrowserContext(context)); |
| 93 manifest_id = IDR_EASY_UNLOCK_MANIFEST_SIGNIN; | 97 manifest_id = IDR_EASY_UNLOCK_MANIFEST_SIGNIN; |
| 94 } | 98 } |
| 95 #endif | 99 #endif |
| 96 | 100 |
| 97 if (!service) { | 101 if (!service) { |
| 98 service = | 102 service = |
| 99 new EasyUnlockServiceRegular(Profile::FromBrowserContext(context)); | 103 new EasyUnlockServiceRegular(Profile::FromBrowserContext(context)); |
| 100 manifest_id = IDR_EASY_UNLOCK_MANIFEST; | 104 manifest_id = IDR_EASY_UNLOCK_MANIFEST; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 130 bool EasyUnlockServiceFactory::ServiceIsCreatedWithBrowserContext() const { | 134 bool EasyUnlockServiceFactory::ServiceIsCreatedWithBrowserContext() const { |
| 131 return true; | 135 return true; |
| 132 } | 136 } |
| 133 | 137 |
| 134 bool EasyUnlockServiceFactory::ServiceIsNULLWhileTesting() const { | 138 bool EasyUnlockServiceFactory::ServiceIsNULLWhileTesting() const { |
| 135 // Don't create the service for TestingProfile used in unit_tests because | 139 // Don't create the service for TestingProfile used in unit_tests because |
| 136 // EasyUnlockService uses ExtensionSystem::ready().Post, which expects | 140 // EasyUnlockService uses ExtensionSystem::ready().Post, which expects |
| 137 // a MessageLoop that does not exit in many unit_tests cases. | 141 // a MessageLoop that does not exit in many unit_tests cases. |
| 138 return true; | 142 return true; |
| 139 } | 143 } |
| OLD | NEW |