Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1034)

Side by Side Diff: chrome/common/chrome_content_client.cc

Issue 2370683003: Don't add fake flash when command-line flash exists. (Closed)
Patch Set: Ready for review Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 content::kFlashPluginSwfDescription); 272 content::kFlashPluginSwfDescription);
273 plugin.mime_types.push_back(swf_mime_type); 273 plugin.mime_types.push_back(swf_mime_type);
274 content::WebPluginMimeType spl_mime_type(content::kFlashPluginSplMimeType, 274 content::WebPluginMimeType spl_mime_type(content::kFlashPluginSplMimeType,
275 content::kFlashPluginSplExtension, 275 content::kFlashPluginSplExtension,
276 content::kFlashPluginSplDescription); 276 content::kFlashPluginSplDescription);
277 plugin.mime_types.push_back(spl_mime_type); 277 plugin.mime_types.push_back(spl_mime_type);
278 278
279 return plugin; 279 return plugin;
280 } 280 }
281 281
282 void AddPepperFlashFromCommandLine( 282 bool GetCommandLinePepperFlash(content::PepperPluginInfo* plugin) {
283 std::vector<content::PepperPluginInfo>* plugins) {
284 const base::CommandLine::StringType flash_path = 283 const base::CommandLine::StringType flash_path =
285 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative( 284 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(
286 switches::kPpapiFlashPath); 285 switches::kPpapiFlashPath);
287 if (flash_path.empty()) 286 if (flash_path.empty())
288 return; 287 return false;
289 288
290 // Also get the version from the command-line. Should be something like 11.2 289 // Also get the version from the command-line. Should be something like 11.2
291 // or 11.2.123.45. 290 // or 11.2.123.45.
292 std::string flash_version = 291 std::string flash_version =
293 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 292 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
294 switches::kPpapiFlashVersion); 293 switches::kPpapiFlashVersion);
295 294
296 plugins->push_back( 295 *plugin = CreatePepperFlashInfo(base::FilePath(flash_path),
297 CreatePepperFlashInfo(base::FilePath(flash_path), 296 flash_version, false, true, false);
298 flash_version, false, true, false)); 297 return true;
299 } 298 }
300 299
301 #if defined(OS_LINUX) 300 #if defined(OS_LINUX)
302 // This function tests if DIR_USER_DATA can be accessed, as a simple check to 301 // This function tests if DIR_USER_DATA can be accessed, as a simple check to
303 // see if the zygote has been sandboxed at this point. 302 // see if the zygote has been sandboxed at this point.
304 bool IsUserDataDirAvailable() { 303 bool IsUserDataDirAvailable() {
305 base::FilePath user_data_dir; 304 base::FilePath user_data_dir;
306 return PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); 305 return PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
307 } 306 }
308 307
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 } 478 }
480 479
481 return plugin_map.rbegin()->second; 480 return plugin_map.rbegin()->second;
482 } 481 }
483 #endif // defined(ENABLE_PLUGINS) 482 #endif // defined(ENABLE_PLUGINS)
484 483
485 void ChromeContentClient::AddPepperPlugins( 484 void ChromeContentClient::AddPepperPlugins(
486 std::vector<content::PepperPluginInfo>* plugins) { 485 std::vector<content::PepperPluginInfo>* plugins) {
487 #if defined(ENABLE_PLUGINS) 486 #if defined(ENABLE_PLUGINS)
488 ComputeBuiltInPlugins(plugins); 487 ComputeBuiltInPlugins(plugins);
489 AddPepperFlashFromCommandLine(plugins);
490 488
489 ScopedVector<content::PepperPluginInfo> flash_versions;
490
491 std::unique_ptr<content::PepperPluginInfo> command_line_flash(
492 new content::PepperPluginInfo);
493 bool has_cli_flash = GetCommandLinePepperFlash(command_line_flash.get());
491 #if defined(OS_LINUX) 494 #if defined(OS_LINUX)
492 // Depending on the sandbox configurtion, the user data directory 495 // Depending on the sandbox configuration, the user data directory
493 // is not always available. If it is not available, do not try and load any 496 // 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 497 // flash plugin. The flash player, if any, preloaded before the sandbox
495 // initialization will continue to be used. 498 // initialization will continue to be used.
496 if (!IsUserDataDirAvailable()) { 499 if (!IsUserDataDirAvailable()) {
500 if (has_cli_flash)
Greg K 2016/09/26 22:54:14 I'm confused by this: why do we want to push back
waffles 2016/09/26 23:02:32 I don't know what the purpose of this is, I just d
501 plugins->push_back(*command_line_flash);
497 return; 502 return;
498 } 503 }
499 #endif // defined(OS_LINUX) 504 #endif // defined(OS_LINUX)
500 505 if (has_cli_flash)
501 ScopedVector<content::PepperPluginInfo> flash_versions; 506 flash_versions.push_back(command_line_flash.release());
502 507
503 #if defined(OS_LINUX) 508 #if defined(OS_LINUX)
504 std::unique_ptr<content::PepperPluginInfo> component_flash( 509 std::unique_ptr<content::PepperPluginInfo> component_flash(
505 new content::PepperPluginInfo); 510 new content::PepperPluginInfo);
506 if (GetComponentUpdatedPepperFlash(component_flash.get())) 511 if (GetComponentUpdatedPepperFlash(component_flash.get()))
507 flash_versions.push_back(component_flash.release()); 512 flash_versions.push_back(component_flash.release());
508 #endif // defined(OS_LINUX) 513 #endif // defined(OS_LINUX)
509 514
510 std::unique_ptr<content::PepperPluginInfo> system_flash( 515 std::unique_ptr<content::PepperPluginInfo> system_flash(
511 new content::PepperPluginInfo); 516 new content::PepperPluginInfo);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 if (!origin_trial_policy_) 692 if (!origin_trial_policy_)
688 origin_trial_policy_ = base::MakeUnique<ChromeOriginTrialPolicy>(); 693 origin_trial_policy_ = base::MakeUnique<ChromeOriginTrialPolicy>();
689 return origin_trial_policy_.get(); 694 return origin_trial_policy_.get();
690 } 695 }
691 696
692 #if defined(OS_ANDROID) 697 #if defined(OS_ANDROID)
693 media::MediaClientAndroid* ChromeContentClient::GetMediaClientAndroid() { 698 media::MediaClientAndroid* ChromeContentClient::GetMediaClientAndroid() {
694 return new ChromeMediaClientAndroid(); 699 return new ChromeMediaClientAndroid();
695 } 700 }
696 #endif // OS_ANDROID 701 #endif // OS_ANDROID
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698