|
23 | 23 | #include <vector>
|
24 | 24 |
|
25 | 25 | #include "base/command_line.h"
|
| 26 | +#include "base/environment.h" |
26 | 27 | #include "base/files/file_util.h"
|
27 | 28 | #include "base/files/scoped_temp_dir.h"
|
28 | 29 | #include "base/json/json_file_value_serializer.h"
|
@@ -389,6 +390,8 @@ void Package::InitWithDefault() {
|
389 | 390 | // Window should show in center by default.
|
390 | 391 | window->SetString(switches::kmPosition, "center");
|
391 | 392 | root()->Set(switches::kmWindow, std::move(window));
|
| 393 | + |
| 394 | + ReadChromiumArgs(); |
392 | 395 | }
|
393 | 396 |
|
394 | 397 | bool Package::ExtractPath(const base::FilePath& path_to_extract,
|
@@ -448,13 +451,18 @@ bool Package::ExtractPackage(const FilePath& zip_file, FilePath* where) {
|
448 | 451 | }
|
449 | 452 |
|
450 | 453 | void Package::ReadChromiumArgs() {
|
451 |
| - if (!root()->HasKey(switches::kmChromiumArgs)) |
452 |
| - return; |
| 454 | + std::string args, env_args; |
| 455 | + std::unique_ptr<base::Environment> env(base::Environment::Create()); |
453 | 456 |
|
454 |
| - std::string args; |
455 |
| - if (!root()->GetStringASCII(switches::kmChromiumArgs, &args)) |
| 457 | + bool got_env = env->GetVar("NW_PRE_ARGS", &env_args); |
| 458 | + if (!got_env && !root()->HasKey(switches::kmChromiumArgs)) |
456 | 459 | return;
|
457 | 460 |
|
| 461 | + if (!got_env && !root()->GetStringASCII(switches::kmChromiumArgs, &args)) |
| 462 | + return; |
| 463 | + |
| 464 | + args = env_args + kChromiumArgsSeparator + args; |
| 465 | + |
458 | 466 | std::vector<std::string> chromium_args;
|
459 | 467 | base::StringTokenizer tokenizer(args, kChromiumArgsSeparator);
|
460 | 468 | tokenizer.set_quote_chars("\'");
|
|
0 commit comments