| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/browser_init.h" | 5 #include "chrome/browser/ui/browser_init.h" |
| 6 | 6 |
| 7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 const PrefService* prefs) { | 325 const PrefService* prefs) { |
| 326 IncognitoModePrefs::Availability incognito_avail = | 326 IncognitoModePrefs::Availability incognito_avail = |
| 327 IncognitoModePrefs::GetAvailability(prefs); | 327 IncognitoModePrefs::GetAvailability(prefs); |
| 328 return incognito_avail != IncognitoModePrefs::DISABLED && | 328 return incognito_avail != IncognitoModePrefs::DISABLED && |
| 329 (command_line.HasSwitch(switches::kIncognito) || | 329 (command_line.HasSwitch(switches::kIncognito) || |
| 330 incognito_avail == IncognitoModePrefs::FORCED); | 330 incognito_avail == IncognitoModePrefs::FORCED); |
| 331 } | 331 } |
| 332 | 332 |
| 333 SessionStartupPref GetSessionStartupPref(const CommandLine& command_line, | 333 SessionStartupPref GetSessionStartupPref(const CommandLine& command_line, |
| 334 Profile* profile) { | 334 Profile* profile) { |
| 335 PrefService* pref_service = g_browser_process->local_state(); |
| 335 SessionStartupPref pref = SessionStartupPref::GetStartupPref(profile); | 336 SessionStartupPref pref = SessionStartupPref::GetStartupPref(profile); |
| 336 if (command_line.HasSwitch(switches::kRestoreLastSession)) | 337 if (command_line.HasSwitch(switches::kRestoreLastSession) || |
| 338 pref_service->GetBoolean(prefs::kWasRestarted)) { |
| 337 pref.type = SessionStartupPref::LAST; | 339 pref.type = SessionStartupPref::LAST; |
| 340 } |
| 338 if (pref.type == SessionStartupPref::LAST && | 341 if (pref.type == SessionStartupPref::LAST && |
| 339 IncognitoIsForced(command_line, profile->GetPrefs())) { | 342 IncognitoIsForced(command_line, profile->GetPrefs())) { |
| 340 // We don't store session information when incognito. If the user has | 343 // We don't store session information when incognito. If the user has |
| 341 // chosen to restore last session and launched incognito, fallback to | 344 // chosen to restore last session and launched incognito, fallback to |
| 342 // default launch behavior. | 345 // default launch behavior. |
| 343 pref.type = SessionStartupPref::DEFAULT; | 346 pref.type = SessionStartupPref::DEFAULT; |
| 344 } | 347 } |
| 345 return pref; | 348 return pref; |
| 346 } | 349 } |
| 347 | 350 |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 if (!automation->InitializeChannel(channel_id)) | 1489 if (!automation->InitializeChannel(channel_id)) |
| 1487 return false; | 1490 return false; |
| 1488 automation->SetExpectedTabCount(expected_tabs); | 1491 automation->SetExpectedTabCount(expected_tabs); |
| 1489 | 1492 |
| 1490 AutomationProviderList* list = g_browser_process->GetAutomationProviderList(); | 1493 AutomationProviderList* list = g_browser_process->GetAutomationProviderList(); |
| 1491 DCHECK(list); | 1494 DCHECK(list); |
| 1492 list->AddProvider(automation); | 1495 list->AddProvider(automation); |
| 1493 | 1496 |
| 1494 return true; | 1497 return true; |
| 1495 } | 1498 } |
| OLD | NEW |