OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 7 #include <string> |
8 | 8 |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 10 matching lines...) Loading... |
21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
22 #include "chrome/browser/about_flags.h" | 22 #include "chrome/browser/about_flags.h" |
23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
24 #include "chrome/browser/browser_thread.h" | 24 #include "chrome/browser/browser_thread.h" |
25 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 25 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
26 #include "chrome/browser/first_run/first_run.h" | 26 #include "chrome/browser/first_run/first_run.h" |
27 #include "chrome/browser/jankometer.h" | 27 #include "chrome/browser/jankometer.h" |
28 #include "chrome/browser/metrics/metrics_service.h" | 28 #include "chrome/browser/metrics/metrics_service.h" |
29 #include "chrome/browser/plugin_process_host.h" | 29 #include "chrome/browser/plugin_process_host.h" |
30 #include "chrome/browser/prefs/pref_service.h" | 30 #include "chrome/browser/prefs/pref_service.h" |
| 31 #include "chrome/browser/profiles/profile_manager.h" |
31 #include "chrome/browser/renderer_host/render_process_host.h" | 32 #include "chrome/browser/renderer_host/render_process_host.h" |
32 #include "chrome/browser/renderer_host/render_view_host.h" | 33 #include "chrome/browser/renderer_host/render_view_host.h" |
33 #include "chrome/browser/renderer_host/render_widget_host.h" | 34 #include "chrome/browser/renderer_host/render_widget_host.h" |
34 #include "chrome/browser/service/service_process_control_manager.h" | 35 #include "chrome/browser/service/service_process_control_manager.h" |
35 #include "chrome/common/chrome_paths.h" | 36 #include "chrome/common/chrome_paths.h" |
36 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
37 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
38 #include "chrome/common/chrome_plugin_lib.h" | 39 #include "chrome/common/chrome_plugin_lib.h" |
39 #include "chrome/common/switch_utils.h" | 40 #include "chrome/common/switch_utils.h" |
40 #include "net/predictor_api.h" | 41 #include "net/predictor_api.h" |
(...skipping 84 matching lines...) Loading... |
125 | 126 |
126 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough | 127 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough |
127 // time to get here. If you have something that *must* happen on end session, | 128 // time to get here. If you have something that *must* happen on end session, |
128 // consider putting it in BrowserProcessImpl::EndSession. | 129 // consider putting it in BrowserProcessImpl::EndSession. |
129 DCHECK(g_browser_process); | 130 DCHECK(g_browser_process); |
130 | 131 |
131 // Notifies we are going away. | 132 // Notifies we are going away. |
132 g_browser_process->shutdown_event()->Signal(); | 133 g_browser_process->shutdown_event()->Signal(); |
133 | 134 |
134 PrefService* prefs = g_browser_process->local_state(); | 135 PrefService* prefs = g_browser_process->local_state(); |
| 136 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 137 PrefService* user_prefs = profile_manager->GetDefaultProfile()->GetPrefs(); |
135 | 138 |
136 chrome_browser_net::SavePredictorStateForNextStartupAndTrim(prefs); | 139 chrome_browser_net::SavePredictorStateForNextStartupAndTrim(user_prefs); |
137 | 140 |
138 MetricsService* metrics = g_browser_process->metrics_service(); | 141 MetricsService* metrics = g_browser_process->metrics_service(); |
139 if (metrics) { | 142 if (metrics) { |
140 metrics->RecordCleanShutdown(); | 143 metrics->RecordCleanShutdown(); |
141 metrics->RecordCompletedSessionEnd(); | 144 metrics->RecordCompletedSessionEnd(); |
142 } | 145 } |
143 | 146 |
144 if (shutdown_type_ > NOT_VALID && shutdown_num_processes_ > 0) { | 147 if (shutdown_type_ > NOT_VALID && shutdown_num_processes_ > 0) { |
145 // 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 |
146 // startup. | 149 // startup. |
(...skipping 172 matching lines...) Loading... |
319 | 322 |
320 bool ShuttingDownWithoutClosingBrowsers() { | 323 bool ShuttingDownWithoutClosingBrowsers() { |
321 #if defined(USE_X11) | 324 #if defined(USE_X11) |
322 if (GetShutdownType() == browser_shutdown::END_SESSION) | 325 if (GetShutdownType() == browser_shutdown::END_SESSION) |
323 return true; | 326 return true; |
324 #endif | 327 #endif |
325 return false; | 328 return false; |
326 } | 329 } |
327 | 330 |
328 } // namespace browser_shutdown | 331 } // namespace browser_shutdown |
OLD | NEW |