Skip to content

Commit 4e17801

Browse files
committed
nwjs master
1 parent 496034c commit 4e17801

File tree

568 files changed

+8399
-1951
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

568 files changed

+8399
-1951
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,3 +469,5 @@ vs-chromium-project.txt
469469
/win8/metro_driver/metro_driver_version_resources.xml
470470
/x86-generic_out/
471471
/xcodebuild
472+
/content/nw
473+

DEPS

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ vars = {
1515
'https://android.googlesource.com/platform/external/deqp',
1616
'freetype_android_revision':
1717
'a512b0fe7a8d9db0e5aa9c0a4db1e92cb861722d',
18+
'nwjs_git':
19+
'https://github.com/nwjs',
1820
'google_toolbox_for_mac_revision':
1921
'401878398253074c515c03cb3a3f8bb0cc8da6e9',
2022
'googlecode_url':
@@ -163,8 +165,13 @@ deps = {
163165
(Var("chromium_git")) + '/chromium/deps/acid3.git@6be0a66a1ebd7ebc5abc1b2f405a945f6d871521',
164166
'src/tools/swarming_client':
165167
(Var("chromium_git")) + '/external/swarming.client.git@a72f46e42dba1335e8001499b4621acad2d26728',
166-
'src/v8':
167-
(Var("chromium_git")) + '/v8/v8.git@a219ca9f68811c8f8a0d87a56fffcb41e5143c52'
168+
#'src/v8':
169+
# #(Var("chromium_git")) + '/v8/v8.git@a219ca9f68811c8f8a0d87a56fffcb41e5143c52'
170+
# (Var("nwjs_git")) + '/v8.git@origin/nw14',
171+
#'src/content/nw':
172+
# (Var("nwjs_git")) + '/nw.js.git@origin/nw14',
173+
#'src/third_party/node':
174+
# (Var("nwjs_git")) + '/node.git@origin/nw14',
168175
}
169176

170177
deps_os = {
@@ -687,6 +694,17 @@ hooks = [
687694
'name':
688695
'remove_stale_pyc_files'
689696
},
697+
{
698+
'action': [
699+
'python',
700+
'src/content/nw/tools/patcher.py',
701+
'--patch-config', 'src/content/nw/patch/patch.cfg'
702+
],
703+
'pattern':
704+
'.',
705+
'name':
706+
'nw_patch'
707+
},
690708
{
691709
'action': [
692710
'python',

apps/app_lifetime_monitor.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ void AppLifetimeMonitor::OnAppWindowRemoved(AppWindow* app_window) {
8686
}
8787

8888
void AppLifetimeMonitor::OnAppWindowHidden(AppWindow* app_window) {
89+
#if 0
8990
if (!HasOtherVisibleAppWindows(app_window))
9091
NotifyAppDeactivated(app_window->extension_id());
92+
#endif
9193
}
9294

9395
void AppLifetimeMonitor::OnAppWindowShown(AppWindow* app_window,

apps/app_load_service.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "apps/app_load_service.h"
66

7+
#include "content/nw/src/nw_content.h"
8+
79
#include "apps/app_load_service_factory.h"
810
#include "apps/app_restore_service.h"
911
#include "apps/launcher.h"
@@ -69,6 +71,8 @@ bool AppLoadService::LoadAndLaunch(const base::FilePath& extension_path,
6971
return false;
7072
}
7173

74+
nw::SetMainExtensionId(extension_id);
75+
7276
// Schedule the app to be launched once loaded.
7377
PostReloadAction& action = post_reload_actions_[extension_id];
7478
action.action_type = LAUNCH_FOR_LOAD_AND_LAUNCH;

apps/launcher.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ class PlatformAppPathLauncher
101101
extension_id(extension->id()),
102102
entry_paths_(entry_paths),
103103
mime_type_collector_(profile),
104-
is_directory_collector_(profile) {}
104+
is_directory_collector_(profile) {
105+
if (extension->is_nwjs_app()) //NWJS#5097
106+
entry_paths_.clear();
107+
}
105108

106109
PlatformAppPathLauncher(Profile* profile,
107110
const Extension* extension,
@@ -110,7 +113,7 @@ class PlatformAppPathLauncher
110113
extension_id(extension->id()),
111114
mime_type_collector_(profile),
112115
is_directory_collector_(profile) {
113-
if (!file_path.empty())
116+
if (!file_path.empty() && !extension->is_nwjs_app()) //NWJS#5097
114117
entry_paths_.push_back(file_path);
115118
}
116119

base/base.gyp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@
180180
},
181181
},
182182
},
183+
'dependencies': [
184+
'trace_event/etw_manifest/etw_manifest.gyp:etw_manifest',
185+
],
186+
}],
187+
['OS == "win" and target_arch=="ia32"', {
183188
'copies': [
184189
{
185190
'destination': '<(PRODUCT_DIR)/',
@@ -188,8 +193,15 @@
188193
],
189194
},
190195
],
191-
'dependencies': [
192-
'trace_event/etw_manifest/etw_manifest.gyp:etw_manifest',
196+
}],
197+
[ 'OS == "win" and target_arch == "x64"', {
198+
'copies': [
199+
{
200+
'destination': '<(PRODUCT_DIR)/',
201+
'files': [
202+
'../build/win/dbghelp_xp/x64/dbghelp.dll',
203+
],
204+
},
193205
],
194206
}],
195207
['OS == "mac" or (OS == "ios" and _toolset == "host")', {
@@ -249,6 +261,8 @@
249261
'message_loop/message_pump_libevent.h',
250262
'message_loop/message_pump_mac.h',
251263
'message_loop/message_pump_mac.mm',
264+
#'message_loop/message_pump_uv.cc',
265+
#'message_loop/message_pump_uv.h',
252266
'metrics/field_trial.cc',
253267
'metrics/field_trial.h',
254268
'posix/file_descriptor_shuffle.cc',

base/base_switches.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,5 @@ const char kEnableCrashReporterForTesting[] =
9292
"enable-crash-reporter-for-testing";
9393
#endif
9494

95+
const char kNWJS[] = "nwjs";
9596
} // namespace switches

base/base_switches.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ extern const char kDisableUsbKeyboardDetect[];
3636
extern const char kEnableCrashReporterForTesting[];
3737
#endif
3838

39+
extern const char kNWJS[];
3940
} // namespace switches
4041

4142
#endif // BASE_BASE_SWITCHES_H_

base/command_line.cc

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,43 +151,83 @@ string16 QuoteForCommandLineToArgvW(const string16& arg,
151151

152152
CommandLine::CommandLine(NoProgram no_program)
153153
: argv_(1),
154-
begin_args_(1) {
154+
begin_args_(1),
155+
argc0_(0), argv0_(NULL) {
155156
}
156157

157158
CommandLine::CommandLine(const FilePath& program)
158159
: argv_(1),
159-
begin_args_(1) {
160+
begin_args_(1),
161+
argc0_(0), argv0_(NULL) {
160162
SetProgram(program);
161163
}
162164

163165
CommandLine::CommandLine(int argc, const CommandLine::CharType* const* argv)
164166
: argv_(1),
165-
begin_args_(1) {
167+
begin_args_(1),
168+
argc0_(0), argv0_(NULL) {
166169
InitFromArgv(argc, argv);
167170
}
168171

169172
CommandLine::CommandLine(const StringVector& argv)
170173
: argv_(1),
171-
begin_args_(1) {
174+
begin_args_(1),
175+
argc0_(0), argv0_(NULL) {
172176
InitFromArgv(argv);
173177
}
174178

175179
CommandLine::CommandLine(const CommandLine& other)
176180
: argv_(other.argv_),
181+
original_argv_(other.original_argv_),
177182
switches_(other.switches_),
178-
begin_args_(other.begin_args_) {
183+
begin_args_(other.begin_args_),
184+
argc0_(other.argc0_), argv0_(NULL) {
185+
186+
#if defined(OS_WIN)
187+
if (other.argv0_) {
188+
argv0_ = new char*[argc0_ + 1];
189+
for (int i = 0; i < argc0_; ++i) {
190+
argv0_[i] = new char[strlen(other.argv0_[i]) + 1];
191+
strcpy(argv0_[i], other.argv0_[i]);
192+
}
193+
argv0_[argc0_] = NULL;
194+
}
195+
#else
196+
argv0_ = other.argv0_;
197+
#endif
179198
ResetStringPieces();
180199
}
181200

182201
CommandLine& CommandLine::operator=(const CommandLine& other) {
183202
argv_ = other.argv_;
203+
original_argv_ = other.original_argv_;
184204
switches_ = other.switches_;
185205
begin_args_ = other.begin_args_;
206+
#if defined(OS_WIN)
207+
if (other.argv0_) {
208+
argv0_ = new char*[argc0_ + 1];
209+
for (int i = 0; i < argc0_; ++i) {
210+
argv0_[i] = new char[strlen(other.argv0_[i]) + 1];
211+
strcpy(argv0_[i], other.argv0_[i]);
212+
}
213+
argv0_[argc0_] = NULL;
214+
}
215+
#else
216+
argv0_ = other.argv0_;
217+
#endif
186218
ResetStringPieces();
187219
return *this;
188220
}
189221

190222
CommandLine::~CommandLine() {
223+
#if defined(OS_WIN)
224+
if (!argv0_)
225+
return;
226+
for (int i = 0; i < argc0_; i++) {
227+
delete[] argv0_[i];
228+
}
229+
delete[] argv0_;
230+
#endif
191231
}
192232

193233
#if defined(OS_WIN)
@@ -248,12 +288,34 @@ CommandLine CommandLine::FromString(const string16& command_line) {
248288
void CommandLine::InitFromArgv(int argc,
249289
const CommandLine::CharType* const* argv) {
250290
StringVector new_argv;
291+
argc0_ = argc;
292+
#if !defined(OS_WIN)
293+
argv0_ = (char**)argv;
294+
#else
295+
argv0_ = new char*[argc + 1];
296+
for (int i = 0; i < argc; ++i) {
297+
std::string str(base::WideToUTF8(argv[i]));
298+
argv0_[i] = new char[str.length() + 1];
299+
strcpy(argv0_[i], str.c_str());
300+
}
301+
argv0_[argc] = NULL;
302+
#endif
251303
for (int i = 0; i < argc; ++i)
252304
new_argv.push_back(argv[i]);
253305
InitFromArgv(new_argv);
254306
}
255307

256308
void CommandLine::InitFromArgv(const StringVector& argv) {
309+
#if !defined(OS_MACOSX)
310+
original_argv_ = argv;
311+
#else
312+
for (size_t index = 0; index < argv.size(); ++index) {
313+
if (argv[index].compare(0, strlen("--psn_"), "--psn_") != 0 &&
314+
argv[index].compare(0, strlen("-psn_"), "-psn_") != 0) {
315+
original_argv_.push_back(argv[index]);
316+
}
317+
}
318+
#endif
257319
argv_ = StringVector(1);
258320
switches_.clear();
259321
switches_by_stringpiece_.clear();
@@ -390,6 +452,12 @@ void CommandLine::AppendArgNative(const CommandLine::StringType& value) {
390452
argv_.push_back(value);
391453
}
392454

455+
#if defined(OS_MACOSX)
456+
void CommandLine::FixOrigArgv4Finder(const CommandLine::StringType& value) {
457+
original_argv_.push_back(value);
458+
}
459+
#endif
460+
393461
void CommandLine::AppendArguments(const CommandLine& other,
394462
bool include_program) {
395463
if (include_program)

base/command_line.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ class BASE_EXPORT CommandLine {
142142

143143
// Returns the original command line string as a vector of strings.
144144
const StringVector& argv() const { return argv_; }
145+
int argc0() { return argc0_; }
146+
char** argv0() { return argv0_; }
147+
148+
// Returns the original command line string as a vector of strings (keeps precedence).
149+
const StringVector& original_argv() const { return original_argv_; }
145150

146151
// Get and Set the program part of the command line string (the first item).
147152
FilePath GetProgram() const;
@@ -192,6 +197,10 @@ class BASE_EXPORT CommandLine {
192197
void AppendArgPath(const FilePath& value);
193198
void AppendArgNative(const StringType& value);
194199

200+
#if defined(OS_MACOSX)
201+
void FixOrigArgv4Finder(const StringType& value);
202+
#endif
203+
195204
// Append the switches and arguments from another command line to this one.
196205
// If |include_program| is true, include |other|'s program as well.
197206
void AppendArguments(const CommandLine& other, bool include_program);
@@ -233,6 +242,9 @@ class BASE_EXPORT CommandLine {
233242
// The argv array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* }
234243
StringVector argv_;
235244

245+
// The argv array (precedence not messed).
246+
StringVector original_argv_;
247+
236248
// Parsed-out switch keys and values.
237249
SwitchMap switches_;
238250

@@ -244,6 +256,9 @@ class BASE_EXPORT CommandLine {
244256

245257
// The index after the program and switches, any arguments start here.
246258
size_t begin_args_;
259+
260+
int argc0_;
261+
char** argv0_;
247262
};
248263

249264
} // namespace base

base/files/file_util_posix.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ std::string TempFileName() {
138138
#if defined(GOOGLE_CHROME_BUILD)
139139
return std::string(".com.google.Chrome.XXXXXX");
140140
#else
141-
return std::string(".org.chromium.Chromium.XXXXXX");
141+
return std::string(".io.nwjs.XXXXXX");
142142
#endif
143143
}
144144

0 commit comments

Comments
 (0)