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

Unified Diff: chrome/browser/browser_shutdown.cc

Issue 5278001: Add a preference to clear Flash LSO data in the Clear Browsing Data dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: formatting Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/browsing_data_remover.h » ('j') | chrome/browser/plugin_data_remover.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_shutdown.cc
diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc
index e136ef85130298f0ce961f065cf0e4eccf6e1113..87728fdb2a32fb619ac27f052e2baaeb3d512692 100644
--- a/chrome/browser/browser_shutdown.cc
+++ b/chrome/browser/browser_shutdown.cc
@@ -26,8 +26,10 @@
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/jankometer.h"
#include "chrome/browser/metrics/metrics_service.h"
+#include "chrome/browser/plugin_data_remover.h"
#include "chrome/browser/plugin_process_host.h"
#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profile_manager.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_widget_host.h"
@@ -115,14 +117,6 @@ void Shutdown() {
// shutdown.
base::ThreadRestrictions::SetIOAllowed(true);
- // Unload plugins. This needs to happen on the IO thread.
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- NewRunnableFunction(&ChromePluginLib::UnloadAllPlugins));
-
- // Shutdown all IPC channels to service processes.
- ServiceProcessControlManager::instance()->Shutdown();
-
// WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough
// time to get here. If you have something that *must* happen on end session,
// consider putting it in BrowserProcessImpl::EndSession.
@@ -131,9 +125,29 @@ void Shutdown() {
// Notifies we are going away.
g_browser_process->shutdown_event()->Signal();
- PrefService* prefs = g_browser_process->local_state();
+ PrefService* local_state = g_browser_process->local_state();
+
+ // Unload plugins. This needs to happen on the IO thread.
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ NewRunnableFunction(&ChromePluginLib::UnloadAllPlugins));
+
+ Profile* profile = ProfileManager::GetDefaultProfile();
+ if (profile) {
+ // Store the profile path for clearing local state data on exit.
+ PrefService* prefs = profile->GetPrefs();
+ if (prefs->GetBoolean(prefs::kClearPluginLSODataOnExit) &&
+ local_state->GetBoolean(prefs::kClearPluginLSODataEnabled)) {
+ PluginDataRemover remover;
+ remover.StartRemoving(base::Time(), new MessageLoop::QuitTask());
jam 2010/11/29 17:14:08 I have a big concern about blocking our shutdown t
+ MessageLoop::current()->Run();
+ }
+ }
+
+ // Shutdown all IPC channels to service processes.
+ ServiceProcessControlManager::instance()->Shutdown();
- chrome_browser_net::SavePredictorStateForNextStartupAndTrim(prefs);
+ chrome_browser_net::SavePredictorStateForNextStartupAndTrim(local_state);
MetricsService* metrics = g_browser_process->metrics_service();
if (metrics) {
@@ -144,21 +158,22 @@ void Shutdown() {
if (shutdown_type_ > NOT_VALID && shutdown_num_processes_ > 0) {
// Record the shutdown info so that we can put it into a histogram at next
// startup.
- prefs->SetInteger(prefs::kShutdownType, shutdown_type_);
- prefs->SetInteger(prefs::kShutdownNumProcesses, shutdown_num_processes_);
- prefs->SetInteger(prefs::kShutdownNumProcessesSlow,
- shutdown_num_processes_slow_);
+ local_state->SetInteger(prefs::kShutdownType, shutdown_type_);
+ local_state->SetInteger(prefs::kShutdownNumProcesses,
+ shutdown_num_processes_);
+ local_state->SetInteger(prefs::kShutdownNumProcessesSlow,
+ shutdown_num_processes_slow_);
}
// Check local state for the restart flag so we can restart the session below.
bool restart_last_session = false;
- if (prefs->HasPrefPath(prefs::kRestartLastSessionOnShutdown)) {
+ if (local_state->HasPrefPath(prefs::kRestartLastSessionOnShutdown)) {
restart_last_session =
- prefs->GetBoolean(prefs::kRestartLastSessionOnShutdown);
- prefs->ClearPref(prefs::kRestartLastSessionOnShutdown);
+ local_state->GetBoolean(prefs::kRestartLastSessionOnShutdown);
+ local_state->ClearPref(prefs::kRestartLastSessionOnShutdown);
}
- prefs->SavePersistentPrefs();
+ local_state->SavePersistentPrefs();
#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
// Cleanup any statics created by RLZ. Must be done before NotificationService
« no previous file with comments | « no previous file | chrome/browser/browsing_data_remover.h » ('j') | chrome/browser/plugin_data_remover.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698