Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: chrome/browser/ui/browser_init.cc

Issue 8745015: Store the "browser autorestarted, last session must be restored" information in a preference. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix (browser_tests). Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698