Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Side by Side Diff: chrome/browser/chromeos/login/ui/shared_web_view_factory.cc

Issue 2512473004: cros: Enable WebUILoginView reuse. (Closed)
Patch Set: Address comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/login/ui/shared_web_view_factory.h"
6
7 #include "chrome/browser/chromeos/login/ui/shared_web_view.h"
8 #include "chrome/browser/chromeos/profiles/profile_helper.h"
9 #include "chrome/browser/profiles/incognito_helpers.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12
13 namespace chromeos {
14
15 // static
16 SharedWebView* SharedWebViewFactory::GetForProfile(Profile* profile) {
17 auto result = static_cast<SharedWebView*>(
18 GetInstance()->GetServiceForBrowserContext(profile, true));
19 return result;
20 }
21
22 // static
23 SharedWebViewFactory* SharedWebViewFactory::GetInstance() {
24 return base::Singleton<SharedWebViewFactory>::get();
25 }
26
27 SharedWebViewFactory::SharedWebViewFactory()
28 : BrowserContextKeyedServiceFactory(
29 "SharedWebViewFactory",
30 BrowserContextDependencyManager::GetInstance()) {}
31
32 SharedWebViewFactory::~SharedWebViewFactory() {}
33
34 content::BrowserContext* SharedWebViewFactory::GetBrowserContextToUse(
35 content::BrowserContext* context) const {
36 // Make sure that only the SigninProfile is using a shared webview.
37 if (Profile::FromBrowserContext(context) != ProfileHelper::GetSigninProfile())
38 return nullptr;
39
40 return context;
41 }
42
43 KeyedService* SharedWebViewFactory::BuildServiceInstanceFor(
44 content::BrowserContext* context) const {
45 return new SharedWebView(Profile::FromBrowserContext(context));
46 }
47
48 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/ui/shared_web_view_factory.h ('k') | chrome/browser/chromeos/login/ui/web_view_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698