| 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 "content/common/pepper_plugin_list.h" | 5 #include "content/common/pepper_plugin_list.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // Appends any plugins from the command line to the given vector. | 24 // Appends any plugins from the command line to the given vector. |
| 25 void ComputePluginsFromCommandLine(std::vector<PepperPluginInfo>* plugins) { | 25 void ComputePluginsFromCommandLine(std::vector<PepperPluginInfo>* plugins) { |
| 26 // On Linux, once we're sandboxed, we can't know if a plugin is available or | 26 // On Linux, once we're sandboxed, we can't know if a plugin is available or |
| 27 // not. But (on Linux) this function is always called once before we're | 27 // not. But (on Linux) this function is always called once before we're |
| 28 // sandboxed. So when this function is called for the first time we set a | 28 // sandboxed. So when this function is called for the first time we set a |
| 29 // flag if the plugin file is available. Then we can skip the check on file | 29 // flag if the plugin file is available. Then we can skip the check on file |
| 30 // existence in subsequent calls if the flag is set. | 30 // existence in subsequent calls if the flag is set. |
| 31 // NOTE: In theory we could have unlimited number of plugins registered in | 31 // NOTE: In theory we could have unlimited number of plugins registered in |
| 32 // command line. But in practice, 64 plugins should be more than enough. | 32 // command line. But in practice, 64 plugins should be more than enough. |
| 33 static uint64 skip_file_check_flags = 0; | 33 static uint64 skip_file_check_flags = 0; |
| 34 COMPILE_ASSERT( | 34 static_assert( |
| 35 kMaxPluginsToRegisterFromCommandLine <= sizeof(skip_file_check_flags) * 8, | 35 kMaxPluginsToRegisterFromCommandLine <= sizeof(skip_file_check_flags) * 8, |
| 36 max_plugins_to_register_from_command_line_exceeds_limit); | 36 "max plugins to register from command line exceeds limit"); |
| 37 | 37 |
| 38 bool out_of_process = true; | 38 bool out_of_process = true; |
| 39 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 39 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 40 switches::kPpapiInProcess)) | 40 switches::kPpapiInProcess)) |
| 41 out_of_process = false; | 41 out_of_process = false; |
| 42 | 42 |
| 43 const std::string value = | 43 const std::string value = |
| 44 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 44 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 45 switches::kRegisterPepperPlugins); | 45 switches::kRegisterPepperPlugins); |
| 46 if (value.empty()) | 46 if (value.empty()) |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 return true; | 144 return true; |
| 145 } | 145 } |
| 146 | 146 |
| 147 void ComputePepperPluginList(std::vector<PepperPluginInfo>* plugins) { | 147 void ComputePepperPluginList(std::vector<PepperPluginInfo>* plugins) { |
| 148 GetContentClient()->AddPepperPlugins(plugins); | 148 GetContentClient()->AddPepperPlugins(plugins); |
| 149 ComputePluginsFromCommandLine(plugins); | 149 ComputePluginsFromCommandLine(plugins); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace content | 152 } // namespace content |
| OLD | NEW |