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 "content/public/app/content_main_runner.h" | 5 #include "content/public/app/content_main_runner.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/debugger.h" | 9 #include "base/debug/debugger.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/i18n/icu_util.h" | 12 #include "base/i18n/icu_util.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/metrics/stats_table.h" | 15 #include "base/metrics/stats_table.h" |
16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
17 #include "base/process_util.h" | 17 #include "base/process_util.h" |
18 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
19 #include "base/string_number_conversions.h" | 19 #include "base/string_number_conversions.h" |
20 #include "content/browser/browser_main.h" | 20 #include "content/browser/browser_main.h" |
21 #include "content/common/set_process_title.h" | 21 #include "content/common/set_process_title.h" |
22 #include "content/public/app/content_main_delegate.h" | 22 #include "content/public/app/content_main_delegate.h" |
23 #include "content/public/app/startup_helper_win.h" | 23 #include "content/public/app/startup_helper_win.h" |
24 #include "content/public/common/content_client.h" | 24 #include "content/public/common/content_client.h" |
25 #include "content/public/common/content_constants.h" | 25 #include "content/public/common/content_constants.h" |
26 #include "content/public/common/content_paths.h" | 26 #include "content/public/common/content_paths.h" |
27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
28 #include "content/public/common/main_function_params.h" | 28 #include "content/public/common/main_function_params.h" |
29 #include "content/public/common/sandbox_init.h" | 29 #include "content/public/common/sandbox_init.h" |
| 30 #include "content/public/common/url_constants.h" |
30 #include "crypto/nss_util.h" | 31 #include "crypto/nss_util.h" |
31 #include "ipc/ipc_switches.h" | 32 #include "ipc/ipc_switches.h" |
32 #include "media/base/media.h" | 33 #include "media/base/media.h" |
33 #include "sandbox/src/sandbox_types.h" | 34 #include "sandbox/src/sandbox_types.h" |
34 #include "ui/base/ui_base_switches.h" | 35 #include "ui/base/ui_base_switches.h" |
35 #include "ui/base/ui_base_paths.h" | 36 #include "ui/base/ui_base_paths.h" |
36 #include "webkit/glue/webkit_glue.h" | 37 #include "webkit/glue/webkit_glue.h" |
37 | 38 |
38 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
39 #include <atlbase.h> | 40 #include <atlbase.h> |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 // app quits. Each "main" needs to flush this pool right before it goes into | 377 // app quits. Each "main" needs to flush this pool right before it goes into |
377 // its main event loop to get rid of the cruft. | 378 // its main event loop to get rid of the cruft. |
378 autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool()); | 379 autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool()); |
379 #endif | 380 #endif |
380 | 381 |
381 CommandLine::Init(argc, argv); | 382 CommandLine::Init(argc, argv); |
382 | 383 |
383 int exit_code; | 384 int exit_code; |
384 if (delegate && delegate->BasicStartupComplete(&exit_code)) | 385 if (delegate && delegate->BasicStartupComplete(&exit_code)) |
385 return exit_code; | 386 return exit_code; |
| 387 DCHECK(!delegate || content::GetContentClient()) << |
| 388 "BasicStartupComplete didn't set the content client"; |
386 | 389 |
387 completed_basic_startup_ = true; | 390 completed_basic_startup_ = true; |
388 | 391 |
389 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 392 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
390 std::string process_type = | 393 std::string process_type = |
391 command_line.GetSwitchValueASCII(switches::kProcessType); | 394 command_line.GetSwitchValueASCII(switches::kProcessType); |
392 | 395 |
393 // Enable startup tracing asap to avoid early TRACE_EVENT calls being | 396 // Enable startup tracing asap to avoid early TRACE_EVENT calls being |
394 // ignored. | 397 // ignored. |
395 if (command_line.HasSwitch(switches::kTraceStartup)) { | 398 if (command_line.HasSwitch(switches::kTraceStartup)) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 signal(SIGINT, SIG_IGN); | 440 signal(SIGINT, SIG_IGN); |
438 } | 441 } |
439 #endif | 442 #endif |
440 | 443 |
441 #if defined(USE_NSS) | 444 #if defined(USE_NSS) |
442 crypto::EarlySetupForNSSInit(); | 445 crypto::EarlySetupForNSSInit(); |
443 #endif | 446 #endif |
444 | 447 |
445 ui::RegisterPathProvider(); | 448 ui::RegisterPathProvider(); |
446 content::RegisterPathProvider(); | 449 content::RegisterPathProvider(); |
| 450 content::RegisterContentSchemes(true); |
447 | 451 |
448 CHECK(icu_util::Initialize()); | 452 CHECK(icu_util::Initialize()); |
449 | 453 |
450 base::ProcessId browser_pid = base::GetCurrentProcId(); | 454 base::ProcessId browser_pid = base::GetCurrentProcId(); |
451 if (command_line.HasSwitch(switches::kProcessChannelID)) { | 455 if (command_line.HasSwitch(switches::kProcessChannelID)) { |
452 #if defined(OS_WIN) || defined(OS_MACOSX) | 456 #if defined(OS_WIN) || defined(OS_MACOSX) |
453 std::string channel_name = | 457 std::string channel_name = |
454 command_line.GetSwitchValueASCII(switches::kProcessChannelID); | 458 command_line.GetSwitchValueASCII(switches::kProcessChannelID); |
455 | 459 |
456 int browser_pid_int; | 460 int browser_pid_int; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 } // namespace | 580 } // namespace |
577 | 581 |
578 namespace content { | 582 namespace content { |
579 | 583 |
580 // static | 584 // static |
581 ContentMainRunner* ContentMainRunner::Create() { | 585 ContentMainRunner* ContentMainRunner::Create() { |
582 return new ContentMainRunnerImpl(); | 586 return new ContentMainRunnerImpl(); |
583 } | 587 } |
584 | 588 |
585 } // namespace content | 589 } // namespace content |
OLD | NEW |