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/browser_shutdown.h" | 5 #include "chrome/browser/browser_shutdown.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 31 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
32 #include "chrome/common/chrome_paths.h" | 32 #include "chrome/common/chrome_paths.h" |
33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
35 #include "chrome/common/switch_utils.h" | 35 #include "chrome/common/switch_utils.h" |
36 #include "content/browser/browser_thread.h" | 36 #include "content/browser/browser_thread.h" |
37 #include "content/browser/plugin_process_host.h" | 37 #include "content/browser/plugin_process_host.h" |
38 #include "content/browser/renderer_host/render_process_host.h" | 38 #include "content/browser/renderer_host/render_process_host.h" |
39 #include "content/browser/renderer_host/render_view_host.h" | 39 #include "content/browser/renderer_host/render_view_host.h" |
40 #include "content/browser/renderer_host/render_widget_host.h" | 40 #include "content/browser/renderer_host/render_widget_host.h" |
41 #include "net/predictor_api.h" | |
42 #include "ui/base/resource/resource_bundle.h" | 41 #include "ui/base/resource/resource_bundle.h" |
43 | 42 |
44 #if defined(OS_WIN) | 43 #if defined(OS_WIN) |
45 #include "chrome/browser/browser_util_win.h" | 44 #include "chrome/browser/browser_util_win.h" |
46 #include "chrome/browser/first_run/upgrade_util_win.h" | 45 #include "chrome/browser/first_run/upgrade_util_win.h" |
47 #include "chrome/browser/rlz/rlz.h" | 46 #include "chrome/browser/rlz/rlz.h" |
48 #endif | 47 #endif |
49 | 48 |
50 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
51 #include "chrome/browser/chromeos/boot_times_loader.h" | 50 #include "chrome/browser/chromeos/boot_times_loader.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 132 |
134 // The XInput2 event listener needs to be shut down earlier than when | 133 // The XInput2 event listener needs to be shut down earlier than when |
135 // Singletons are finally destroyed in AtExitManager. | 134 // Singletons are finally destroyed in AtExitManager. |
136 chromeos::XInputHierarchyChangedEventListener::GetInstance()->Stop(); | 135 chromeos::XInputHierarchyChangedEventListener::GetInstance()->Stop(); |
137 #endif | 136 #endif |
138 | 137 |
139 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough | 138 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough |
140 // time to get here. If you have something that *must* happen on end session, | 139 // time to get here. If you have something that *must* happen on end session, |
141 // consider putting it in BrowserProcessImpl::EndSession. | 140 // consider putting it in BrowserProcessImpl::EndSession. |
142 PrefService* prefs = g_browser_process->local_state(); | 141 PrefService* prefs = g_browser_process->local_state(); |
143 ProfileManager* profile_manager = g_browser_process->profile_manager(); | |
144 PrefService* user_prefs = profile_manager->GetDefaultProfile()->GetPrefs(); | |
145 | |
146 chrome_browser_net::SavePredictorStateForNextStartupAndTrim(user_prefs); | |
147 | 142 |
148 MetricsService* metrics = g_browser_process->metrics_service(); | 143 MetricsService* metrics = g_browser_process->metrics_service(); |
149 if (metrics) | 144 if (metrics) |
150 metrics->RecordCompletedSessionEnd(); | 145 metrics->RecordCompletedSessionEnd(); |
151 | 146 |
152 if (shutdown_type_ > NOT_VALID && shutdown_num_processes_ > 0) { | 147 if (shutdown_type_ > NOT_VALID && shutdown_num_processes_ > 0) { |
153 // Record the shutdown info so that we can put it into a histogram at next | 148 // Record the shutdown info so that we can put it into a histogram at next |
154 // startup. | 149 // startup. |
155 prefs->SetInteger(prefs::kShutdownType, shutdown_type_); | 150 prefs->SetInteger(prefs::kShutdownType, shutdown_type_); |
156 prefs->SetInteger(prefs::kShutdownNumProcesses, shutdown_num_processes_); | 151 prefs->SetInteger(prefs::kShutdownNumProcesses, shutdown_num_processes_); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 318 |
324 bool ShuttingDownWithoutClosingBrowsers() { | 319 bool ShuttingDownWithoutClosingBrowsers() { |
325 #if defined(USE_X11) | 320 #if defined(USE_X11) |
326 if (GetShutdownType() == browser_shutdown::END_SESSION) | 321 if (GetShutdownType() == browser_shutdown::END_SESSION) |
327 return true; | 322 return true; |
328 #endif | 323 #endif |
329 return false; | 324 return false; |
330 } | 325 } |
331 | 326 |
332 } // namespace browser_shutdown | 327 } // namespace browser_shutdown |
OLD | NEW |