1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/profiles/profile_util.h"
7 #include "base/files/file_path.h"
8 #include "chrome/browser/chromeos/profiles/profile_helper.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chromeos/login/login_state.h"
14 bool IsProfileAssociatedWithGaiaAccount(Profile
* profile
) {
15 if (!chromeos::LoginState::IsInitialized())
17 if (!chromeos::LoginState::Get()->IsUserGaiaAuthenticated())
19 if (profile
->IsOffTheRecord())
22 // Using ProfileHelper::GetSigninProfile() here would lead to an infinite loop
23 // when this method is called during the creation of the sign-in profile
24 // itself. Using ProfileHelper::GetSigninProfileDir() is safe because it does
25 // not try to access the sign-in profile.
26 if (profile
->GetPath() == ProfileHelper::GetSigninProfileDir())
31 } // namespace chromeos