| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chromeos/login/ui/shared_web_view_factory.h" | 5 #include "chrome/browser/chromeos/login/ui/preloaded_web_view_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/login/ui/shared_web_view.h" | 7 #include "chrome/browser/chromeos/login/ui/preloaded_web_view.h" |
| 8 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 8 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 9 #include "chrome/browser/profiles/incognito_helpers.h" | 9 #include "chrome/browser/profiles/incognito_helpers.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 | 14 |
| 15 // static | 15 // static |
| 16 SharedWebView* SharedWebViewFactory::GetForProfile(Profile* profile) { | 16 PreloadedWebView* PreloadedWebViewFactory::GetForProfile(Profile* profile) { |
| 17 auto result = static_cast<SharedWebView*>( | 17 auto result = static_cast<PreloadedWebView*>( |
| 18 GetInstance()->GetServiceForBrowserContext(profile, true)); | 18 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 19 return result; | 19 return result; |
| 20 } | 20 } |
| 21 | 21 |
| 22 // static | 22 // static |
| 23 SharedWebViewFactory* SharedWebViewFactory::GetInstance() { | 23 PreloadedWebViewFactory* PreloadedWebViewFactory::GetInstance() { |
| 24 return base::Singleton<SharedWebViewFactory>::get(); | 24 return base::Singleton<PreloadedWebViewFactory>::get(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 SharedWebViewFactory::SharedWebViewFactory() | 27 PreloadedWebViewFactory::PreloadedWebViewFactory() |
| 28 : BrowserContextKeyedServiceFactory( | 28 : BrowserContextKeyedServiceFactory( |
| 29 "SharedWebViewFactory", | 29 "PreloadedWebViewFactory", |
| 30 BrowserContextDependencyManager::GetInstance()) {} | 30 BrowserContextDependencyManager::GetInstance()) {} |
| 31 | 31 |
| 32 SharedWebViewFactory::~SharedWebViewFactory() {} | 32 PreloadedWebViewFactory::~PreloadedWebViewFactory() {} |
| 33 | 33 |
| 34 content::BrowserContext* SharedWebViewFactory::GetBrowserContextToUse( | 34 content::BrowserContext* PreloadedWebViewFactory::GetBrowserContextToUse( |
| 35 content::BrowserContext* context) const { | 35 content::BrowserContext* context) const { |
| 36 // Make sure that only the SigninProfile is using a shared webview. | 36 // Make sure that only the SigninProfile is using a preloaded webview. |
| 37 if (Profile::FromBrowserContext(context) != ProfileHelper::GetSigninProfile()) | 37 if (Profile::FromBrowserContext(context) != ProfileHelper::GetSigninProfile()) |
| 38 return nullptr; | 38 return nullptr; |
| 39 | 39 |
| 40 return context; | 40 return context; |
| 41 } | 41 } |
| 42 | 42 |
| 43 KeyedService* SharedWebViewFactory::BuildServiceInstanceFor( | 43 KeyedService* PreloadedWebViewFactory::BuildServiceInstanceFor( |
| 44 content::BrowserContext* context) const { | 44 content::BrowserContext* context) const { |
| 45 return new SharedWebView(Profile::FromBrowserContext(context)); | 45 return new PreloadedWebView(Profile::FromBrowserContext(context)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 } // namespace chromeos | 48 } // namespace chromeos |
| OLD | NEW |