Skip to content

Commit

Permalink
nwjs master
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerwang committed Nov 23, 2016
1 parent 53b2efc commit e50d604
Show file tree
Hide file tree
Showing 634 changed files with 8,680 additions and 1,731 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -500,3 +500,5 @@ vs-chromium-project.txt
/win8/metro_driver/metro_driver_version_resources.xml
/x86-generic_out/
/xcodebuild
/content/nw

1 change: 1 addition & 0 deletions .gn
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ check_targets = [
# this situation much easier to create. if the build always lists the
# files and passes them to a script, it will always be correct.
exec_script_whitelist = [
"//content/nw/BUILD.gn",
"//android_webview/BUILD.gn",
"//ash/BUILD.gn",
"//build/config/BUILD.gn",
Expand Down
1 change: 1 addition & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ group("both_gn_and_gyp") {

if (!is_ios && !is_android && !is_chromecast) {
deps += [
"//content/nw:nwjs",
"//chrome",
"//chrome/test:browser_tests",
"//chrome/test:interactive_ui_tests",
Expand Down
24 changes: 21 additions & 3 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ vars = {
'https://chromium.googlesource.com',
'freetype_android_revision':
'c38be52bf8de3b1699d74932b849bf150265819e',
'nwjs_git':
'https://github.com/nwjs',
'google_toolbox_for_mac_revision':
'e7b41fad2e7f77abf560c79f984c60d5ec6d419c',
'libfuzzer_revision':
Expand Down Expand Up @@ -168,8 +170,13 @@ deps = {
(Var("chromium_git")) + '/chromium/deps/acid3.git@6be0a66a1ebd7ebc5abc1b2f405a945f6d871521',
'src/tools/swarming_client':
(Var("chromium_git")) + '/external/swarming.client.git@e4288c3040a32f2e7ad92f957668f2ee3d36e5a6',
'src/v8':
(Var("chromium_git")) + '/v8/v8.git@f8cbe2768cc88cb40e24c929fb28965bfb0ca6fe'
#'src/v8':
# (Var("chromium_git")) + '/v8/v8.git@f8cbe2768cc88cb40e24c929fb28965bfb0ca6fe'
# (Var("nwjs_git")) + '/v8.git@origin/nw16',
#'src/content/nw':
# (Var("nwjs_git")) + '/nw.js.git@origin/nw16',
#'src/third_party/node':
# (Var("nwjs_git")) + '/node.git@origin/nw16',
}

deps_os = {
Expand Down Expand Up @@ -952,7 +959,18 @@ hooks = [
'.',
'name':
'doclava'
}
},
{
'action': [
'python',
'src/content/nw/tools/patcher.py',
'--patch-config', 'src/content/nw/patch/patch.cfg'
],
'pattern':
'.',
'name':
'nw_patch'
},
]

include_rules = [
Expand Down
2 changes: 2 additions & 0 deletions apps/app_lifetime_monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ void AppLifetimeMonitor::OnAppWindowRemoved(AppWindow* app_window) {
}

void AppLifetimeMonitor::OnAppWindowHidden(AppWindow* app_window) {
#if 0
if (!HasOtherVisibleAppWindows(app_window))
NotifyAppDeactivated(app_window->extension_id());
#endif
}

void AppLifetimeMonitor::OnAppWindowShown(AppWindow* app_window,
Expand Down
4 changes: 4 additions & 0 deletions apps/app_load_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "apps/app_load_service.h"

#include "content/nw/src/nw_content.h"

#include "apps/app_load_service_factory.h"
#include "apps/app_restore_service.h"
#include "apps/launcher.h"
Expand Down Expand Up @@ -70,6 +72,8 @@ bool AppLoadService::LoadAndLaunch(const base::FilePath& extension_path,
return false;
}

nw::SetMainExtensionId(extension_id);

// Schedule the app to be launched once loaded.
PostReloadAction& action = post_reload_actions_[extension_id];
action.action_type = LAUNCH_FOR_LOAD_AND_LAUNCH;
Expand Down
7 changes: 5 additions & 2 deletions apps/launcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ class PlatformAppPathLauncher
extension_id(app->id()),
entry_paths_(entry_paths),
mime_type_collector_(profile),
is_directory_collector_(profile) {}
is_directory_collector_(profile) {
if (app->is_nwjs_app()) //NWJS#5097
entry_paths_.clear();
}

PlatformAppPathLauncher(Profile* profile,
const Extension* app,
Expand All @@ -112,7 +115,7 @@ class PlatformAppPathLauncher
extension_id(app->id()),
mime_type_collector_(profile),
is_directory_collector_(profile) {
if (!file_path.empty())
if (!file_path.empty() && !app->is_nwjs_app()) //NWJS#5097
entry_paths_.push_back(file_path);
}

Expand Down
2 changes: 2 additions & 0 deletions base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,8 @@ component("base") {
"message_loop/message_pump_libevent.h",
"message_loop/message_pump_mac.h",
"message_loop/message_pump_mac.mm",
"message_loop/message_pump_uv.cc",
"message_loop/message_pump_uv.h",
"message_loop/message_pump_win.cc",
"message_loop/message_pump_win.h",
"metrics/bucket_ranges.cc",
Expand Down
2 changes: 2 additions & 0 deletions base/base.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@
'message_loop/message_pump_libevent.h',
'message_loop/message_pump_mac.h',
'message_loop/message_pump_mac.mm',
'message_loop/message_pump_uv.cc',
'message_loop/message_pump_uv.h',
'metrics/field_trial.cc',
'metrics/field_trial.h',
'posix/file_descriptor_shuffle.cc',
Expand Down
1 change: 1 addition & 0 deletions base/base_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,5 @@ const char kEnableCrashReporterForTesting[] =
"enable-crash-reporter-for-testing";
#endif

const char kNWJS[] = "nwjs";
} // namespace switches
1 change: 1 addition & 0 deletions base/base_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ extern const char kDisableUsbKeyboardDetect[];
extern const char kEnableCrashReporterForTesting[];
#endif

extern const char kNWJS[];
} // namespace switches

#endif // BASE_BASE_SWITCHES_H_
78 changes: 73 additions & 5 deletions base/command_line.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,43 +151,83 @@ string16 QuoteForCommandLineToArgvW(const string16& arg,

CommandLine::CommandLine(NoProgram no_program)
: argv_(1),
begin_args_(1) {
begin_args_(1),
argc0_(0), argv0_(NULL) {
}

CommandLine::CommandLine(const FilePath& program)
: argv_(1),
begin_args_(1) {
begin_args_(1),
argc0_(0), argv0_(NULL) {
SetProgram(program);
}

CommandLine::CommandLine(int argc, const CommandLine::CharType* const* argv)
: argv_(1),
begin_args_(1) {
begin_args_(1),
argc0_(0), argv0_(NULL) {
InitFromArgv(argc, argv);
}

CommandLine::CommandLine(const StringVector& argv)
: argv_(1),
begin_args_(1) {
begin_args_(1),
argc0_(0), argv0_(NULL) {
InitFromArgv(argv);
}

CommandLine::CommandLine(const CommandLine& other)
: argv_(other.argv_),
original_argv_(other.original_argv_),
switches_(other.switches_),
begin_args_(other.begin_args_) {
begin_args_(other.begin_args_),
argc0_(other.argc0_), argv0_(NULL) {

#if defined(OS_WIN)
if (other.argv0_) {
argv0_ = new char*[argc0_ + 1];
for (int i = 0; i < argc0_; ++i) {
argv0_[i] = new char[strlen(other.argv0_[i]) + 1];
strcpy(argv0_[i], other.argv0_[i]);
}
argv0_[argc0_] = NULL;
}
#else
argv0_ = other.argv0_;
#endif
ResetStringPieces();
}

CommandLine& CommandLine::operator=(const CommandLine& other) {
argv_ = other.argv_;
original_argv_ = other.original_argv_;
switches_ = other.switches_;
begin_args_ = other.begin_args_;
#if defined(OS_WIN)
if (other.argv0_) {
argv0_ = new char*[argc0_ + 1];
for (int i = 0; i < argc0_; ++i) {
argv0_[i] = new char[strlen(other.argv0_[i]) + 1];
strcpy(argv0_[i], other.argv0_[i]);
}
argv0_[argc0_] = NULL;
}
#else
argv0_ = other.argv0_;
#endif
ResetStringPieces();
return *this;
}

CommandLine::~CommandLine() {
#if defined(OS_WIN)
if (!argv0_)
return;
for (int i = 0; i < argc0_; i++) {
delete[] argv0_[i];
}
delete[] argv0_;
#endif
}

#if defined(OS_WIN)
Expand Down Expand Up @@ -259,12 +299,34 @@ CommandLine CommandLine::FromString(const string16& command_line) {
void CommandLine::InitFromArgv(int argc,
const CommandLine::CharType* const* argv) {
StringVector new_argv;
argc0_ = argc;
#if !defined(OS_WIN)
argv0_ = (char**)argv;
#else
argv0_ = new char*[argc + 1];
for (int i = 0; i < argc; ++i) {
std::string str(base::WideToUTF8(argv[i]));
argv0_[i] = new char[str.length() + 1];
strcpy(argv0_[i], str.c_str());
}
argv0_[argc] = NULL;
#endif
for (int i = 0; i < argc; ++i)
new_argv.push_back(argv[i]);
InitFromArgv(new_argv);
}

void CommandLine::InitFromArgv(const StringVector& argv) {
#if !defined(OS_MACOSX)
original_argv_ = argv;
#else
for (size_t index = 0; index < argv.size(); ++index) {
if (argv[index].compare(0, strlen("--psn_"), "--psn_") != 0 &&
argv[index].compare(0, strlen("-psn_"), "-psn_") != 0) {
original_argv_.push_back(argv[index]);
}
}
#endif
argv_ = StringVector(1);
switches_.clear();
switches_by_stringpiece_.clear();
Expand Down Expand Up @@ -401,6 +463,12 @@ void CommandLine::AppendArgNative(const CommandLine::StringType& value) {
argv_.push_back(value);
}

#if defined(OS_MACOSX)
void CommandLine::FixOrigArgv4Finder(const CommandLine::StringType& value) {
original_argv_.push_back(value);
}
#endif

void CommandLine::AppendArguments(const CommandLine& other,
bool include_program) {
if (include_program)
Expand Down
15 changes: 15 additions & 0 deletions base/command_line.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ class BASE_EXPORT CommandLine {

// Returns the original command line string as a vector of strings.
const StringVector& argv() const { return argv_; }
int argc0() { return argc0_; }
char** argv0() { return argv0_; }

// Returns the original command line string as a vector of strings (keeps precedence).
const StringVector& original_argv() const { return original_argv_; }

// Get and Set the program part of the command line string (the first item).
FilePath GetProgram() const;
Expand Down Expand Up @@ -200,6 +205,10 @@ class BASE_EXPORT CommandLine {
void AppendArgPath(const FilePath& value);
void AppendArgNative(const StringType& value);

#if defined(OS_MACOSX)
void FixOrigArgv4Finder(const StringType& value);
#endif

// Append the switches and arguments from another command line to this one.
// If |include_program| is true, include |other|'s program as well.
void AppendArguments(const CommandLine& other, bool include_program);
Expand Down Expand Up @@ -241,6 +250,9 @@ class BASE_EXPORT CommandLine {
// The argv array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* }
StringVector argv_;

// The argv array (precedence not messed).
StringVector original_argv_;

// Parsed-out switch keys and values.
SwitchMap switches_;

Expand All @@ -252,6 +264,9 @@ class BASE_EXPORT CommandLine {

// The index after the program and switches, any arguments start here.
size_t begin_args_;

int argc0_;
char** argv0_;
};

} // namespace base
Expand Down
2 changes: 1 addition & 1 deletion base/files/file_util_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ std::string TempFileName() {
#if defined(GOOGLE_CHROME_BUILD)
return std::string(".com.google.Chrome.XXXXXX");
#else
return std::string(".org.chromium.Chromium.XXXXXX");
return std::string(".io.nwjs.XXXXXX");
#endif
}

Expand Down
3 changes: 3 additions & 0 deletions base/message_loop/message_loop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ std::unique_ptr<MessagePump> MessageLoop::CreateMessagePumpForType(Type type) {
return std::unique_ptr<MessagePump>(new MessagePumpForUI());
#endif

if (type == MessageLoop::TYPE_NODE)
return std::unique_ptr<MessagePump>(new MessagePumpUV());

DCHECK_EQ(MessageLoop::TYPE_DEFAULT, type);
return MESSAGE_PUMP_DEFAULT;
}
Expand Down

0 comments on commit e50d604

Please sign in to comment.