| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "chrome/browser/net/websocket_experiment/websocket_experiment_runner.h" | 52 #include "chrome/browser/net/websocket_experiment/websocket_experiment_runner.h" |
| 53 #include "chrome/browser/plugin_service.h" | 53 #include "chrome/browser/plugin_service.h" |
| 54 #include "chrome/browser/pref_service.h" | 54 #include "chrome/browser/pref_service.h" |
| 55 #include "chrome/browser/pref_value_store.h" | 55 #include "chrome/browser/pref_value_store.h" |
| 56 #include "chrome/browser/process_singleton.h" | 56 #include "chrome/browser/process_singleton.h" |
| 57 #include "chrome/browser/profile.h" | 57 #include "chrome/browser/profile.h" |
| 58 #include "chrome/browser/profile_manager.h" | 58 #include "chrome/browser/profile_manager.h" |
| 59 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 59 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 60 #include "chrome/browser/search_engines/template_url_model.h" | 60 #include "chrome/browser/search_engines/template_url_model.h" |
| 61 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 61 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
| 62 #include "chrome/browser/service/service_process_control.h" |
| 63 #include "chrome/browser/service/service_process_control_manager.h" |
| 62 #include "chrome/browser/shell_integration.h" | 64 #include "chrome/browser/shell_integration.h" |
| 63 #include "chrome/browser/translate/translate_manager.h" | 65 #include "chrome/browser/translate/translate_manager.h" |
| 64 #include "chrome/common/child_process.h" | 66 #include "chrome/common/child_process.h" |
| 65 #include "chrome/common/chrome_constants.h" | 67 #include "chrome/common/chrome_constants.h" |
| 66 #include "chrome/common/chrome_paths.h" | 68 #include "chrome/common/chrome_paths.h" |
| 67 #include "chrome/common/chrome_switches.h" | 69 #include "chrome/common/chrome_switches.h" |
| 68 #include "chrome/common/env_vars.h" | 70 #include "chrome/common/env_vars.h" |
| 69 #include "chrome/common/json_pref_store.h" | 71 #include "chrome/common/json_pref_store.h" |
| 70 #include "chrome/common/jstemplate_builder.h" | 72 #include "chrome/common/jstemplate_builder.h" |
| 71 #include "chrome/common/logging_chrome.h" | 73 #include "chrome/common/logging_chrome.h" |
| 72 #include "chrome/common/main_function_params.h" | 74 #include "chrome/common/main_function_params.h" |
| 73 #include "chrome/common/net/net_resource_provider.h" | 75 #include "chrome/common/net/net_resource_provider.h" |
| 74 #include "chrome/common/pref_names.h" | 76 #include "chrome/common/pref_names.h" |
| 75 #include "chrome/common/result_codes.h" | 77 #include "chrome/common/result_codes.h" |
| 78 #include "chrome/common/service_process_type.h" |
| 76 #include "chrome/installer/util/google_update_settings.h" | 79 #include "chrome/installer/util/google_update_settings.h" |
| 77 #include "chrome/installer/util/master_preferences.h" | 80 #include "chrome/installer/util/master_preferences.h" |
| 78 #include "grit/app_locale_settings.h" | 81 #include "grit/app_locale_settings.h" |
| 79 #include "grit/chromium_strings.h" | 82 #include "grit/chromium_strings.h" |
| 80 #include "grit/generated_resources.h" | 83 #include "grit/generated_resources.h" |
| 81 #include "net/base/cookie_monster.h" | 84 #include "net/base/cookie_monster.h" |
| 82 #include "net/base/net_module.h" | 85 #include "net/base/net_module.h" |
| 83 #include "net/base/network_change_notifier.h" | 86 #include "net/base/network_change_notifier.h" |
| 84 #include "net/http/http_network_layer.h" | 87 #include "net/http/http_network_layer.h" |
| 85 #include "net/http/http_network_session.h" | 88 #include "net/http/http_network_session.h" |
| (...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1363 bool record_search_engine = is_first_run && !profile->IsOffTheRecord(); | 1366 bool record_search_engine = is_first_run && !profile->IsOffTheRecord(); |
| 1364 #endif | 1367 #endif |
| 1365 | 1368 |
| 1366 // ChildProcess:: is a misnomer unless you consider context. Use | 1369 // ChildProcess:: is a misnomer unless you consider context. Use |
| 1367 // of --wait-for-debugger only makes sense when Chrome itself is a | 1370 // of --wait-for-debugger only makes sense when Chrome itself is a |
| 1368 // child process (e.g. when launched by PyAuto). | 1371 // child process (e.g. when launched by PyAuto). |
| 1369 if (parsed_command_line.HasSwitch(switches::kWaitForDebugger)) { | 1372 if (parsed_command_line.HasSwitch(switches::kWaitForDebugger)) { |
| 1370 ChildProcess::WaitForDebugger(L"Browser"); | 1373 ChildProcess::WaitForDebugger(L"Browser"); |
| 1371 } | 1374 } |
| 1372 | 1375 |
| 1376 // If remoting or cloud print proxy is enabled and setup has been completed |
| 1377 // we start the service process here. |
| 1378 // The prerequisite for running the service process is that we have IO, UI |
| 1379 // and PROCESS_LAUNCHER threads up and running. |
| 1380 // TODO(hclam): Need to check for cloud print proxy too. |
| 1381 if (parsed_command_line.HasSwitch(switches::kEnableRemoting)) { |
| 1382 if (user_prefs->GetBoolean(prefs::kRemotingHasSetupCompleted)) { |
| 1383 ServiceProcessControl* control = ServiceProcessControlManager::instance() |
| 1384 ->GetProcessControl(profile, kServiceProcessRemoting); |
| 1385 control->Launch(NULL); |
| 1386 } |
| 1387 } |
| 1388 |
| 1373 int result_code = ResultCodes::NORMAL_EXIT; | 1389 int result_code = ResultCodes::NORMAL_EXIT; |
| 1374 if (parameters.ui_task) { | 1390 if (parameters.ui_task) { |
| 1375 // We are in test mode. Run one task and enter the main message loop. | 1391 // We are in test mode. Run one task and enter the main message loop. |
| 1376 if (pool) | 1392 if (pool) |
| 1377 pool->Recycle(); | 1393 pool->Recycle(); |
| 1378 parameters.ui_task->Run(); | 1394 parameters.ui_task->Run(); |
| 1379 delete parameters.ui_task; | 1395 delete parameters.ui_task; |
| 1380 } else { | 1396 } else { |
| 1381 // We are in regular browser boot sequence. Open initial stabs and enter | 1397 // We are in regular browser boot sequence. Open initial stabs and enter |
| 1382 // the main message loop. | 1398 // the main message loop. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 metrics->Stop(); | 1470 metrics->Stop(); |
| 1455 | 1471 |
| 1456 // browser_shutdown takes care of deleting browser_process, so we need to | 1472 // browser_shutdown takes care of deleting browser_process, so we need to |
| 1457 // release it. | 1473 // release it. |
| 1458 ignore_result(browser_process.release()); | 1474 ignore_result(browser_process.release()); |
| 1459 browser_shutdown::Shutdown(); | 1475 browser_shutdown::Shutdown(); |
| 1460 | 1476 |
| 1461 TRACE_EVENT_END("BrowserMain", 0, 0); | 1477 TRACE_EVENT_END("BrowserMain", 0, 0); |
| 1462 return result_code; | 1478 return result_code; |
| 1463 } | 1479 } |
| OLD | NEW |