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 "chrome/common/chrome_content_client.h" | 5 #include "chrome/common/chrome_content_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "base/string_split.h" | 13 #include "base/string_split.h" |
14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/common/child_process_logging.h" | 16 #include "chrome/common/child_process_logging.h" |
17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/chrome_version_info.h" | 19 #include "chrome/common/chrome_version_info.h" |
20 #include "chrome/common/pepper_flash.h" | |
20 #include "chrome/common/render_messages.h" | 21 #include "chrome/common/render_messages.h" |
21 #include "content/public/common/pepper_plugin_info.h" | 22 #include "content/public/common/pepper_plugin_info.h" |
22 #include "content/public/common/url_constants.h" | 23 #include "content/public/common/url_constants.h" |
23 #include "grit/common_resources.h" | 24 #include "grit/common_resources.h" |
24 #include "remoting/client/plugin/pepper_entrypoints.h" | 25 #include "remoting/client/plugin/pepper_entrypoints.h" |
25 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
26 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
27 #include "webkit/glue/user_agent.h" | 28 #include "webkit/glue/user_agent.h" |
28 #include "webkit/plugins/npapi/plugin_list.h" | 29 #include "webkit/plugins/npapi/plugin_list.h" |
29 #include "webkit/plugins/plugin_constants.h" | 30 #include "webkit/plugins/plugin_constants.h" |
30 | 31 |
31 #include "flapper_version.h" // In <(SHARED_INTERMEDIATE_DIR). | 32 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. |
32 | 33 |
33 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
34 #include "base/win/registry.h" | 35 #include "base/win/registry.h" |
35 #include "base/win/windows_version.h" | 36 #include "base/win/windows_version.h" |
36 #include "sandbox/src/sandbox.h" | 37 #include "sandbox/src/sandbox.h" |
37 #elif defined(OS_MACOSX) | 38 #elif defined(OS_MACOSX) |
38 #include "chrome/common/chrome_sandbox_type_mac.h" | 39 #include "chrome/common/chrome_sandbox_type_mac.h" |
39 #endif | 40 #endif |
40 | 41 |
41 namespace { | 42 namespace { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 const CommandLine::StringType flash_path = | 208 const CommandLine::StringType flash_path = |
208 CommandLine::ForCurrentProcess()->GetSwitchValueNative( | 209 CommandLine::ForCurrentProcess()->GetSwitchValueNative( |
209 switches::kPpapiFlashPath); | 210 switches::kPpapiFlashPath); |
210 if (!flash_path.empty()) { | 211 if (!flash_path.empty()) { |
211 plugin.path = FilePath(flash_path); | 212 plugin.path = FilePath(flash_path); |
212 | 213 |
213 // Also get the version from the command-line. | 214 // Also get the version from the command-line. |
214 flash_version = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 215 flash_version = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
215 switches::kPpapiFlashVersion); | 216 switches::kPpapiFlashVersion); |
216 } else { | 217 } else { |
217 // Use the bundled Pepper Flash if it's enabled and available. | 218 // Try to use a bundled Pepper Flash if: |
218 // It's currently only enabled by default on Linux ia32 and x64. | 219 // 1) it's forcibly enabled via the command-line; |
219 #if defined(FLAPPER_AVAILABLE) && defined(OS_LINUX) && \ | |
220 (defined(ARCH_CPU_X86) || defined(ARCH_CPU_X86_64)) | |
221 bool bundled_flapper_enabled = true; | |
222 #else | |
223 bool bundled_flapper_enabled = CommandLine::ForCurrentProcess()->HasSwitch( | 220 bool bundled_flapper_enabled = CommandLine::ForCurrentProcess()->HasSwitch( |
224 switches::kEnableBundledPpapiFlash); | 221 switches::kEnableBundledPpapiFlash); |
222 // 2) it's known to be available at build time and enabled by default; and | |
223 #if defined(FLAPPER_AVAILABLE) | |
224 bundled_flapper_enabled |= IsPepperFlashEnabledByDefault(); | |
225 #endif | 225 #endif |
226 // 3) it's not forcibly disabled via the command-line. | |
226 bundled_flapper_enabled &= !CommandLine::ForCurrentProcess()->HasSwitch( | 227 bundled_flapper_enabled &= !CommandLine::ForCurrentProcess()->HasSwitch( |
227 switches::kDisableBundledPpapiFlash); | 228 switches::kDisableBundledPpapiFlash); |
yzshen1
2012/04/19 18:33:09
should be 8 space indent (from the beginning of th
viettrungluu
2012/04/19 20:23:16
It's a 4-space continuation indent from being alig
yzshen1
2012/04/19 20:27:49
But it is not consistent with line 221.
I don't th
| |
228 if (!bundled_flapper_enabled) | 229 if (!bundled_flapper_enabled) |
229 return; | 230 return; |
230 | 231 |
231 #if defined(FLAPPER_AVAILABLE) | 232 #if defined(FLAPPER_AVAILABLE) |
232 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &plugin.path)) | 233 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &plugin.path)) |
233 return; | 234 return; |
234 flash_version = FLAPPER_VERSION_STRING; | 235 flash_version = FLAPPER_VERSION_STRING; |
235 #else | 236 #else |
236 LOG(ERROR) << "PPAPI Flash not included at build time."; | 237 LOG(ERROR) << "PPAPI Flash not included at build time."; |
237 return; | 238 return; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
453 DCHECK(sandbox_profile_resource_id); | 454 DCHECK(sandbox_profile_resource_id); |
454 if (sandbox_type == CHROME_SANDBOX_TYPE_NACL_LOADER) { | 455 if (sandbox_type == CHROME_SANDBOX_TYPE_NACL_LOADER) { |
455 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; | 456 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; |
456 return true; | 457 return true; |
457 } | 458 } |
458 return false; | 459 return false; |
459 } | 460 } |
460 #endif | 461 #endif |
461 | 462 |
462 } // namespace chrome | 463 } // namespace chrome |
OLD | NEW |