Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / login / login_utils.cc
index 7e92c2b..80c76fa 100644 (file)
@@ -14,8 +14,8 @@
 #include "base/callback.h"
 #include "base/command_line.h"
 #include "base/compiler_specific.h"
-#include "base/file_util.h"
 #include "base/files/file_path.h"
+#include "base/files/file_util.h"
 #include "base/location.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
@@ -36,7 +36,7 @@
 #include "chrome/browser/browser_shutdown.h"
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/chromeos/boot_times_loader.h"
-#include "chrome/browser/chromeos/login/auth/parallel_authenticator.h"
+#include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h"
 #include "chrome/browser/chromeos/login/chrome_restart_request.h"
 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h"
 #include "chrome/browser/chromeos/login/existing_user_controller.h"
 #include "net/url_request/url_request_context_getter.h"
 #include "url/gurl.h"
 
+#if defined(USE_ATHENA)
+#include "athena/extensions/public/extensions_delegate.h"
+#include "athena/main/public/athena_launcher.h"
+#endif
+
 using content::BrowserThread;
 
 namespace {
@@ -159,6 +164,10 @@ bool CanPerformEarlyRestart() {
   if (controller->auth_mode() != LoginPerformer::AUTH_MODE_INTERNAL)
     return false;
 
+  // No early restart if Easy unlock key needs to be updated.
+  if (UserSessionManager::GetInstance()->NeedsToUpdateEasyUnlockKeys())
+    return false;
+
   return true;
 }
 
@@ -284,6 +293,11 @@ void LoginUtilsImpl::DoBrowserLaunchInternal(Profile* profile,
 
   VLOG(1) << "Launching browser...";
   TRACE_EVENT0("login", "LaunchBrowser");
+
+#if defined(USE_ATHENA)
+  athena::ExtensionsDelegate::CreateExtensionsDelegateForChrome(profile);
+  athena::StartAthenaSessionWithContext(profile);
+#else
   StartupBrowserCreator browser_creator;
   int return_code;
   chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
@@ -298,6 +312,7 @@ void LoginUtilsImpl::DoBrowserLaunchInternal(Profile* profile,
 
   // Triggers app launcher start page service to load start page web contents.
   app_list::StartPageService::Get(profile);
+#endif
 
   // Mark login host for deletion after browser starts.  This
   // guarantees that the message loop will be referenced by the
@@ -421,7 +436,7 @@ scoped_refptr<Authenticator> LoginUtilsImpl::CreateAuthenticator(
   }
 
   if (authenticator_.get() == NULL) {
-    authenticator_ = new ParallelAuthenticator(consumer);
+    authenticator_ = new ChromeCryptohomeAuthenticator(consumer);
   } else {
     // TODO(nkostylev): Fix this hack by improving Authenticator dependencies.
     authenticator_->SetConsumer(consumer);
@@ -442,6 +457,14 @@ void LoginUtilsImpl::OnRlzInitialized() {
 #endif
 
 void LoginUtilsImpl::AttemptRestart(Profile* profile) {
+  if (UserSessionManager::GetInstance()
+          ->CheckEasyUnlockKeyOps(
+              base::Bind(&LoginUtilsImpl::AttemptRestart,
+                         base::Unretained(this),
+                         profile))) {
+    return;
+  }
+
   if (UserSessionManager::GetInstance()->GetSigninSessionRestoreStrategy() !=
       OAuth2LoginManager::RESTORE_FROM_COOKIE_JAR) {
     chrome::AttemptRestart();