| Index: chrome/browser/ui/app_list/arc_app_prefs_factory.cc
|
| diff --git a/chrome/browser/ui/app_list/arc_app_prefs_factory.cc b/chrome/browser/ui/app_list/arc_app_prefs_factory.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7882c4a1605ce2bd6172c7c6b50cf9a407181164
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/app_list/arc_app_prefs_factory.cc
|
| @@ -0,0 +1,47 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/ui/app_list/arc_app_prefs_factory.h"
|
| +
|
| +#include "chrome/browser/profiles/incognito_helpers.h"
|
| +#include "chrome/browser/profiles/profile.h"
|
| +#include "chrome/browser/ui/app_list/arc_app_prefs.h"
|
| +#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
| +#include "content/public/browser/browser_context.h"
|
| +
|
| +// static
|
| +ArcAppPrefs* ArcAppPrefsFactory::GetForBrowserContext(
|
| + content::BrowserContext* context) {
|
| + return static_cast<ArcAppPrefs*>(
|
| + GetInstance()->GetServiceForBrowserContext(context, true));
|
| +}
|
| +
|
| +// static
|
| +ArcAppPrefsFactory* ArcAppPrefsFactory::GetInstance() {
|
| + return base::Singleton<ArcAppPrefsFactory>::get();
|
| +}
|
| +
|
| +ArcAppPrefsFactory::ArcAppPrefsFactory()
|
| + : BrowserContextKeyedServiceFactory(
|
| + "ArcAppPrefs",
|
| + BrowserContextDependencyManager::GetInstance()) {
|
| +}
|
| +
|
| +ArcAppPrefsFactory::~ArcAppPrefsFactory() {
|
| +}
|
| +
|
| +KeyedService* ArcAppPrefsFactory::BuildServiceInstanceFor(
|
| + content::BrowserContext* context) const {
|
| + Profile* profile = reinterpret_cast<Profile*>(context);
|
| + return ArcAppPrefs::Create(context,
|
| + profile->GetPath(),
|
| + profile->GetPrefs());
|
| +}
|
| +
|
| +content::BrowserContext* ArcAppPrefsFactory::GetBrowserContextToUse(
|
| + content::BrowserContext* context) const {
|
| + // This matches the logic in ExtensionSyncServiceFactory, which uses the
|
| + // orginal browser context.
|
| + return chrome::GetBrowserContextRedirectedInIncognito(context);
|
| +}
|
|
|