Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / app_list / app_list_syncable_service_factory.cc
index 72def97..4a1cc37 100644 (file)
@@ -5,12 +5,13 @@
 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
 
 #include "base/prefs/pref_service.h"
-#include "chrome/browser/extensions/extension_system.h"
-#include "chrome/browser/extensions/extension_system_factory.h"
 #include "chrome/browser/profiles/incognito_helpers.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/ui/app_list/app_list_syncable_service.h"
 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
+#include "extensions/browser/extension_system.h"
+#include "extensions/browser/extension_system_provider.h"
+#include "extensions/browser/extensions_browser_client.h"
 
 namespace app_list {
 
@@ -30,7 +31,8 @@ AppListSyncableServiceFactory::AppListSyncableServiceFactory()
     : BrowserContextKeyedServiceFactory(
         "AppListSyncableService",
         BrowserContextDependencyManager::GetInstance()) {
-  DependsOn(extensions::ExtensionSystemFactory::GetInstance());
+  DependsOn(
+      extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
 }
 
 AppListSyncableServiceFactory::~AppListSyncableServiceFactory() {
@@ -50,18 +52,12 @@ void AppListSyncableServiceFactory::RegisterProfilePrefs(
 
 content::BrowserContext* AppListSyncableServiceFactory::GetBrowserContextToUse(
     content::BrowserContext* context) const {
-  // In guest session, off the record profile should be used instead of the
-  // original one, as the off the record profile is the active profile.
-  // TODO(tbarzic): Add a helper function to incognito_helpers.h that properly
-  //     handles the guest mode.
+  // In Guest session, off the record profile should not be redirected to the
+  // original one.
   Profile* profile = static_cast<Profile*>(context);
   if (profile->IsGuestSession())
-    return profile->GetOffTheRecordProfile();
+    return chrome::GetBrowserContextOwnInstanceInIncognito(context);
   return chrome::GetBrowserContextRedirectedInIncognito(context);
 }
 
-bool AppListSyncableServiceFactory::ServiceIsCreatedWithBrowserContext() const {
-  return true;
-}
-
 }  // namespace app_list