| 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" |
| 9 |
| 10 #if defined(OS_WIN) |
| 8 #include "sandbox/src/sandbox.h" | 11 #include "sandbox/src/sandbox.h" |
| 12 #endif |
| 9 | 13 |
| 10 // TODO(port): several win-only methods have been pulled out of this, but | 14 // TODO(port): several win-only methods have been pulled out of this, but |
| 11 // BrowserMain() as a whole needs to be broken apart so that it's usable by | 15 // BrowserMain() as a whole needs to be broken apart so that it's usable by |
| 12 // other platforms. For now, it's just a stub. This is a serious work in | 16 // other platforms. For now, it's just a stub. This is a serious work in |
| 13 // progress and should not be taken as an indication of a real refactoring. | 17 // progress and should not be taken as an indication of a real refactoring. |
| 14 | 18 |
| 15 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 16 | 20 |
| 17 #include <windows.h> | 21 #include <windows.h> |
| 18 #include <shellapi.h> | 22 #include <shellapi.h> |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 StringPiece NetResourceProvider(int key) { | 138 StringPiece NetResourceProvider(int key) { |
| 135 if (IDR_DIR_HEADER_HTML == key) | 139 if (IDR_DIR_HEADER_HTML == key) |
| 136 return StringPiece(lazy_dir_lister.Pointer()->html_data); | 140 return StringPiece(lazy_dir_lister.Pointer()->html_data); |
| 137 | 141 |
| 138 return ResourceBundle::GetSharedInstance().GetRawDataResource(key); | 142 return ResourceBundle::GetSharedInstance().GetRawDataResource(key); |
| 139 } | 143 } |
| 140 | 144 |
| 141 } // namespace | 145 } // namespace |
| 142 | 146 |
| 143 // Main routine for running as the Browser process. | 147 // Main routine for running as the Browser process. |
| 144 int BrowserMain(CommandLine &parsed_command_line, | 148 int BrowserMain(const MainFunctionParams& parameters) { |
| 145 sandbox::BrokerServices* broker_services) { | 149 CommandLine& parsed_command_line = parameters.command_line_; |
| 150 sandbox::BrokerServices* broker_services = |
| 151 parameters.sandbox_info_.BrokerServices(); |
| 152 |
| 146 // 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 |
| 147 // 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 |
| 148 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. | 155 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. |
| 149 | 156 |
| 150 // 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 |
| 151 // defined roles (e.g. pre/post-profile startup, etc). | 158 // defined roles (e.g. pre/post-profile startup, etc). |
| 152 | 159 |
| 153 #ifdef TRACK_ALL_TASK_OBJECTS | 160 #ifdef TRACK_ALL_TASK_OBJECTS |
| 154 // Start tracking the creation and deletion of Task instance. | 161 // Start tracking the creation and deletion of Task instance. |
| 155 // 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 #elif defined(OS_POSIX) | 503 #elif defined(OS_POSIX) |
| 497 | 504 |
| 498 // Call to kick off the main message loop. The implementation for this on Mac | 505 // Call to kick off the main message loop. The implementation for this on Mac |
| 499 // must reside in another file because it has to call Cocoa functions and thus | 506 // must reside in another file because it has to call Cocoa functions and thus |
| 500 // cannot live in a .cc file. | 507 // cannot live in a .cc file. |
| 501 int StartPlatformMessageLoop(); | 508 int StartPlatformMessageLoop(); |
| 502 | 509 |
| 503 // TODO(port): merge this with above. Just a stub for now, not meant as a place | 510 // TODO(port): merge this with above. Just a stub for now, not meant as a place |
| 504 // to duplicate code. | 511 // to duplicate code. |
| 505 // Main routine for running as the Browser process. | 512 // Main routine for running as the Browser process. |
| 506 int BrowserMain(CommandLine &parsed_command_line, | 513 int BrowserMain(const MainFunctionParams& parameters) { |
| 507 sandbox::BrokerServices* broker_services) { | |
| 508 return StartPlatformMessageLoop(); | 514 return StartPlatformMessageLoop(); |
| 509 } | 515 } |
| 510 | 516 |
| 511 #if defined(OS_LINUX) | 517 #if defined(OS_LINUX) |
| 512 void StartPlatformMessageLoop() { | 518 void StartPlatformMessageLoop() { |
| 513 return 0; | 519 return 0; |
| 514 } | 520 } |
| 515 #endif | 521 #endif |
| 516 | 522 |
| 517 #endif | 523 #endif |
| OLD | NEW |