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

Side by Side Diff: chrome/browser/profiles/profile_impl.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: 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
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/profiles/profile_impl.h" 5 #include "chrome/browser/profiles/profile_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 int media_cache_max_size; 360 int media_cache_max_size;
361 GetCacheParameters(true, &media_cache_path, &media_cache_max_size); 361 GetCacheParameters(true, &media_cache_path, &media_cache_max_size);
362 media_cache_path = GetMediaCachePath(media_cache_path); 362 media_cache_path = GetMediaCachePath(media_cache_path);
363 363
364 FilePath extensions_cookie_path = GetPath(); 364 FilePath extensions_cookie_path = GetPath();
365 extensions_cookie_path = 365 extensions_cookie_path =
366 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename); 366 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename);
367 367
368 FilePath app_path = GetPath().Append(chrome::kIsolatedAppStateDirname); 368 FilePath app_path = GetPath().Append(chrome::kIsolatedAppStateDirname);
369 369
370 PrefService* pref_service = g_browser_process->local_state();
370 bool restore_old_session_cookies = 371 bool restore_old_session_cookies =
371 session_restore_enabled_ && 372 session_restore_enabled_ &&
372 (!DidLastSessionExitCleanly() || 373 (!DidLastSessionExitCleanly() ||
373 CommandLine::ForCurrentProcess()->HasSwitch( 374 CommandLine::ForCurrentProcess()->HasSwitch(
374 switches::kRestoreLastSession)); 375 switches::kRestoreLastSession) ||
376 pref_service->GetBoolean(prefs::kWasRestarted));
375 377
376 // Make sure we initialize the ProfileIOData after everything else has been 378 // Make sure we initialize the ProfileIOData after everything else has been
377 // initialized that we might be reading from the IO thread. 379 // initialized that we might be reading from the IO thread.
378 380
379 io_data_.Init(cookie_path, origin_bound_cert_path, cache_path, 381 io_data_.Init(cookie_path, origin_bound_cert_path, cache_path,
380 cache_max_size, media_cache_path, media_cache_max_size, 382 cache_max_size, media_cache_path, media_cache_max_size,
381 extensions_cookie_path, app_path, predictor_, 383 extensions_cookie_path, app_path, predictor_,
382 g_browser_process->local_state(), 384 g_browser_process->local_state(),
383 g_browser_process->io_thread(), 385 g_browser_process->io_thread(),
384 restore_old_session_cookies); 386 restore_old_session_cookies);
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 FilePath* cache_path, 1616 FilePath* cache_path,
1615 int* max_size) { 1617 int* max_size) {
1616 DCHECK(cache_path); 1618 DCHECK(cache_path);
1617 DCHECK(max_size); 1619 DCHECK(max_size);
1618 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); 1620 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir));
1619 if (!path.empty()) 1621 if (!path.empty())
1620 *cache_path = path; 1622 *cache_path = path;
1621 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : 1623 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) :
1622 prefs_->GetInteger(prefs::kDiskCacheSize); 1624 prefs_->GetInteger(prefs::kDiskCacheSize);
1623 } 1625 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698