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 "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
22 #include "content/public/common/pepper_plugin_info.h" | 23 #include "content/public/common/pepper_plugin_info.h" |
23 #include "content/public/common/url_constants.h" | 24 #include "content/public/common/url_constants.h" |
24 #include "grit/common_resources.h" | 25 #include "grit/common_resources.h" |
25 #include "remoting/client/plugin/pepper_entrypoints.h" | 26 #include "remoting/client/plugin/pepper_entrypoints.h" |
26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
27 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
28 #include "webkit/glue/user_agent.h" | 29 #include "webkit/glue/user_agent.h" |
29 #include "webkit/plugins/npapi/plugin_list.h" | 30 #include "webkit/plugins/npapi/plugin_list.h" |
30 #include "webkit/plugins/plugin_constants.h" | 31 #include "webkit/plugins/plugin_constants.h" |
31 | 32 |
32 #include "flapper_version.h" // In <(SHARED_INTERMEDIATE_DIR). | 33 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. |
33 | 34 |
34 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
35 #include "base/win/registry.h" | 36 #include "base/win/registry.h" |
36 #include "base/win/windows_version.h" | 37 #include "base/win/windows_version.h" |
37 #include "sandbox/src/sandbox.h" | 38 #include "sandbox/src/sandbox.h" |
38 #elif defined(OS_MACOSX) | 39 #elif defined(OS_MACOSX) |
39 #include "chrome/common/chrome_sandbox_type_mac.h" | 40 #include "chrome/common/chrome_sandbox_type_mac.h" |
40 #endif | 41 #endif |
41 | 42 |
42 namespace { | 43 namespace { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 const CommandLine::StringType flash_path = | 209 const CommandLine::StringType flash_path = |
209 CommandLine::ForCurrentProcess()->GetSwitchValueNative( | 210 CommandLine::ForCurrentProcess()->GetSwitchValueNative( |
210 switches::kPpapiFlashPath); | 211 switches::kPpapiFlashPath); |
211 if (!flash_path.empty()) { | 212 if (!flash_path.empty()) { |
212 plugin.path = FilePath(flash_path); | 213 plugin.path = FilePath(flash_path); |
213 | 214 |
214 // Also get the version from the command-line. | 215 // Also get the version from the command-line. |
215 flash_version = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 216 flash_version = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
216 switches::kPpapiFlashVersion); | 217 switches::kPpapiFlashVersion); |
217 } else { | 218 } else { |
218 // Use the bundled Pepper Flash if it's enabled and available. | 219 // Try to use a bundled Pepper Flash if: |
219 // It's currently only enabled by default on Linux ia32 and x64. | 220 // 1) it's forcibly enabled via the command-line; |
220 #if defined(FLAPPER_AVAILABLE) && defined(OS_LINUX) && \ | |
221 (defined(ARCH_CPU_X86) || defined(ARCH_CPU_X86_64)) | |
222 bool bundled_flapper_enabled = true; | |
223 #else | |
224 bool bundled_flapper_enabled = CommandLine::ForCurrentProcess()->HasSwitch( | 221 bool bundled_flapper_enabled = CommandLine::ForCurrentProcess()->HasSwitch( |
225 switches::kEnableBundledPpapiFlash); | 222 switches::kEnableBundledPpapiFlash); |
| 223 // 2) it's known to be available at build time and enabled by default; and |
| 224 #if defined(FLAPPER_AVAILABLE) |
| 225 bundled_flapper_enabled |= IsPepperFlashEnabledByDefault(); |
226 #endif | 226 #endif |
| 227 // 3) it's not forcibly disabled via the command-line. |
227 bundled_flapper_enabled &= !CommandLine::ForCurrentProcess()->HasSwitch( | 228 bundled_flapper_enabled &= !CommandLine::ForCurrentProcess()->HasSwitch( |
228 switches::kDisableBundledPpapiFlash); | 229 switches::kDisableBundledPpapiFlash); |
229 if (!bundled_flapper_enabled) | 230 if (!bundled_flapper_enabled) |
230 return; | 231 return; |
231 | 232 |
232 #if defined(FLAPPER_AVAILABLE) | 233 #if defined(FLAPPER_AVAILABLE) |
233 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &plugin.path)) | 234 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &plugin.path)) |
234 return; | 235 return; |
235 // It is an error to have FLAPPER_AVAILABLE defined but then not having the | 236 // It is an error to have FLAPPER_AVAILABLE defined but then not having the |
236 // plugin file in place, but this happens in Chrome OS builds. | 237 // plugin file in place, but this happens in Chrome OS builds. |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 DCHECK(sandbox_profile_resource_id); | 470 DCHECK(sandbox_profile_resource_id); |
470 if (sandbox_type == CHROME_SANDBOX_TYPE_NACL_LOADER) { | 471 if (sandbox_type == CHROME_SANDBOX_TYPE_NACL_LOADER) { |
471 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; | 472 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; |
472 return true; | 473 return true; |
473 } | 474 } |
474 return false; | 475 return false; |
475 } | 476 } |
476 #endif | 477 #endif |
477 | 478 |
478 } // namespace chrome | 479 } // namespace chrome |
OLD | NEW |