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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 #include "content/public/common/content_switches.h" | 160 #include "content/public/common/content_switches.h" |
161 #include "content/public/common/main_function_params.h" | 161 #include "content/public/common/main_function_params.h" |
162 #include "device/geolocation/geolocation_delegate.h" | 162 #include "device/geolocation/geolocation_delegate.h" |
163 #include "device/geolocation/geolocation_provider.h" | 163 #include "device/geolocation/geolocation_provider.h" |
164 #include "media/base/media_resources.h" | 164 #include "media/base/media_resources.h" |
165 #include "net/base/net_module.h" | 165 #include "net/base/net_module.h" |
166 #include "net/cookies/cookie_monster.h" | 166 #include "net/cookies/cookie_monster.h" |
167 #include "net/http/http_network_layer.h" | 167 #include "net/http/http_network_layer.h" |
168 #include "net/http/http_stream_factory.h" | 168 #include "net/http/http_stream_factory.h" |
169 #include "net/url_request/url_request.h" | 169 #include "net/url_request/url_request.h" |
| 170 #include "printing/features/features.h" |
170 #include "ui/base/l10n/l10n_util.h" | 171 #include "ui/base/l10n/l10n_util.h" |
171 #include "ui/base/layout.h" | 172 #include "ui/base/layout.h" |
172 #include "ui/base/material_design/material_design_controller.h" | 173 #include "ui/base/material_design/material_design_controller.h" |
173 #include "ui/base/resource/resource_bundle.h" | 174 #include "ui/base/resource/resource_bundle.h" |
174 | 175 |
175 #if defined(OS_ANDROID) | 176 #if defined(OS_ANDROID) |
176 #include "chrome/browser/android/offline_pages/offline_page_info_handler.h" | 177 #include "chrome/browser/android/offline_pages/offline_page_info_handler.h" |
177 #include "chrome/browser/metrics/thread_watcher_android.h" | 178 #include "chrome/browser/metrics/thread_watcher_android.h" |
178 #include "ui/base/resource/resource_bundle_android.h" | 179 #include "ui/base/resource/resource_bundle_android.h" |
179 #else | 180 #else |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 #include "chrome/browser/background/background_mode_manager.h" | 238 #include "chrome/browser/background/background_mode_manager.h" |
238 #endif // BUILDFLAG(ENABLE_BACKGROUND) | 239 #endif // BUILDFLAG(ENABLE_BACKGROUND) |
239 | 240 |
240 #if defined(ENABLE_EXTENSIONS) | 241 #if defined(ENABLE_EXTENSIONS) |
241 #include "chrome/browser/extensions/startup_helper.h" | 242 #include "chrome/browser/extensions/startup_helper.h" |
242 #include "extensions/browser/extension_protocols.h" | 243 #include "extensions/browser/extension_protocols.h" |
243 #include "extensions/common/features/feature_provider.h" | 244 #include "extensions/common/features/feature_provider.h" |
244 #include "extensions/components/javascript_dialog_extensions_client/javascript_d
ialog_extension_client_impl.h" | 245 #include "extensions/components/javascript_dialog_extensions_client/javascript_d
ialog_extension_client_impl.h" |
245 #endif // defined(ENABLE_EXTENSIONS) | 246 #endif // defined(ENABLE_EXTENSIONS) |
246 | 247 |
247 #if defined(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) | 248 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) |
248 #include "printing/printed_document.h" | 249 #include "printing/printed_document.h" |
249 #endif // defined(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) | 250 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) |
250 | 251 |
251 #if defined(ENABLE_RLZ) | 252 #if defined(ENABLE_RLZ) |
252 #include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h" | 253 #include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h" |
253 #include "components/rlz/rlz_tracker.h" | 254 #include "components/rlz/rlz_tracker.h" |
254 #endif // defined(ENABLE_RLZ) | 255 #endif // defined(ENABLE_RLZ) |
255 | 256 |
256 #if defined(ENABLE_WEBRTC) | 257 #if defined(ENABLE_WEBRTC) |
257 #include "chrome/browser/media/webrtc/webrtc_log_util.h" | 258 #include "chrome/browser/media/webrtc/webrtc_log_util.h" |
258 #endif // defined(ENABLE_WEBRTC) | 259 #endif // defined(ENABLE_WEBRTC) |
259 | 260 |
(...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 // to see if it should do anything else. | 1768 // to see if it should do anything else. |
1768 // | 1769 // |
1769 // A simpler way of doing all this would be to have some function which could | 1770 // A simpler way of doing all this would be to have some function which could |
1770 // give the time elapsed since startup, and simply have this object check that | 1771 // give the time elapsed since startup, and simply have this object check that |
1771 // when asked to initialize itself, but this doesn't seem to exist. | 1772 // when asked to initialize itself, but this doesn't seem to exist. |
1772 // | 1773 // |
1773 // This can't be created in the BrowserProcessImpl constructor because it | 1774 // This can't be created in the BrowserProcessImpl constructor because it |
1774 // needs to read prefs that get set after that runs. | 1775 // needs to read prefs that get set after that runs. |
1775 browser_process_->intranet_redirect_detector(); | 1776 browser_process_->intranet_redirect_detector(); |
1776 | 1777 |
1777 #if defined(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) | 1778 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) |
1778 if (parsed_command_line().HasSwitch(switches::kDebugPrint)) { | 1779 if (parsed_command_line().HasSwitch(switches::kDebugPrint)) { |
1779 base::FilePath path = | 1780 base::FilePath path = |
1780 parsed_command_line().GetSwitchValuePath(switches::kDebugPrint); | 1781 parsed_command_line().GetSwitchValuePath(switches::kDebugPrint); |
1781 printing::PrintedDocument::set_debug_dump_path(path); | 1782 printing::PrintedDocument::set_debug_dump_path(path); |
1782 } | 1783 } |
1783 #endif // defined(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) | 1784 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) |
1784 | 1785 |
1785 HandleTestParameters(parsed_command_line()); | 1786 HandleTestParameters(parsed_command_line()); |
1786 browser_process_->metrics_service()->RecordBreakpadHasDebugger( | 1787 browser_process_->metrics_service()->RecordBreakpadHasDebugger( |
1787 base::debug::BeingDebugged()); | 1788 base::debug::BeingDebugged()); |
1788 | 1789 |
1789 language_usage_metrics::LanguageUsageMetrics::RecordAcceptLanguages( | 1790 language_usage_metrics::LanguageUsageMetrics::RecordAcceptLanguages( |
1790 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); | 1791 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
1791 language_usage_metrics::LanguageUsageMetrics::RecordApplicationLanguage( | 1792 language_usage_metrics::LanguageUsageMetrics::RecordApplicationLanguage( |
1792 browser_process_->GetApplicationLocale()); | 1793 browser_process_->GetApplicationLocale()); |
1793 | 1794 |
1794 // Start watching for hangs during startup. We disarm this hang detector when | 1795 // Start watching for hangs during startup. We disarm this hang detector when |
1795 // ThreadWatcher takes over or when browser is shutdown or when | 1796 // ThreadWatcher takes over or when browser is shutdown or when |
1796 // startup_watcher_ is deleted. | 1797 // startup_watcher_ is deleted. |
1797 metrics::MetricsService::SetExecutionPhase( | 1798 metrics::MetricsService::SetExecutionPhase( |
1798 metrics::MetricsService::STARTUP_TIMEBOMB_ARM, | 1799 metrics::MetricsService::STARTUP_TIMEBOMB_ARM, |
1799 g_browser_process->local_state()); | 1800 g_browser_process->local_state()); |
1800 startup_watcher_->Arm(base::TimeDelta::FromSeconds(600)); | 1801 startup_watcher_->Arm(base::TimeDelta::FromSeconds(600)); |
1801 | 1802 |
1802 // On mobile, need for clean shutdown arises only when the application comes | 1803 // On mobile, need for clean shutdown arises only when the application comes |
1803 // to foreground (i.e. MetricsService::OnAppEnterForeground is called). | 1804 // to foreground (i.e. MetricsService::OnAppEnterForeground is called). |
1804 // http://crbug.com/179143 | 1805 // http://crbug.com/179143 |
1805 #if !defined(OS_ANDROID) | 1806 #if !defined(OS_ANDROID) |
1806 // Start watching for a hang. | 1807 // Start watching for a hang. |
1807 browser_process_->metrics_service()->LogNeedForCleanShutdown(); | 1808 browser_process_->metrics_service()->LogNeedForCleanShutdown(); |
1808 #endif // !defined(OS_ANDROID) | 1809 #endif // !defined(OS_ANDROID) |
1809 | 1810 |
1810 #if defined(ENABLE_PRINT_PREVIEW) | 1811 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
1811 // Create the instance of the cloud print proxy service so that it can launch | 1812 // Create the instance of the cloud print proxy service so that it can launch |
1812 // the service process if needed. This is needed because the service process | 1813 // the service process if needed. This is needed because the service process |
1813 // might have shutdown because an update was available. | 1814 // might have shutdown because an update was available. |
1814 // TODO(torne): this should maybe be done with | 1815 // TODO(torne): this should maybe be done with |
1815 // BrowserContextKeyedServiceFactory::ServiceIsCreatedWithBrowserContext() | 1816 // BrowserContextKeyedServiceFactory::ServiceIsCreatedWithBrowserContext() |
1816 // instead? | 1817 // instead? |
1817 CloudPrintProxyServiceFactory::GetForProfile(profile_); | 1818 CloudPrintProxyServiceFactory::GetForProfile(profile_); |
1818 #endif // defined(ENABLE_PRINT_PREVIEW) | 1819 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) |
1819 | 1820 |
1820 // Start watching all browser threads for responsiveness. | 1821 // Start watching all browser threads for responsiveness. |
1821 metrics::MetricsService::SetExecutionPhase( | 1822 metrics::MetricsService::SetExecutionPhase( |
1822 metrics::MetricsService::THREAD_WATCHER_START, | 1823 metrics::MetricsService::THREAD_WATCHER_START, |
1823 g_browser_process->local_state()); | 1824 g_browser_process->local_state()); |
1824 ThreadWatcherList::StartWatchingAll(parsed_command_line()); | 1825 ThreadWatcherList::StartWatchingAll(parsed_command_line()); |
1825 | 1826 |
1826 #if defined(OS_ANDROID) | 1827 #if defined(OS_ANDROID) |
1827 ThreadWatcherAndroid::RegisterApplicationStatusListener(); | 1828 ThreadWatcherAndroid::RegisterApplicationStatusListener(); |
1828 offline_pages::OfflinePageInfoHandler::Register(); | 1829 offline_pages::OfflinePageInfoHandler::Register(); |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2111 chromeos::CrosSettings::Shutdown(); | 2112 chromeos::CrosSettings::Shutdown(); |
2112 #endif // defined(OS_CHROMEOS) | 2113 #endif // defined(OS_CHROMEOS) |
2113 #endif // defined(OS_ANDROID) | 2114 #endif // defined(OS_ANDROID) |
2114 } | 2115 } |
2115 | 2116 |
2116 // Public members: | 2117 // Public members: |
2117 | 2118 |
2118 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2119 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
2119 chrome_extra_parts_.push_back(parts); | 2120 chrome_extra_parts_.push_back(parts); |
2120 } | 2121 } |
OLD | NEW |