OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 | 553 |
554 void ProfileImpl::set_last_selected_directory(const FilePath& path) { | 554 void ProfileImpl::set_last_selected_directory(const FilePath& path) { |
555 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); | 555 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); |
556 } | 556 } |
557 | 557 |
558 ProfileImpl::~ProfileImpl() { | 558 ProfileImpl::~ProfileImpl() { |
559 content::NotificationService::current()->Notify( | 559 content::NotificationService::current()->Notify( |
560 chrome::NOTIFICATION_PROFILE_DESTROYED, | 560 chrome::NOTIFICATION_PROFILE_DESTROYED, |
561 content::Source<Profile>(this), | 561 content::Source<Profile>(this), |
562 content::NotificationService::NoDetails()); | 562 content::NotificationService::NoDetails()); |
563 // Save the session state if we're going to restore the session during the | |
564 // next startup. | |
565 SessionStartupPref pref = SessionStartupPref::GetStartupPref(this); | 563 SessionStartupPref pref = SessionStartupPref::GetStartupPref(this); |
566 if (pref.type == SessionStartupPref::LAST) { | 564 // Honor the "clear local state" setting. If it's not set, keep the session |
567 if (session_restore_enabled_) | 565 // data if we're going to continue the session upon startup. |
568 BrowserContext::SaveSessionState(this); | 566 if (clear_local_state_on_exit_) |
569 } else if (clear_local_state_on_exit_) { | |
570 BrowserContext::ClearLocalOnDestruction(this); | 567 BrowserContext::ClearLocalOnDestruction(this); |
571 } | 568 else if (session_restore_enabled_ && pref.type == SessionStartupPref::LAST) |
| 569 BrowserContext::SaveSessionState(this); |
572 | 570 |
573 StopCreateSessionServiceTimer(); | 571 StopCreateSessionServiceTimer(); |
574 | 572 |
575 // Remove pref observers | 573 // Remove pref observers |
576 pref_change_registrar_.RemoveAll(); | 574 pref_change_registrar_.RemoveAll(); |
577 | 575 |
578 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( | 576 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( |
579 io_data_.GetResourceContextNoInit()); | 577 io_data_.GetResourceContextNoInit()); |
580 | 578 |
581 if (io_data_.HasMainRequestContext() && | 579 if (io_data_.HasMainRequestContext() && |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 FilePath* cache_path, | 1344 FilePath* cache_path, |
1347 int* max_size) { | 1345 int* max_size) { |
1348 DCHECK(cache_path); | 1346 DCHECK(cache_path); |
1349 DCHECK(max_size); | 1347 DCHECK(max_size); |
1350 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1348 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
1351 if (!path.empty()) | 1349 if (!path.empty()) |
1352 *cache_path = path; | 1350 *cache_path = path; |
1353 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1351 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1354 prefs_->GetInteger(prefs::kDiskCacheSize); | 1352 prefs_->GetInteger(prefs::kDiskCacheSize); |
1355 } | 1353 } |
OLD | NEW |