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

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

Issue 2390613003: Don't add fake flash when command-line flash exists. (Closed)
Patch Set: 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 content::kFlashPluginSwfDescription); 273 content::kFlashPluginSwfDescription);
274 plugin.mime_types.push_back(swf_mime_type); 274 plugin.mime_types.push_back(swf_mime_type);
275 content::WebPluginMimeType spl_mime_type(content::kFlashPluginSplMimeType, 275 content::WebPluginMimeType spl_mime_type(content::kFlashPluginSplMimeType,
276 content::kFlashPluginSplExtension, 276 content::kFlashPluginSplExtension,
277 content::kFlashPluginSplDescription); 277 content::kFlashPluginSplDescription);
278 plugin.mime_types.push_back(spl_mime_type); 278 plugin.mime_types.push_back(spl_mime_type);
279 279
280 return plugin; 280 return plugin;
281 } 281 }
282 282
283 void AddPepperFlashFromCommandLine( 283 bool GetCommandLinePepperFlash(content::PepperPluginInfo* plugin) {
284 std::vector<content::PepperPluginInfo>* plugins) {
285 const base::CommandLine::StringType flash_path = 284 const base::CommandLine::StringType flash_path =
286 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative( 285 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(
287 switches::kPpapiFlashPath); 286 switches::kPpapiFlashPath);
288 if (flash_path.empty()) 287 if (flash_path.empty())
289 return; 288 return false;
290 289
291 // Also get the version from the command-line. Should be something like 11.2 290 // Also get the version from the command-line. Should be something like 11.2
292 // or 11.2.123.45. 291 // or 11.2.123.45.
293 std::string flash_version = 292 std::string flash_version =
294 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 293 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
295 switches::kPpapiFlashVersion); 294 switches::kPpapiFlashVersion);
296 295
297 plugins->push_back( 296 *plugin = CreatePepperFlashInfo(base::FilePath(flash_path),
298 CreatePepperFlashInfo(base::FilePath(flash_path), 297 flash_version, false, true, false);
299 flash_version, false, true, false)); 298 return true;
300 } 299 }
301 300
302 #if defined(OS_LINUX) 301 #if defined(OS_LINUX)
303 // This function tests if DIR_USER_DATA can be accessed, as a simple check to 302 // This function tests if DIR_USER_DATA can be accessed, as a simple check to
304 // see if the zygote has been sandboxed at this point. 303 // see if the zygote has been sandboxed at this point.
305 bool IsUserDataDirAvailable() { 304 bool IsUserDataDirAvailable() {
306 base::FilePath user_data_dir; 305 base::FilePath user_data_dir;
307 return PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); 306 return PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
308 } 307 }
309 308
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 } 479 }
481 480
482 return plugin_map.rbegin()->second; 481 return plugin_map.rbegin()->second;
483 } 482 }
484 #endif // defined(ENABLE_PLUGINS) 483 #endif // defined(ENABLE_PLUGINS)
485 484
486 void ChromeContentClient::AddPepperPlugins( 485 void ChromeContentClient::AddPepperPlugins(
487 std::vector<content::PepperPluginInfo>* plugins) { 486 std::vector<content::PepperPluginInfo>* plugins) {
488 #if defined(ENABLE_PLUGINS) 487 #if defined(ENABLE_PLUGINS)
489 ComputeBuiltInPlugins(plugins); 488 ComputeBuiltInPlugins(plugins);
490 AddPepperFlashFromCommandLine(plugins);
491 489
492 #if defined(OS_LINUX) 490 #if defined(OS_LINUX)
493 // Depending on the sandbox configurtion, the user data directory 491 // Depending on the sandbox configuration, the user data directory
494 // is not always available. If it is not available, do not try and load any 492 // is not always available. If it is not available, do not try and load any
495 // flash plugin. The flash player, if any, preloaded before the sandbox 493 // flash plugin. The flash player, if any, preloaded before the sandbox
496 // initialization will continue to be used. 494 // initialization will continue to be used.
497 if (!IsUserDataDirAvailable()) { 495 if (!IsUserDataDirAvailable()) {
498 return; 496 return;
499 } 497 }
500 #endif // defined(OS_LINUX) 498 #endif // defined(OS_LINUX)
501 499
502 ScopedVector<content::PepperPluginInfo> flash_versions; 500 ScopedVector<content::PepperPluginInfo> flash_versions;
501 std::unique_ptr<content::PepperPluginInfo> command_line_flash(
502 new content::PepperPluginInfo);
503 if (GetCommandLinePepperFlash(command_line_flash.get()))
504 flash_versions.push_back(command_line_flash.release());
503 505
504 #if defined(OS_LINUX) 506 #if defined(OS_LINUX)
505 std::unique_ptr<content::PepperPluginInfo> component_flash( 507 std::unique_ptr<content::PepperPluginInfo> component_flash(
506 new content::PepperPluginInfo); 508 new content::PepperPluginInfo);
507 if (GetComponentUpdatedPepperFlash(component_flash.get())) 509 if (GetComponentUpdatedPepperFlash(component_flash.get()))
508 flash_versions.push_back(component_flash.release()); 510 flash_versions.push_back(component_flash.release());
509 #endif // defined(OS_LINUX) 511 #endif // defined(OS_LINUX)
510 512
511 std::unique_ptr<content::PepperPluginInfo> system_flash( 513 std::unique_ptr<content::PepperPluginInfo> system_flash(
512 new content::PepperPluginInfo); 514 new content::PepperPluginInfo);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 origin_trial_policy_ = base::WrapUnique(new ChromeOriginTrialPolicy()); 696 origin_trial_policy_ = base::WrapUnique(new ChromeOriginTrialPolicy());
695 } 697 }
696 return origin_trial_policy_.get(); 698 return origin_trial_policy_.get();
697 } 699 }
698 700
699 #if defined(OS_ANDROID) 701 #if defined(OS_ANDROID)
700 media::MediaClientAndroid* ChromeContentClient::GetMediaClientAndroid() { 702 media::MediaClientAndroid* ChromeContentClient::GetMediaClientAndroid() {
701 return new ChromeMediaClientAndroid(); 703 return new ChromeMediaClientAndroid();
702 } 704 }
703 #endif // OS_ANDROID 705 #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