Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / profiles / profile_manager.cc
index c4ce8f7..f14f5ca 100644 (file)
@@ -62,9 +62,9 @@
 
 #if !defined(OS_IOS)
 #include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_system.h"
 #include "chrome/browser/sessions/session_service_factory.h"
 #include "chrome/browser/ui/browser_list.h"
+#include "extensions/browser/extension_system.h"
 #endif  // !defined (OS_IOS)
 
 #if defined(OS_WIN)
@@ -475,8 +475,11 @@ Profile* ProfileManager::GetLastUsedProfile(
       profile_dir =
           chromeos::ProfileHelper::GetProfileDirByLegacyLoginProfileSwitch();
     }
+
     base::FilePath profile_path(user_data_dir);
-    return GetProfile(profile_path.Append(profile_dir));
+    Profile* profile = GetProfile(profile_path.Append(profile_dir));
+    return profile->IsGuestSession() ? profile->GetOffTheRecordProfile() :
+                                       profile;
   }
 #endif
 
@@ -1107,23 +1110,23 @@ void ProfileManager::AddProfileToCache(Profile* profile) {
 }
 
 void ProfileManager::SetGuestProfilePrefs(Profile* profile) {
+  // This can be removed in the future but needs to be present through
+  // a release (or two) so that any existing installs get switched to
+  // the new state and away from the previous "forced" state.
   IncognitoModePrefs::SetAvailability(profile->GetPrefs(),
-                                      IncognitoModePrefs::FORCED);
-  profile->GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, false);
+                                      IncognitoModePrefs::ENABLED);
 }
 
 bool ProfileManager::ShouldGoOffTheRecord(Profile* profile) {
-  bool go_off_the_record = false;
 #if defined(OS_CHROMEOS)
   const CommandLine& command_line = *CommandLine::ForCurrentProcess();
-  if (command_line.HasSwitch(chromeos::switches::kGuestSession) ||
-      (profile->GetPath().BaseName().value() == chrome::kInitialProfile &&
-       (!command_line.HasSwitch(switches::kTestType) ||
-       command_line.HasSwitch(chromeos::switches::kLoginProfile)))) {
-    go_off_the_record = true;
+  if (profile->GetPath().BaseName().value() == chrome::kInitialProfile &&
+      (!command_line.HasSwitch(switches::kTestType) ||
+       command_line.HasSwitch(chromeos::switches::kLoginProfile))) {
+    return true;
   }
 #endif
-  return go_off_the_record;
+  return profile->IsGuestSession();
 }
 
 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks,