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

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

Issue 2512473004: cros: Enable WebUILoginView reuse. (Closed)
Patch Set: Initial upload 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/profiles/incognito_helpers.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11
12 namespace chromeos {
13
14 // static
15 SharedWebView* SharedWebViewFactory::GetForProfile(Profile* profile) {
16 auto result = static_cast<SharedWebView*>(
17 GetInstance()->GetServiceForBrowserContext(profile, true));
18 return result;
19 }
20
21 // static
22 SharedWebViewFactory* SharedWebViewFactory::GetInstance() {
23 return base::Singleton<SharedWebViewFactory>::get();
24 }
25
26 SharedWebViewFactory::SharedWebViewFactory()
27 : BrowserContextKeyedServiceFactory(
28 "SharedWebViewFactory",
29 BrowserContextDependencyManager::GetInstance()) {}
30
31 SharedWebViewFactory::~SharedWebViewFactory() {}
32
33 content::BrowserContext* SharedWebViewFactory::GetBrowserContextToUse(
34 content::BrowserContext* context) const {
35 // This matches the logic in ExtensionSyncServiceFactory, which uses the
36 // orginal browser context.
37 return chrome::GetBrowserContextRedirectedInIncognito(context);
xiyuan 2016/12/09 22:37:30 |context| should be the incognito sign-in profile
jdufault 2016/12/12 18:23:09 Done.
38 }
39
40 KeyedService* SharedWebViewFactory::BuildServiceInstanceFor(
41 content::BrowserContext* context) const {
42 // By default, no service instances are built for the signin profile since it
43 // is considered incognito.
xiyuan 2016/12/09 22:37:30 After we override GetBrowserContextToUse above, th
jdufault 2016/12/12 18:23:09 Done.
44 return new SharedWebView(Profile::FromBrowserContext(context));
45 }
46
47 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698