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...) Expand all 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 128 |
128 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough | 129 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough |
129 // time to get here. If you have something that *must* happen on end session, | 130 // time to get here. If you have something that *must* happen on end session, |
130 // consider putting it in BrowserProcessImpl::EndSession. | 131 // consider putting it in BrowserProcessImpl::EndSession. |
131 DCHECK(g_browser_process); | 132 DCHECK(g_browser_process); |
132 | 133 |
133 // Notifies we are going away. | 134 // Notifies we are going away. |
134 g_browser_process->shutdown_event()->Signal(); | 135 g_browser_process->shutdown_event()->Signal(); |
135 | 136 |
136 PrefService* prefs = g_browser_process->local_state(); | 137 PrefService* prefs = g_browser_process->local_state(); |
| 138 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 139 PrefService* user_prefs = profile_manager->GetDefaultProfile()->GetPrefs(); |
137 | 140 |
138 chrome_browser_net::SavePredictorStateForNextStartupAndTrim(prefs); | 141 chrome_browser_net::SavePredictorStateForNextStartupAndTrim(user_prefs); |
139 | 142 |
140 MetricsService* metrics = g_browser_process->metrics_service(); | 143 MetricsService* metrics = g_browser_process->metrics_service(); |
141 if (metrics) { | 144 if (metrics) { |
142 metrics->RecordCleanShutdown(); | 145 metrics->RecordCleanShutdown(); |
143 metrics->RecordCompletedSessionEnd(); | 146 metrics->RecordCompletedSessionEnd(); |
144 } | 147 } |
145 | 148 |
146 if (shutdown_type_ > NOT_VALID && shutdown_num_processes_ > 0) { | 149 if (shutdown_type_ > NOT_VALID && shutdown_num_processes_ > 0) { |
147 // Record the shutdown info so that we can put it into a histogram at next | 150 // Record the shutdown info so that we can put it into a histogram at next |
148 // startup. | 151 // startup. |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 330 |
328 bool ShuttingDownWithoutClosingBrowsers() { | 331 bool ShuttingDownWithoutClosingBrowsers() { |
329 #if defined(USE_X11) | 332 #if defined(USE_X11) |
330 if (GetShutdownType() == browser_shutdown::END_SESSION) | 333 if (GetShutdownType() == browser_shutdown::END_SESSION) |
331 return true; | 334 return true; |
332 #endif | 335 #endif |
333 return false; | 336 return false; |
334 } | 337 } |
335 | 338 |
336 } // namespace browser_shutdown | 339 } // namespace browser_shutdown |
OLD | NEW |