Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / profiles / profile_util.cc
index 25222ba..ed4fa10 100644 (file)
@@ -4,6 +4,8 @@
 
 #include "chrome/browser/chromeos/profiles/profile_util.h"
 
+#include "base/files/file_path.h"
+#include "chrome/browser/chromeos/profiles/profile_helper.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chromeos/login/login_state.h"
 
@@ -16,6 +18,13 @@ bool IsProfileAssociatedWithGaiaAccount(Profile* profile) {
     return false;
   if (profile->IsOffTheRecord())
     return false;
+
+  // Using ProfileHelper::GetSigninProfile() here would lead to an infinite loop
+  // when this method is called during the creation of the sign-in profile
+  // itself. Using ProfileHelper::GetSigninProfileDir() is safe because it does
+  // not try to access the sign-in profile.
+  if (profile->GetPath() == ProfileHelper::GetSigninProfileDir())
+    return false;
   return true;
 }