CommandLine moved to base::CommandLine

This commit is contained in:
Cheng Zhao 2015-03-10 15:27:27 -07:00
parent 14542f4fc8
commit dead7caab2
7 changed files with 13 additions and 12 deletions

View file

@ -59,7 +59,7 @@ void AtomMainDelegate::PreSandboxStartup() {
if (!env->HasVar("GOOGLE_API_KEY")) if (!env->HasVar("GOOGLE_API_KEY"))
env->SetVar("GOOGLE_API_KEY", GOOGLEAPIS_API_KEY); env->SetVar("GOOGLE_API_KEY", GOOGLEAPIS_API_KEY);
CommandLine* command_line = CommandLine::ForCurrentProcess(); auto command_line = base::CommandLine::ForCurrentProcess();
std::string process_type = command_line->GetSwitchValueASCII( std::string process_type = command_line->GetSwitchValueASCII(
switches::kProcessType); switches::kProcessType);

View file

@ -238,11 +238,12 @@ mate::Handle<App> App::Create(v8::Isolate* isolate) {
namespace { 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();
std::string value; std::string value;
if (args->GetNext(&value)) if (args->GetNext(&value))
CommandLine::ForCurrentProcess()->AppendSwitchASCII(switch_string, value); command_line->AppendSwitchASCII(switch_string, value);
else else
CommandLine::ForCurrentProcess()->AppendSwitch(switch_string); command_line->AppendSwitch(switch_string);
} }
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
@ -263,13 +264,13 @@ void DockSetMenu(atom::api::Menu* menu) {
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused, void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context, void* priv) { v8::Handle<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate(); v8::Isolate* isolate = context->GetIsolate();
CommandLine* command_line = CommandLine::ForCurrentProcess(); auto command_line = base::CommandLine::ForCurrentProcess();
mate::Dictionary dict(isolate, exports); mate::Dictionary dict(isolate, exports);
dict.Set("app", atom::api::App::Create(isolate)); dict.Set("app", atom::api::App::Create(isolate));
dict.SetMethod("appendSwitch", &AppendSwitch); dict.SetMethod("appendSwitch", &AppendSwitch);
dict.SetMethod("appendArgument", dict.SetMethod("appendArgument",
base::Bind(&CommandLine::AppendArg, base::Bind(&base::CommandLine::AppendArg,
base::Unretained(command_line))); base::Unretained(command_line)));
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
auto browser = base::Unretained(Browser::Get()); auto browser = base::Unretained(Browser::Get());

View file

@ -12,8 +12,8 @@
namespace crash_reporter { namespace crash_reporter {
CrashReporter::CrashReporter() { CrashReporter::CrashReporter() {
const CommandLine& command = *CommandLine::ForCurrentProcess(); auto command_line = base::CommandLine::ForCurrentProcess();
is_browser_ = command.GetSwitchValueASCII(switches::kProcessType).empty(); is_browser_ = command->GetSwitchValueASCII(switches::kProcessType).empty();
} }
CrashReporter::~CrashReporter() { CrashReporter::~CrashReporter() {

View file

@ -205,7 +205,7 @@ bool CrashService::Initialize(const base::FilePath& operating_dir,
// reports per day quota. Does not seem to serve any other purpose. // reports per day quota. Does not seem to serve any other purpose.
base::FilePath checkpoint_path = operating_dir.Append(kCheckPointFile); base::FilePath checkpoint_path = operating_dir.Append(kCheckPointFile);
CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess();
base::FilePath dumps_path_to_use = dumps_path; base::FilePath dumps_path_to_use = dumps_path;

View file

@ -39,8 +39,8 @@ bool GetCrashServiceDirectory(const std::wstring& application_name,
int Main(const wchar_t* cmd) { int Main(const wchar_t* cmd) {
// Initialize all Chromium things. // Initialize all Chromium things.
base::AtExitManager exit_manager; base::AtExitManager exit_manager;
CommandLine::Init(0, NULL); base::CommandLine::Init(0, NULL);
CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess();
// Use the application's name as pipe name and output directory. // Use the application's name as pipe name and output directory.
if (!cmd_line.HasSwitch(kApplicationName)) { if (!cmd_line.HasSwitch(kApplicationName)) {

View file

@ -165,7 +165,7 @@ void NodeBindings::Initialize() {
node::Environment* NodeBindings::CreateEnvironment( node::Environment* NodeBindings::CreateEnvironment(
v8::Handle<v8::Context> context) { v8::Handle<v8::Context> context) {
CommandLine* command_line = CommandLine::ForCurrentProcess(); auto command_line = base::CommandLine::ForCurrentProcess();
std::vector<std::string> args = std::vector<std::string> args =
#if defined(OS_WIN) #if defined(OS_WIN)
String16VectorToStringVector(command_line->argv()); String16VectorToStringVector(command_line->argv());

View file

@ -67,7 +67,7 @@ void AtomRenderViewObserver::DidCreateDocumentElement(
document_created_ = true; document_created_ = true;
// Read --zoom-factor from command line. // Read --zoom-factor from command line.
std::string zoom_factor_str = CommandLine::ForCurrentProcess()-> std::string zoom_factor_str = base::CommandLine::ForCurrentProcess()->
GetSwitchValueASCII(switches::kZoomFactor);; GetSwitchValueASCII(switches::kZoomFactor);;
if (zoom_factor_str.empty()) if (zoom_factor_str.empty())
return; return;