OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/app/shell_main_delegate.h" | 5 #include "extensions/shell/app/shell_main_delegate.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "content/public/browser/browser_main_runner.h" | 11 #include "content/public/browser/browser_main_runner.h" |
12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
13 #include "extensions/common/extension_paths.h" | 13 #include "extensions/common/extension_paths.h" |
14 #include "extensions/shell/browser/default_shell_browser_main_delegate.h" | 14 #include "extensions/shell/browser/default_shell_browser_main_delegate.h" |
15 #include "extensions/shell/browser/shell_content_browser_client.h" | 15 #include "extensions/shell/browser/shell_content_browser_client.h" |
16 #include "extensions/shell/common/shell_content_client.h" | 16 #include "extensions/shell/common/shell_content_client.h" |
17 #include "extensions/shell/renderer/shell_content_renderer_client.h" | 17 #include "extensions/shell/renderer/shell_content_renderer_client.h" |
18 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
19 | 19 |
20 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
21 #include "chromeos/chromeos_paths.h" | 21 #include "chromeos/chromeos_paths.h" |
22 #endif | 22 #endif |
23 | 23 |
24 #if !defined(DISABLE_NACL) | 24 #if !defined(DISABLE_NACL) |
| 25 #include "components/nacl/common/nacl_switches.h" |
| 26 #if defined(OS_LINUX) |
25 #include "components/nacl/common/nacl_paths.h" | 27 #include "components/nacl/common/nacl_paths.h" |
26 #include "components/nacl/common/nacl_switches.h" | |
27 #include "components/nacl/zygote/nacl_fork_delegate_linux.h" | 28 #include "components/nacl/zygote/nacl_fork_delegate_linux.h" |
28 #endif | 29 #endif // OS_LINUX |
| 30 #endif // !DISABLE_NACL |
29 | 31 |
30 namespace { | 32 namespace { |
31 | 33 |
32 void InitLogging() { | 34 void InitLogging() { |
33 base::FilePath log_filename; | 35 base::FilePath log_filename; |
34 PathService::Get(base::DIR_EXE, &log_filename); | 36 PathService::Get(base::DIR_EXE, &log_filename); |
35 log_filename = log_filename.AppendASCII("app_shell.log"); | 37 log_filename = log_filename.AppendASCII("app_shell.log"); |
36 logging::LoggingSettings settings; | 38 logging::LoggingSettings settings; |
37 settings.logging_dest = logging::LOG_TO_ALL; | 39 settings.logging_dest = logging::LOG_TO_ALL; |
38 settings.log_file = log_filename.value().c_str(); | 40 settings.log_file = log_filename.value().c_str(); |
(...skipping 13 matching lines...) Expand all Loading... |
52 } | 54 } |
53 | 55 |
54 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { | 56 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { |
55 InitLogging(); | 57 InitLogging(); |
56 content_client_.reset(CreateContentClient()); | 58 content_client_.reset(CreateContentClient()); |
57 SetContentClient(content_client_.get()); | 59 SetContentClient(content_client_.get()); |
58 | 60 |
59 #if defined(OS_CHROMEOS) | 61 #if defined(OS_CHROMEOS) |
60 chromeos::RegisterPathProvider(); | 62 chromeos::RegisterPathProvider(); |
61 #endif | 63 #endif |
62 #if !defined(DISABLE_NACL) | 64 #if !defined(DISABLE_NACL) && defined(OS_LINUX) |
63 nacl::RegisterPathProvider(); | 65 nacl::RegisterPathProvider(); |
64 #endif | 66 #endif |
65 extensions::RegisterPathProvider(); | 67 extensions::RegisterPathProvider(); |
66 return false; | 68 return false; |
67 } | 69 } |
68 | 70 |
69 void ShellMainDelegate::PreSandboxStartup() { | 71 void ShellMainDelegate::PreSandboxStartup() { |
70 std::string process_type = | 72 std::string process_type = |
71 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 73 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
72 switches::kProcessType); | 74 switches::kProcessType); |
73 if (ProcessNeedsResourceBundle(process_type)) | 75 if (ProcessNeedsResourceBundle(process_type)) |
74 InitializeResourceBundle(); | 76 InitializeResourceBundle(); |
75 } | 77 } |
76 | 78 |
77 content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { | 79 content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { |
78 browser_client_.reset(CreateShellContentBrowserClient()); | 80 browser_client_.reset(CreateShellContentBrowserClient()); |
79 return browser_client_.get(); | 81 return browser_client_.get(); |
80 } | 82 } |
81 | 83 |
82 content::ContentRendererClient* | 84 content::ContentRendererClient* |
83 ShellMainDelegate::CreateContentRendererClient() { | 85 ShellMainDelegate::CreateContentRendererClient() { |
84 renderer_client_.reset(CreateShellContentRendererClient()); | 86 renderer_client_.reset(CreateShellContentRendererClient()); |
85 return renderer_client_.get(); | 87 return renderer_client_.get(); |
86 } | 88 } |
87 | 89 |
| 90 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
88 void ShellMainDelegate::ZygoteStarting( | 91 void ShellMainDelegate::ZygoteStarting( |
89 ScopedVector<content::ZygoteForkDelegate>* delegates) { | 92 ScopedVector<content::ZygoteForkDelegate>* delegates) { |
90 #if !defined(DISABLE_NACL) | 93 #if !defined(DISABLE_NACL) |
91 nacl::AddNaClZygoteForkDelegates(delegates); | 94 nacl::AddNaClZygoteForkDelegates(delegates); |
92 #endif | 95 #endif // DISABLE_NACL |
93 } | 96 } |
| 97 #endif // OS_POSIX && !OS_MACOSX && !OS_ANDROID |
94 | 98 |
95 content::ContentClient* ShellMainDelegate::CreateContentClient() { | 99 content::ContentClient* ShellMainDelegate::CreateContentClient() { |
96 return new ShellContentClient(); | 100 return new ShellContentClient(); |
97 } | 101 } |
98 | 102 |
99 content::ContentBrowserClient* | 103 content::ContentBrowserClient* |
100 ShellMainDelegate::CreateShellContentBrowserClient() { | 104 ShellMainDelegate::CreateShellContentBrowserClient() { |
101 return new ShellContentBrowserClient(new DefaultShellBrowserMainDelegate()); | 105 return new ShellContentBrowserClient(new DefaultShellBrowserMainDelegate()); |
102 } | 106 } |
103 | 107 |
(...skipping 18 matching lines...) Expand all Loading... |
122 return process_type.empty() || | 126 return process_type.empty() || |
123 process_type == switches::kZygoteProcess || | 127 process_type == switches::kZygoteProcess || |
124 process_type == switches::kRendererProcess || | 128 process_type == switches::kRendererProcess || |
125 #if !defined(DISABLE_NACL) | 129 #if !defined(DISABLE_NACL) |
126 process_type == switches::kNaClLoaderProcess || | 130 process_type == switches::kNaClLoaderProcess || |
127 #endif | 131 #endif |
128 process_type == switches::kUtilityProcess; | 132 process_type == switches::kUtilityProcess; |
129 } | 133 } |
130 | 134 |
131 } // namespace extensions | 135 } // namespace extensions |
OLD | NEW |