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 <stdint.h> | 7 #include <stdint.h> |
8 #include <sys/stat.h> | |
8 | 9 |
9 #include <map> | 10 #include <map> |
10 #include <memory> | 11 #include <memory> |
11 #include <tuple> | 12 #include <tuple> |
12 | 13 |
13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
14 #include "base/debug/crash_logging.h" | 15 #include "base/debug/crash_logging.h" |
15 #include "base/files/file_util.h" | 16 #include "base/files/file_util.h" |
16 #include "base/json/json_reader.h" | 17 #include "base/json/json_reader.h" |
17 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 std::string flash_version = | 293 std::string flash_version = |
293 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 294 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
294 switches::kPpapiFlashVersion); | 295 switches::kPpapiFlashVersion); |
295 | 296 |
296 plugins->push_back( | 297 plugins->push_back( |
297 CreatePepperFlashInfo(base::FilePath(flash_path), | 298 CreatePepperFlashInfo(base::FilePath(flash_path), |
298 flash_version, false, true, false)); | 299 flash_version, false, true, false)); |
299 } | 300 } |
300 | 301 |
301 #if defined(OS_LINUX) | 302 #if defined(OS_LINUX) |
302 // This function tests if DIR_USER_DATA can be accessed, as a simple check to | 303 // This function tests if DIR_USER_DATA can be accessed, as a simple check to |
rickyz (no longer on Chrome)
2016/09/22 17:31:15
Update the comment as well.
| |
303 // see if the zygote has been sandboxed at this point. | 304 // see if the zygote has been sandboxed at this point. |
304 bool IsUserDataDirAvailable() { | 305 bool IsSandboxed() { |
305 base::FilePath user_data_dir; | 306 struct stat st; |
306 return PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 307 return stat("/proc/self/exe", &st) == -1; |
307 } | 308 } |
308 | 309 |
309 // This method is used on Linux only because of architectural differences in how | 310 // This method is used on Linux only because of architectural differences in how |
310 // it loads the component updated flash plugin, and not because the other | 311 // it loads the component updated flash plugin, and not because the other |
311 // platforms do not support component updated flash. On other platforms, the | 312 // platforms do not support component updated flash. On other platforms, the |
312 // component updater sends an IPC message to all threads, at undefined points in | 313 // component updater sends an IPC message to all threads, at undefined points in |
313 // time, with the URL of the component updated flash. Because the linux zygote | 314 // time, with the URL of the component updated flash. Because the linux zygote |
314 // thread has no access to the file system after it warms up, it must preload | 315 // thread has no access to the file system after it warms up, it must preload |
315 // the component updated flash. | 316 // the component updated flash. |
316 bool GetComponentUpdatedPepperFlash(content::PepperPluginInfo* plugin) { | 317 bool GetComponentUpdatedPepperFlash(content::PepperPluginInfo* plugin) { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
486 std::vector<content::PepperPluginInfo>* plugins) { | 487 std::vector<content::PepperPluginInfo>* plugins) { |
487 #if defined(ENABLE_PLUGINS) | 488 #if defined(ENABLE_PLUGINS) |
488 ComputeBuiltInPlugins(plugins); | 489 ComputeBuiltInPlugins(plugins); |
489 AddPepperFlashFromCommandLine(plugins); | 490 AddPepperFlashFromCommandLine(plugins); |
490 | 491 |
491 #if defined(OS_LINUX) | 492 #if defined(OS_LINUX) |
492 // Depending on the sandbox configurtion, the user data directory | 493 // Depending on the sandbox configurtion, the user data directory |
493 // is not always available. If it is not available, do not try and load any | 494 // is not always available. If it is not available, do not try and load any |
494 // flash plugin. The flash player, if any, preloaded before the sandbox | 495 // flash plugin. The flash player, if any, preloaded before the sandbox |
495 // initialization will continue to be used. | 496 // initialization will continue to be used. |
496 if (!IsUserDataDirAvailable()) { | 497 if (IsSandboxed()) { |
497 return; | 498 return; |
498 } | 499 } |
499 #endif // defined(OS_LINUX) | 500 #endif // defined(OS_LINUX) |
500 | 501 |
501 ScopedVector<content::PepperPluginInfo> flash_versions; | 502 ScopedVector<content::PepperPluginInfo> flash_versions; |
502 | 503 |
503 #if defined(OS_LINUX) | 504 #if defined(OS_LINUX) |
504 std::unique_ptr<content::PepperPluginInfo> component_flash( | 505 std::unique_ptr<content::PepperPluginInfo> component_flash( |
505 new content::PepperPluginInfo); | 506 new content::PepperPluginInfo); |
506 if (GetComponentUpdatedPepperFlash(component_flash.get())) | 507 if (GetComponentUpdatedPepperFlash(component_flash.get())) |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
687 if (!origin_trial_policy_) | 688 if (!origin_trial_policy_) |
688 origin_trial_policy_ = base::MakeUnique<ChromeOriginTrialPolicy>(); | 689 origin_trial_policy_ = base::MakeUnique<ChromeOriginTrialPolicy>(); |
689 return origin_trial_policy_.get(); | 690 return origin_trial_policy_.get(); |
690 } | 691 } |
691 | 692 |
692 #if defined(OS_ANDROID) | 693 #if defined(OS_ANDROID) |
693 media::MediaClientAndroid* ChromeContentClient::GetMediaClientAndroid() { | 694 media::MediaClientAndroid* ChromeContentClient::GetMediaClientAndroid() { |
694 return new ChromeMediaClientAndroid(); | 695 return new ChromeMediaClientAndroid(); |
695 } | 696 } |
696 #endif // OS_ANDROID | 697 #endif // OS_ANDROID |
OLD | NEW |