Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_main.h" | 5 #include "chrome/browser/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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 #include "net/socket/client_socket_pool_manager.h" | 111 #include "net/socket/client_socket_pool_manager.h" |
| 112 #include "net/socket/tcp_client_socket.h" | 112 #include "net/socket/tcp_client_socket.h" |
| 113 #include "net/spdy/spdy_session.h" | 113 #include "net/spdy/spdy_session.h" |
| 114 #include "net/spdy/spdy_session_pool.h" | 114 #include "net/spdy/spdy_session_pool.h" |
| 115 #include "net/url_request/url_request.h" | 115 #include "net/url_request/url_request.h" |
| 116 #include "net/url_request/url_request_throttler_manager.h" | 116 #include "net/url_request/url_request_throttler_manager.h" |
| 117 #include "net/websockets/websocket_job.h" | 117 #include "net/websockets/websocket_job.h" |
| 118 #include "ui/base/l10n/l10n_util.h" | 118 #include "ui/base/l10n/l10n_util.h" |
| 119 #include "ui/base/resource/resource_bundle.h" | 119 #include "ui/base/resource/resource_bundle.h" |
| 120 | 120 |
| 121 #if defined(OS_LINUX) | |
| 122 #include "base/linux_util.h" | |
| 123 #endif | |
| 121 #if defined(USE_LINUX_BREAKPAD) | 124 #if defined(USE_LINUX_BREAKPAD) |
| 122 #include "base/linux_util.h" | |
| 123 #include "chrome/app/breakpad_linux.h" | 125 #include "chrome/app/breakpad_linux.h" |
| 124 #endif | 126 #endif |
| 125 | 127 |
| 126 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 128 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 127 #include <dbus/dbus-glib.h> | 129 #include <dbus/dbus-glib.h> |
| 128 | 130 |
| 129 #include "chrome/browser/browser_main_gtk.h" | 131 #include "chrome/browser/browser_main_gtk.h" |
| 130 #include "chrome/browser/ui/gtk/gtk_util.h" | 132 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 131 #endif | 133 #endif |
| 132 | 134 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 | 272 |
| 271 void AddFirstRunNewTabs(BrowserInit* browser_init, | 273 void AddFirstRunNewTabs(BrowserInit* browser_init, |
| 272 const std::vector<GURL>& new_tabs) { | 274 const std::vector<GURL>& new_tabs) { |
| 273 for (std::vector<GURL>::const_iterator it = new_tabs.begin(); | 275 for (std::vector<GURL>::const_iterator it = new_tabs.begin(); |
| 274 it != new_tabs.end(); ++it) { | 276 it != new_tabs.end(); ++it) { |
| 275 if (it->is_valid()) | 277 if (it->is_valid()) |
| 276 browser_init->AddFirstRunTab(*it); | 278 browser_init->AddFirstRunTab(*it); |
| 277 } | 279 } |
| 278 } | 280 } |
| 279 | 281 |
| 280 #if defined(USE_LINUX_BREAKPAD) | 282 #if defined(OS_LINUX) |
| 281 class GetLinuxDistroTask : public Task { | 283 class GetLinuxDistroTask : public Task { |
| 282 public: | 284 public: |
| 283 explicit GetLinuxDistroTask() {} | 285 explicit GetLinuxDistroTask() {} |
| 284 | 286 |
| 285 virtual void Run() { | 287 virtual void Run() { |
| 286 base::GetLinuxDistro(); // Initialize base::linux_distro if needed. | 288 base::GetLinuxDistro(); // Initialize base::linux_distro if needed. |
| 287 } | 289 } |
| 288 | 290 |
| 289 DISALLOW_COPY_AND_ASSIGN(GetLinuxDistroTask); | 291 DISALLOW_COPY_AND_ASSIGN(GetLinuxDistroTask); |
| 290 }; | 292 }; |
| 291 #endif // USE_LINUX_BREAKPAD | 293 #endif // OS_LINUX |
| 292 | 294 |
| 293 void InitializeNetworkOptions(const CommandLine& parsed_command_line) { | 295 void InitializeNetworkOptions(const CommandLine& parsed_command_line) { |
| 294 if (parsed_command_line.HasSwitch(switches::kEnableFileCookies)) { | 296 if (parsed_command_line.HasSwitch(switches::kEnableFileCookies)) { |
| 295 // Enable cookie storage for file:// URLs. Must do this before the first | 297 // Enable cookie storage for file:// URLs. Must do this before the first |
| 296 // Profile (and therefore the first CookieMonster) is created. | 298 // Profile (and therefore the first CookieMonster) is created. |
| 297 net::CookieMonster::EnableFileScheme(); | 299 net::CookieMonster::EnableFileScheme(); |
| 298 } | 300 } |
| 299 | 301 |
| 300 if (parsed_command_line.HasSwitch(switches::kEnableMacCookies)) | 302 if (parsed_command_line.HasSwitch(switches::kEnableMacCookies)) |
| 301 net::URLRequest::EnableMacCookies(); | 303 net::URLRequest::EnableMacCookies(); |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1414 // window station. During this time all the UI will be broken. This has to | 1416 // window station. During this time all the UI will be broken. This has to |
| 1415 // run before threads and windows are created. | 1417 // run before threads and windows are created. |
| 1416 InitializeBrokerServices(parameters, parsed_command_line); | 1418 InitializeBrokerServices(parameters, parsed_command_line); |
| 1417 | 1419 |
| 1418 // Initialize histogram statistics gathering system. | 1420 // Initialize histogram statistics gathering system. |
| 1419 base::StatisticsRecorder statistics; | 1421 base::StatisticsRecorder statistics; |
| 1420 | 1422 |
| 1421 PrefService* local_state = InitializeLocalState(parsed_command_line, | 1423 PrefService* local_state = InitializeLocalState(parsed_command_line, |
| 1422 is_first_run); | 1424 is_first_run); |
| 1423 | 1425 |
| 1424 #if defined(USE_LINUX_BREAKPAD) | 1426 #if defined(OS_LINUX) |
| 1425 // Needs to be called after we have chrome::DIR_USER_DATA and | 1427 // Needs to be called after we have chrome::DIR_USER_DATA and |
| 1426 // g_browser_process. | 1428 // g_browser_process. |
| 1427 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, | 1429 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, |
|
sky
2011/08/31 03:35:16
Why do we need the linux distro if we're not going
Yaron
2011/08/31 23:23:22
Ya, I was too cavalier about it. Done in the sync
| |
| 1428 new GetLinuxDistroTask()); | 1430 new GetLinuxDistroTask()); |
| 1431 #endif | |
| 1429 | 1432 |
| 1433 #if defined(USE_LINUX_BREAKPAD) | |
| 1430 if (IsCrashReportingEnabled(local_state)) | 1434 if (IsCrashReportingEnabled(local_state)) |
| 1431 InitCrashReporter(); | 1435 InitCrashReporter(); |
| 1432 #endif | 1436 #endif |
| 1433 | 1437 |
| 1434 // If we're running tests (ui_task is non-null), then the ResourceBundle | 1438 // If we're running tests (ui_task is non-null), then the ResourceBundle |
| 1435 // has already been initialized. | 1439 // has already been initialized. |
| 1436 if (parameters.ui_task) { | 1440 if (parameters.ui_task) { |
| 1437 g_browser_process->SetApplicationLocale("en-US"); | 1441 g_browser_process->SetApplicationLocale("en-US"); |
| 1438 } else { | 1442 } else { |
| 1439 // Mac starts it earlier in |PreMainMessageLoopStart()| (because it is | 1443 // Mac starts it earlier in |PreMainMessageLoopStart()| (because it is |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2183 std::string pre_read; | 2187 std::string pre_read; |
| 2184 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && | 2188 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && |
| 2185 (pre_read == "0" || pre_read == "1")) { | 2189 (pre_read == "0" || pre_read == "1")) { |
| 2186 std::string uma_name(name); | 2190 std::string uma_name(name); |
| 2187 uma_name += "_PreRead"; | 2191 uma_name += "_PreRead"; |
| 2188 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 2192 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
| 2189 AddPreReadHistogramTime(uma_name.c_str(), time); | 2193 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 2190 } | 2194 } |
| 2191 #endif | 2195 #endif |
| 2192 } | 2196 } |
| 2193 | |
| OLD | NEW |