Fix passing paths in command line

This commit is contained in:
Cheng Zhao 2016-05-11 08:47:50 +09:00
Родитель 61bf3ae1ee
Коммит 0dad2581ef
2 изменённых файлов: 8 добавлений и 7 удалений

Просмотреть файл

@ -126,7 +126,7 @@ void ConvertStringWithSeparatorToVector(std::vector<std::string>* vec,
void AddPepperFlashFromCommandLine( void AddPepperFlashFromCommandLine(
std::vector<content::PepperPluginInfo>* plugins) { std::vector<content::PepperPluginInfo>* plugins) {
auto command_line = base::CommandLine::ForCurrentProcess(); auto command_line = base::CommandLine::ForCurrentProcess();
auto flash_path = command_line->GetSwitchValueNative( base::FilePath flash_path = command_line->GetSwitchValuePath(
switches::kPpapiFlashPath); switches::kPpapiFlashPath);
if (flash_path.empty()) if (flash_path.empty())
return; return;
@ -134,20 +134,19 @@ void AddPepperFlashFromCommandLine(
auto flash_version = command_line->GetSwitchValueASCII( auto flash_version = command_line->GetSwitchValueASCII(
switches::kPpapiFlashVersion); switches::kPpapiFlashVersion);
plugins->push_back( plugins->push_back(CreatePepperFlashInfo(flash_path, flash_version));
CreatePepperFlashInfo(base::FilePath(flash_path), flash_version));
} }
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
void AddWidevineCdmFromCommandLine( void AddWidevineCdmFromCommandLine(
std::vector<content::PepperPluginInfo>* plugins) { std::vector<content::PepperPluginInfo>* plugins) {
auto command_line = base::CommandLine::ForCurrentProcess(); auto command_line = base::CommandLine::ForCurrentProcess();
auto widevine_cdm_path = command_line->GetSwitchValueNative( base::FilePath widevine_cdm_path = command_line->GetSwitchValuePath(
switches::kWidevineCdmPath); switches::kWidevineCdmPath);
if (widevine_cdm_path.empty()) if (widevine_cdm_path.empty())
return; return;
if (!base::PathExists(base::FilePath(widevine_cdm_path))) if (!base::PathExists(widevine_cdm_path))
return; return;
auto widevine_cdm_version = command_line->GetSwitchValueASCII( auto widevine_cdm_version = command_line->GetSwitchValueASCII(
@ -155,7 +154,7 @@ void AddWidevineCdmFromCommandLine(
if (widevine_cdm_version.empty()) if (widevine_cdm_version.empty())
return; return;
plugins->push_back(CreateWidevineCdmInfo(base::FilePath(widevine_cdm_path), plugins->push_back(CreateWidevineCdmInfo(widevine_cdm_path,
widevine_cdm_version)); widevine_cdm_version));
} }
#endif #endif

Просмотреть файл

@ -27,6 +27,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/strings/string_util.h"
#include "brightray/browser/brightray_paths.h" #include "brightray/browser/brightray_paths.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "content/public/browser/client_certificate_delegate.h" #include "content/public/browser/client_certificate_delegate.h"
@ -500,7 +501,8 @@ namespace {
void AppendSwitch(const std::string& switch_string, mate::Arguments* args) { void AppendSwitch(const std::string& switch_string, mate::Arguments* args) {
auto command_line = base::CommandLine::ForCurrentProcess(); auto command_line = base::CommandLine::ForCurrentProcess();
if (switch_string == atom::switches::kPpapiFlashPath || if (base::EndsWith(switch_string, "-path",
base::CompareCase::INSENSITIVE_ASCII) ||
switch_string == switches::kLogNetLog) { switch_string == switches::kLogNetLog) {
base::FilePath path; base::FilePath path;
args->GetNext(&path); args->GetNext(&path);