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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 #include "ui/base/win/dpi.h" | 155 #include "ui/base/win/dpi.h" |
155 #endif // defined(OS_WIN) | 156 #endif // defined(OS_WIN) |
156 | 157 |
157 #if defined(OS_MACOSX) | 158 #if defined(OS_MACOSX) |
158 #include <Security/Security.h> | 159 #include <Security/Security.h> |
159 | 160 |
160 #include "base/mac/scoped_nsautorelease_pool.h" | 161 #include "base/mac/scoped_nsautorelease_pool.h" |
161 #include "chrome/browser/mac/keystone_glue.h" | 162 #include "chrome/browser/mac/keystone_glue.h" |
162 #endif | 163 #endif |
163 | 164 |
| 165 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 166 #include "policy/policy_constants.h" |
| 167 #endif |
| 168 |
164 #if defined(ENABLE_RLZ) | 169 #if defined(ENABLE_RLZ) |
165 #include "chrome/browser/rlz/rlz.h" | 170 #include "chrome/browser/rlz/rlz.h" |
166 #endif | 171 #endif |
167 | 172 |
168 #if defined(TOOLKIT_VIEWS) | 173 #if defined(TOOLKIT_VIEWS) |
169 #include "ui/views/focus/accelerator_handler.h" | 174 #include "ui/views/focus/accelerator_handler.h" |
170 #endif | 175 #endif |
171 | 176 |
172 #if defined(USE_X11) | 177 #if defined(USE_X11) |
173 #include "chrome/browser/chrome_browser_main_x11.h" | 178 #include "chrome/browser/chrome_browser_main_x11.h" |
(...skipping 20 matching lines...) Expand all Loading... |
194 | 199 |
195 void AddFirstRunNewTabs(StartupBrowserCreator* browser_creator, | 200 void AddFirstRunNewTabs(StartupBrowserCreator* browser_creator, |
196 const std::vector<GURL>& new_tabs) { | 201 const std::vector<GURL>& new_tabs) { |
197 for (std::vector<GURL>::const_iterator it = new_tabs.begin(); | 202 for (std::vector<GURL>::const_iterator it = new_tabs.begin(); |
198 it != new_tabs.end(); ++it) { | 203 it != new_tabs.end(); ++it) { |
199 if (it->is_valid()) | 204 if (it->is_valid()) |
200 browser_creator->AddFirstRunTab(*it); | 205 browser_creator->AddFirstRunTab(*it); |
201 } | 206 } |
202 } | 207 } |
203 | 208 |
204 void InitializeNetworkOptions(const CommandLine& parsed_command_line) { | 209 void InitializeNetworkOptions(const CommandLine& parsed_command_line, |
| 210 policy::PolicyService* policy_service) { |
205 if (parsed_command_line.HasSwitch(switches::kEnableFileCookies)) { | 211 if (parsed_command_line.HasSwitch(switches::kEnableFileCookies)) { |
206 // Enable cookie storage for file:// URLs. Must do this before the first | 212 // Enable cookie storage for file:// URLs. Must do this before the first |
207 // Profile (and therefore the first CookieMonster) is created. | 213 // Profile (and therefore the first CookieMonster) is created. |
208 net::CookieMonster::EnableFileScheme(); | 214 net::CookieMonster::EnableFileScheme(); |
209 } | 215 } |
210 | 216 |
| 217 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 218 bool has_spdy_policy = policy_service->GetPolicies( |
| 219 policy::POLICY_DOMAIN_CHROME, |
| 220 std::string()).Get(policy::key::kDisableSpdy) != NULL; |
| 221 // If "spdy.disabled" preference is controlled via policy, then skip use-spdy |
| 222 // command line flags. |
| 223 if (has_spdy_policy) |
| 224 return; |
| 225 #endif // ENABLE_CONFIGURATION_POLICY |
| 226 |
211 if (parsed_command_line.HasSwitch(switches::kEnableIPPooling)) | 227 if (parsed_command_line.HasSwitch(switches::kEnableIPPooling)) |
212 net::SpdySessionPool::enable_ip_pooling(true); | 228 net::SpdySessionPool::enable_ip_pooling(true); |
213 | 229 |
214 if (parsed_command_line.HasSwitch(switches::kDisableIPPooling)) | 230 if (parsed_command_line.HasSwitch(switches::kDisableIPPooling)) |
215 net::SpdySessionPool::enable_ip_pooling(false); | 231 net::SpdySessionPool::enable_ip_pooling(false); |
216 | 232 |
217 if (parsed_command_line.HasSwitch(switches::kEnableSpdyCredentialFrames)) | 233 if (parsed_command_line.HasSwitch(switches::kEnableSpdyCredentialFrames)) |
218 net::SpdySession::set_enable_credential_frames(true); | 234 net::SpdySession::set_enable_credential_frames(true); |
219 | 235 |
220 if (parsed_command_line.HasSwitch(switches::kMaxSpdySessionsPerDomain)) { | 236 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? | 848 // TODO(viettrungluu): why don't we run this earlier? |
833 if (!parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) | 849 if (!parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) |
834 WarnAboutMinimumSystemRequirements(); | 850 WarnAboutMinimumSystemRequirements(); |
835 | 851 |
836 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) | 852 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) |
837 // Set the product channel for crash reports. | 853 // Set the product channel for crash reports. |
838 child_process_logging::SetChannel( | 854 child_process_logging::SetChannel( |
839 chrome::VersionInfo::GetVersionStringModifier()); | 855 chrome::VersionInfo::GetVersionStringModifier()); |
840 #endif | 856 #endif |
841 | 857 |
842 InitializeNetworkOptions(parsed_command_line()); | 858 InitializeNetworkOptions(parsed_command_line(), |
| 859 browser_process_->policy_service()); |
843 | 860 |
844 // Initialize tracking synchronizer system. | 861 // Initialize tracking synchronizer system. |
845 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer(); | 862 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer(); |
846 | 863 |
847 // Now that all preferences have been registered, set the install date | 864 // 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 | 865 // 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. | 866 // gets used if the user has metrics reporting enabled at uninstall time. |
850 int64 install_date = | 867 int64 install_date = |
851 local_state_->GetInt64(prefs::kUninstallMetricsInstallDate); | 868 local_state_->GetInt64(prefs::kUninstallMetricsInstallDate); |
852 if (install_date == 0) { | 869 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) | 1612 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1596 uma_name += "_XP"; | 1613 uma_name += "_XP"; |
1597 | 1614 |
1598 uma_name += "_PreRead_"; | 1615 uma_name += "_PreRead_"; |
1599 uma_name += pre_read_percentage; | 1616 uma_name += pre_read_percentage; |
1600 AddPreReadHistogramTime(uma_name.c_str(), time); | 1617 AddPreReadHistogramTime(uma_name.c_str(), time); |
1601 } | 1618 } |
1602 #endif | 1619 #endif |
1603 #endif | 1620 #endif |
1604 } | 1621 } |
OLD | NEW |