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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 #include "chrome/browser/metrics/tracking_synchronizer.h" | 52 #include "chrome/browser/metrics/tracking_synchronizer.h" |
53 #include "chrome/browser/metrics/variations/variations_service.h" | 53 #include "chrome/browser/metrics/variations/variations_service.h" |
54 #include "chrome/browser/nacl_host/nacl_process_host.h" | 54 #include "chrome/browser/nacl_host/nacl_process_host.h" |
55 #include "chrome/browser/net/chrome_net_log.h" | 55 #include "chrome/browser/net/chrome_net_log.h" |
56 #include "chrome/browser/notifications/desktop_notification_service.h" | 56 #include "chrome/browser/notifications/desktop_notification_service.h" |
57 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 57 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
58 #include "chrome/browser/page_cycler/page_cycler.h" | 58 #include "chrome/browser/page_cycler/page_cycler.h" |
59 #include "chrome/browser/performance_monitor/performance_monitor.h" | 59 #include "chrome/browser/performance_monitor/performance_monitor.h" |
60 #include "chrome/browser/performance_monitor/startup_timer.h" | 60 #include "chrome/browser/performance_monitor/startup_timer.h" |
61 #include "chrome/browser/plugin_prefs.h" | 61 #include "chrome/browser/plugin_prefs.h" |
62 #include "chrome/browser/policy/policy_service.h" | |
62 #include "chrome/browser/prefs/pref_service.h" | 63 #include "chrome/browser/prefs/pref_service.h" |
63 #include "chrome/browser/prefs/pref_value_store.h" | 64 #include "chrome/browser/prefs/pref_value_store.h" |
64 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 65 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
65 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 66 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
66 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" | 67 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" |
67 #include "chrome/browser/process_singleton.h" | 68 #include "chrome/browser/process_singleton.h" |
68 #include "chrome/browser/profiles/profile.h" | 69 #include "chrome/browser/profiles/profile.h" |
69 #include "chrome/browser/profiles/profile_manager.h" | 70 #include "chrome/browser/profiles/profile_manager.h" |
70 #include "chrome/browser/search_engines/search_engine_type.h" | 71 #include "chrome/browser/search_engines/search_engine_type.h" |
71 #include "chrome/browser/search_engines/template_url.h" | 72 #include "chrome/browser/search_engines/template_url.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 #include "grit/platform_locale_settings.h" | 110 #include "grit/platform_locale_settings.h" |
110 #include "net/base/net_module.h" | 111 #include "net/base/net_module.h" |
111 #include "net/base/sdch_manager.h" | 112 #include "net/base/sdch_manager.h" |
112 #include "net/cookies/cookie_monster.h" | 113 #include "net/cookies/cookie_monster.h" |
113 #include "net/http/http_network_layer.h" | 114 #include "net/http/http_network_layer.h" |
114 #include "net/http/http_stream_factory.h" | 115 #include "net/http/http_stream_factory.h" |
115 #include "net/spdy/spdy_session.h" | 116 #include "net/spdy/spdy_session.h" |
116 #include "net/spdy/spdy_session_pool.h" | 117 #include "net/spdy/spdy_session_pool.h" |
117 #include "net/url_request/url_request.h" | 118 #include "net/url_request/url_request.h" |
118 #include "net/websockets/websocket_job.h" | 119 #include "net/websockets/websocket_job.h" |
120 #include "policy/policy_constants.h" | |
Joao da Silva
2012/09/18 11:35:56
policy_service.h is always available, but this hea
ramant (doing other things)
2012/09/18 21:16:23
Done.
| |
119 #include "ui/base/l10n/l10n_util.h" | 121 #include "ui/base/l10n/l10n_util.h" |
120 #include "ui/base/layout.h" | 122 #include "ui/base/layout.h" |
121 #include "ui/base/resource/resource_bundle.h" | 123 #include "ui/base/resource/resource_bundle.h" |
122 #include "ui/base/resource/resource_handle.h" | 124 #include "ui/base/resource/resource_handle.h" |
123 | 125 |
124 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 126 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
125 #include "chrome/browser/first_run/upgrade_util_linux.h" | 127 #include "chrome/browser/first_run/upgrade_util_linux.h" |
126 #endif | 128 #endif |
127 | 129 |
128 #if defined(OS_CHROMEOS) | 130 #if defined(OS_CHROMEOS) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 | 196 |
195 void AddFirstRunNewTabs(StartupBrowserCreator* browser_creator, | 197 void AddFirstRunNewTabs(StartupBrowserCreator* browser_creator, |
196 const std::vector<GURL>& new_tabs) { | 198 const std::vector<GURL>& new_tabs) { |
197 for (std::vector<GURL>::const_iterator it = new_tabs.begin(); | 199 for (std::vector<GURL>::const_iterator it = new_tabs.begin(); |
198 it != new_tabs.end(); ++it) { | 200 it != new_tabs.end(); ++it) { |
199 if (it->is_valid()) | 201 if (it->is_valid()) |
200 browser_creator->AddFirstRunTab(*it); | 202 browser_creator->AddFirstRunTab(*it); |
201 } | 203 } |
202 } | 204 } |
203 | 205 |
204 void InitializeNetworkOptions(const CommandLine& parsed_command_line) { | 206 void InitializeNetworkOptions(const CommandLine& parsed_command_line, |
207 policy::PolicyService* policy_service) { | |
205 if (parsed_command_line.HasSwitch(switches::kEnableFileCookies)) { | 208 if (parsed_command_line.HasSwitch(switches::kEnableFileCookies)) { |
206 // Enable cookie storage for file:// URLs. Must do this before the first | 209 // Enable cookie storage for file:// URLs. Must do this before the first |
207 // Profile (and therefore the first CookieMonster) is created. | 210 // Profile (and therefore the first CookieMonster) is created. |
208 net::CookieMonster::EnableFileScheme(); | 211 net::CookieMonster::EnableFileScheme(); |
209 } | 212 } |
210 | 213 |
214 #if defined(ENABLE_CONFIGURATION_POLICY) | |
215 bool has_spdy_policy = policy_service->GetPolicies( | |
216 policy::POLICY_DOMAIN_CHROME, | |
217 std::string()).Get(policy::key::kDisableSpdy) != NULL; | |
218 // If "spdy.disabled" peference is controlled via policy, then skip use-spdy | |
Joao da Silva
2012/09/18 11:35:56
Nit: "peference" typo
ramant (doing other things)
2012/09/18 21:16:23
Done.
| |
219 // command line flags. | |
220 if (has_spdy_policy) | |
221 return; | |
222 #endif // ENABLE_CONFIGURATION_POLICY | |
223 | |
211 if (parsed_command_line.HasSwitch(switches::kEnableIPPooling)) | 224 if (parsed_command_line.HasSwitch(switches::kEnableIPPooling)) |
212 net::SpdySessionPool::enable_ip_pooling(true); | 225 net::SpdySessionPool::enable_ip_pooling(true); |
213 | 226 |
214 if (parsed_command_line.HasSwitch(switches::kDisableIPPooling)) | 227 if (parsed_command_line.HasSwitch(switches::kDisableIPPooling)) |
215 net::SpdySessionPool::enable_ip_pooling(false); | 228 net::SpdySessionPool::enable_ip_pooling(false); |
216 | 229 |
217 if (parsed_command_line.HasSwitch(switches::kEnableSpdyCredentialFrames)) | 230 if (parsed_command_line.HasSwitch(switches::kEnableSpdyCredentialFrames)) |
218 net::SpdySession::set_enable_credential_frames(true); | 231 net::SpdySession::set_enable_credential_frames(true); |
219 | 232 |
220 if (parsed_command_line.HasSwitch(switches::kMaxSpdySessionsPerDomain)) { | 233 if (parsed_command_line.HasSwitch(switches::kMaxSpdySessionsPerDomain)) { |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
832 // TODO(viettrungluu): why don't we run this earlier? | 845 // TODO(viettrungluu): why don't we run this earlier? |
833 if (!parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) | 846 if (!parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) |
834 WarnAboutMinimumSystemRequirements(); | 847 WarnAboutMinimumSystemRequirements(); |
835 | 848 |
836 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) | 849 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) |
837 // Set the product channel for crash reports. | 850 // Set the product channel for crash reports. |
838 child_process_logging::SetChannel( | 851 child_process_logging::SetChannel( |
839 chrome::VersionInfo::GetVersionStringModifier()); | 852 chrome::VersionInfo::GetVersionStringModifier()); |
840 #endif | 853 #endif |
841 | 854 |
842 InitializeNetworkOptions(parsed_command_line()); | 855 InitializeNetworkOptions(parsed_command_line(), |
856 browser_process_->policy_service()); | |
843 | 857 |
844 // Initialize tracking synchronizer system. | 858 // Initialize tracking synchronizer system. |
845 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer(); | 859 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer(); |
846 | 860 |
847 // Now that all preferences have been registered, set the install date | 861 // Now that all preferences have been registered, set the install date |
848 // for the uninstall metrics if this is our first run. This only actually | 862 // for the uninstall metrics if this is our first run. This only actually |
849 // gets used if the user has metrics reporting enabled at uninstall time. | 863 // gets used if the user has metrics reporting enabled at uninstall time. |
850 int64 install_date = | 864 int64 install_date = |
851 local_state_->GetInt64(prefs::kUninstallMetricsInstallDate); | 865 local_state_->GetInt64(prefs::kUninstallMetricsInstallDate); |
852 if (install_date == 0) { | 866 if (install_date == 0) { |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1595 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1609 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1596 uma_name += "_XP"; | 1610 uma_name += "_XP"; |
1597 | 1611 |
1598 uma_name += "_PreRead_"; | 1612 uma_name += "_PreRead_"; |
1599 uma_name += pre_read_percentage; | 1613 uma_name += pre_read_percentage; |
1600 AddPreReadHistogramTime(uma_name.c_str(), time); | 1614 AddPreReadHistogramTime(uma_name.c_str(), time); |
1601 } | 1615 } |
1602 #endif | 1616 #endif |
1603 #endif | 1617 #endif |
1604 } | 1618 } |
OLD | NEW |