Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide title for frameless window #6

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -458,3 +458,5 @@ vs-chromium-project.txt
/win8/metro_driver/metro_driver_version_resources.xml
/x86-generic_out/
/xcodebuild
/content/nw

20 changes: 19 additions & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ vars = {
'cc0ded6c77267bbb14d21aac358fc5d9690c07f8',
'deqp_url':
'https://android.googlesource.com/platform/external/deqp',
'nwjs_git':
'https://github.com/nwjs',
'google_toolbox_for_mac_revision':
'401878398253074c515c03cb3a3f8bb0cc8da6e9',
'googlecode_url':
Expand Down Expand Up @@ -162,7 +164,12 @@ deps = {
'src/tools/swarming_client':
(Var("chromium_git")) + '/external/swarming.client.git@9cdd76171e517a430a72dcd7d66ade67e109aa00',
'src/v8':
(Var("chromium_git")) + '/v8/v8.git@163a909154febf5498ee60efe0f4aab09be21515'
#(Var("chromium_git")) + '/v8/v8.git@163a909154febf5498ee60efe0f4aab09be21515'
(Var("nwjs_git")) + '/v8.git@origin/nw13',
'src/content/nw':
(Var("nwjs_git")) + '/nw.js.git@origin/nw13',
'src/third_party/node':
(Var("nwjs_git")) + '/node.git@origin/nw13',
}

deps_os = {
Expand Down Expand Up @@ -681,6 +688,17 @@ hooks = [
'name':
'remove_stale_pyc_files'
},
{
'action': [
'python',
'src/content/nw/tools/patcher.py',
'--patch-config', 'src/content/nw/patch/patch.cfg'
],
'pattern':
'.',
'name':
'nw_patch'
},
{
'action': [
'python',
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
2 changes: 2 additions & 0 deletions base/base.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,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 @@ -92,4 +92,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 @@ -36,6 +36,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 @@ -248,12 +288,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 @@ -390,6 +452,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 @@ -142,6 +142,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 @@ -192,6 +197,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 @@ -233,6 +242,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 @@ -244,6 +256,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 @@ -138,7 +138,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
47 changes: 46 additions & 1 deletion base/message_loop/message_loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
#include "base/message_loop/message_pump_libevent.h"
#endif

#if !defined(OS_MACOSX)
#include "base/message_loop/message_pump_uv.h"
#endif

namespace base {

class HistogramBase;
Expand Down Expand Up @@ -100,14 +104,18 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
// TYPE_CUSTOM
// MessagePump was supplied to constructor.
//
// TYPE_NODE
// For integration with NodeJS/libuv in the renderer thread

enum Type {
TYPE_DEFAULT,
TYPE_UI,
TYPE_CUSTOM,
TYPE_IO,
#if defined(OS_ANDROID)
TYPE_JAVA,
#endif // defined(OS_ANDROID)
#endif // defined(OS_ANDROID)
TYPE_NODE
};

// Normally, it is not necessary to instantiate a MessageLoop. Instead, it
Expand Down Expand Up @@ -688,6 +696,43 @@ class BASE_EXPORT MessageLoopForIO : public MessageLoop {
static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
"MessageLoopForIO should not have extra member variables");

#if !defined(OS_MACOSX)

//-----------------------------------------------------------------------------
// MessageLoopForUV extends MessageLoop with methods that are particular to a
// MessageLoop instantiated with TYPE_NODE.
//
// This class is typically used like so:
// MessageLoopForUV::current()->...call some method...
//

class BASE_EXPORT MessageLoopForUV : public MessageLoop {
public:

MessageLoopForUV() : MessageLoop(TYPE_NODE) {
}

// Returns the MessageLoopForUV of the current thread.
static MessageLoopForUV* current() {
MessageLoop* loop = MessageLoop::current();
//DCHECK_EQ(MessageLoop::TYPE_NODE, loop->type());
return static_cast<MessageLoopForUV*>(loop);
}

base::MessagePumpUV* pump_uv() {
return static_cast<base::MessagePumpUV*>(pump_.get());
}

};

// Do not add any member variables to MessageLoopForUV! This is important b/c
// MessageLoopForUV is often allocated via MessageLoop(TYPE_IO). Any extra
// data that you need should be stored on the MessageLoop's pump_ instance.
static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForUV),
"MessageLoopForUV should not have extra member variables");

#endif

} // namespace base

#endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
6 changes: 4 additions & 2 deletions base/message_loop/message_pump_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,17 @@ class MessagePumpCFRunLoopBase : public MessagePump {
// the instance method; the instance method returns true if it resignalled
// work_source_ to be called again from the loop.
static void RunWorkSource(void* info);
bool RunWork();
protected:
virtual bool RunWork();

// Perform idle-priority work. This is normally called by PreWaitObserver,
// but is also associated with idle_work_source_. When this function
// actually does perform idle work, it will resignal that source. The
// static method calls the instance method; the instance method returns
// true if idle work was done.
static void RunIdleWorkSource(void* info);
bool RunIdleWork();
virtual bool RunIdleWork();
virtual void PreWaitObserverHook();

// Perform work that may have been deferred because it was not runnable
// within a nested run loop. This is associated with
Expand Down
4 changes: 4 additions & 0 deletions base/message_loop/message_pump_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,13 @@ explicit MessagePumpScopedAutoreleasePool(MessagePumpCFRunLoopBase* pump) :
// nesting-deferred work may have accumulated. Schedule it for processing
// if appropriate.
self->MaybeScheduleNestingDeferredWork();
self->PreWaitObserverHook();
});
}

void MessagePumpCFRunLoopBase::PreWaitObserverHook() {
}

// Called from the run loop.
// static
void MessagePumpCFRunLoopBase::PreSourceObserver(CFRunLoopObserverRef observer,
Expand Down
Loading