Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / signin / easy_unlock_service_factory.cc
index 4e90429..cb981ee 100644 (file)
@@ -4,16 +4,20 @@
 
 #include "chrome/browser/signin/easy_unlock_service_factory.h"
 
+#include "base/command_line.h"
 #include "base/memory/singleton.h"
 #include "chrome/browser/profiles/incognito_helpers.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/signin/easy_unlock_service.h"
+#include "chrome/browser/signin/easy_unlock_service_regular.h"
 #include "components/keyed_service/content/browser_context_dependency_manager.h"
 #include "extensions/browser/extension_system_provider.h"
 #include "extensions/browser/extensions_browser_client.h"
 
 #if defined(OS_CHROMEOS)
 #include "chrome/browser/chromeos/profiles/profile_helper.h"
+#include "chrome/browser/signin/easy_unlock_service_signin_chromeos.h"
+#include "chromeos/chromeos_switches.h"
 #endif
 
 // static
@@ -41,17 +45,22 @@ EasyUnlockServiceFactory::~EasyUnlockServiceFactory() {
 
 KeyedService* EasyUnlockServiceFactory::BuildServiceInstanceFor(
     content::BrowserContext* context) const {
-  return new EasyUnlockService(Profile::FromBrowserContext(context));
-}
-
-content::BrowserContext* EasyUnlockServiceFactory::GetBrowserContextToUse(
-      content::BrowserContext* context) const {
 #if defined(OS_CHROMEOS)
   if (chromeos::ProfileHelper::IsSigninProfile(
           Profile::FromBrowserContext(context))) {
-    return NULL;
+    if (CommandLine::ForCurrentProcess()->HasSwitch(
+            chromeos::switches::kEnableEasySignin)) {
+      return new EasyUnlockServiceSignin(Profile::FromBrowserContext(context));
+    } else {
+      return NULL;
+    }
   }
 #endif
+  return new EasyUnlockServiceRegular(Profile::FromBrowserContext(context));
+}
+
+content::BrowserContext* EasyUnlockServiceFactory::GetBrowserContextToUse(
+      content::BrowserContext* context) const {
   return chrome::GetBrowserContextRedirectedInIncognito(context);
 }