| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/common/main_function_params.h" | 8 #include "chrome/common/main_function_params.h" |
| 9 | 9 |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 return StringPiece(lazy_dir_lister.Pointer()->html_data); | 140 return StringPiece(lazy_dir_lister.Pointer()->html_data); |
| 141 | 141 |
| 142 return ResourceBundle::GetSharedInstance().GetRawDataResource(key); | 142 return ResourceBundle::GetSharedInstance().GetRawDataResource(key); |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace | 145 } // namespace |
| 146 | 146 |
| 147 // Main routine for running as the Browser process. | 147 // Main routine for running as the Browser process. |
| 148 int BrowserMain(const MainFunctionParams& parameters) { | 148 int BrowserMain(const MainFunctionParams& parameters) { |
| 149 CommandLine& parsed_command_line = parameters.command_line_; | 149 CommandLine& parsed_command_line = parameters.command_line_; |
| 150 sandbox::BrokerServices* broker_services = | 150 sandbox::BrokerServices* broker_services = |
| 151 parameters.sandbox_info_.BrokerServices(); | 151 parameters.sandbox_info_.BrokerServices(); |
| 152 | 152 |
| 153 // WARNING: If we get a WM_ENDSESSION objects created on the stack here | 153 // WARNING: If we get a WM_ENDSESSION objects created on the stack here |
| 154 // are NOT deleted. If you need something to run during WM_ENDSESSION add it | 154 // are NOT deleted. If you need something to run during WM_ENDSESSION add it |
| 155 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. | 155 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. |
| 156 | 156 |
| 157 // TODO(beng, brettw): someday, break this out into sub functions with well | 157 // TODO(beng, brettw): someday, break this out into sub functions with well |
| 158 // defined roles (e.g. pre/post-profile startup, etc). | 158 // defined roles (e.g. pre/post-profile startup, etc). |
| 159 | 159 |
| 160 #ifdef TRACK_ALL_TASK_OBJECTS | 160 #ifdef TRACK_ALL_TASK_OBJECTS |
| 161 // Start tracking the creation and deletion of Task instance. | 161 // Start tracking the creation and deletion of Task instance. |
| 162 // This construction MUST be done before main_message_loop, so that it is | 162 // This construction MUST be done before main_message_loop, so that it is |
| (...skipping 10 matching lines...) Expand all Loading... |
| 173 FieldTrialList field_trial; | 173 FieldTrialList field_trial; |
| 174 | 174 |
| 175 std::wstring app_name = chrome::kBrowserAppName; | 175 std::wstring app_name = chrome::kBrowserAppName; |
| 176 std::string thread_name_string = WideToASCII(app_name + L"_BrowserMain"); | 176 std::string thread_name_string = WideToASCII(app_name + L"_BrowserMain"); |
| 177 | 177 |
| 178 const char* thread_name = thread_name_string.c_str(); | 178 const char* thread_name = thread_name_string.c_str(); |
| 179 PlatformThread::SetName(thread_name); | 179 PlatformThread::SetName(thread_name); |
| 180 main_message_loop.set_thread_name(thread_name); | 180 main_message_loop.set_thread_name(thread_name); |
| 181 bool already_running = Upgrade::IsBrowserAlreadyRunning(); | 181 bool already_running = Upgrade::IsBrowserAlreadyRunning(); |
| 182 | 182 |
| 183 #if defined(OS_WIN) | |
| 184 // Make the selection of network stacks early on before any consumers try to | |
| 185 // issue HTTP requests. | |
| 186 if (parsed_command_line.HasSwitch(switches::kUseWinHttp)) | |
| 187 net::HttpNetworkLayer::UseWinHttp(true); | |
| 188 #endif | |
| 189 | |
| 190 std::wstring user_data_dir; | 183 std::wstring user_data_dir; |
| 191 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 184 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
| 192 BrowserInit::MessageWindow message_window(user_data_dir); | 185 BrowserInit::MessageWindow message_window(user_data_dir); |
| 193 | 186 |
| 194 scoped_ptr<BrowserProcess> browser_process; | 187 scoped_ptr<BrowserProcess> browser_process; |
| 195 if (parsed_command_line.HasSwitch(switches::kImport)) { | 188 if (parsed_command_line.HasSwitch(switches::kImport)) { |
| 196 // We use different BrowserProcess when importing so no GoogleURLTracker is | 189 // We use different BrowserProcess when importing so no GoogleURLTracker is |
| 197 // instantiated (as it makes a URLRequest and we don't have an IO thread, | 190 // instantiated (as it makes a URLRequest and we don't have an IO thread, |
| 198 // see bug #1292702). | 191 // see bug #1292702). |
| 199 browser_process.reset(new FirstRunBrowserProcess(parsed_command_line)); | 192 browser_process.reset(new FirstRunBrowserProcess(parsed_command_line)); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 return StartPlatformMessageLoop(); | 507 return StartPlatformMessageLoop(); |
| 515 } | 508 } |
| 516 | 509 |
| 517 #if defined(OS_LINUX) | 510 #if defined(OS_LINUX) |
| 518 void StartPlatformMessageLoop() { | 511 void StartPlatformMessageLoop() { |
| 519 return 0; | 512 return 0; |
| 520 } | 513 } |
| 521 #endif | 514 #endif |
| 522 | 515 |
| 523 #endif | 516 #endif |
| OLD | NEW |