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