mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb4ec66b37 | ||
|
|
89f565906b | ||
|
|
6a5f732bba | ||
|
|
fba1772000 | ||
|
|
e62986b97d | ||
|
|
2e38bafdb1 | ||
|
|
f3e49b0696 | ||
|
|
70aad83b07 | ||
|
|
10c862f0bb | ||
|
|
d993c92cea | ||
|
|
546e4e431d | ||
|
|
4a7e98e398 | ||
|
|
ab4558ae32 | ||
|
|
5086873f78 | ||
|
|
476f545a67 | ||
|
|
16a1edb422 | ||
|
|
474445fb7d | ||
|
|
5db31517cb | ||
|
|
740e7fbf1a | ||
|
|
be5789b483 | ||
|
|
1c415b0666 | ||
|
|
8dd7f81175 | ||
|
|
87019a1a70 | ||
|
|
10c52bd6a6 | ||
|
|
c23c667c2d | ||
|
|
ec4275ca13 | ||
|
|
143bde007a | ||
|
|
a6ede12cd7 | ||
|
|
7a89a08534 | ||
|
|
5ad203ad99 | ||
|
|
82dcdc6314 | ||
|
|
371e38198f | ||
|
|
472a95e433 | ||
|
|
b84226244d | ||
|
|
e4290393af | ||
|
|
cab00a1450 | ||
|
|
ce50b38a75 | ||
|
|
e8d59c4326 | ||
|
|
b9d64784bb | ||
|
|
ad3eac2e38 |
7
atom.gyp
7
atom.gyp
@@ -18,6 +18,7 @@
|
||||
'atom/browser/api/lib/atom-delegate.coffee',
|
||||
'atom/browser/api/lib/auto-updater.coffee',
|
||||
'atom/browser/api/lib/browser-window.coffee',
|
||||
'atom/browser/api/lib/content-tracing.coffee',
|
||||
'atom/browser/api/lib/dialog.coffee',
|
||||
'atom/browser/api/lib/ipc.coffee',
|
||||
'atom/browser/api/lib/menu.coffee',
|
||||
@@ -51,6 +52,7 @@
|
||||
'atom/browser/api/atom_api_app.h',
|
||||
'atom/browser/api/atom_api_auto_updater.cc',
|
||||
'atom/browser/api/atom_api_auto_updater.h',
|
||||
'atom/browser/api/atom_api_content_tracing.cc',
|
||||
'atom/browser/api/atom_api_dialog.cc',
|
||||
'atom/browser/api/atom_api_menu.cc',
|
||||
'atom/browser/api/atom_api_menu.h',
|
||||
@@ -93,6 +95,8 @@
|
||||
'atom/browser/browser_mac.mm',
|
||||
'atom/browser/browser_win.cc',
|
||||
'atom/browser/browser_observer.h',
|
||||
'atom/browser/javascript_environment.cc',
|
||||
'atom/browser/javascript_environment.h',
|
||||
'atom/browser/mac/atom_application.h',
|
||||
'atom/browser/mac/atom_application.mm',
|
||||
'atom/browser/mac/atom_application_delegate.h',
|
||||
@@ -377,6 +381,9 @@
|
||||
'<(libchromiumcontent_resources_dir)/ui_resources_200_percent.pak',
|
||||
'<(libchromiumcontent_resources_dir)/webkit_resources_200_percent.pak',
|
||||
'external_binaries/d3dcompiler_43.dll',
|
||||
'external_binaries/msvcp120.dll',
|
||||
'external_binaries/msvcr120.dll',
|
||||
'external_binaries/vccorlib120.dll',
|
||||
'external_binaries/xinput1_3.dll',
|
||||
],
|
||||
},
|
||||
|
||||
77
atom/browser/api/atom_api_content_tracing.cc
Normal file
77
atom/browser/api/atom_api_content_tracing.cc
Normal file
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "atom/common/native_mate_converters/file_path_converter.h"
|
||||
#include "atom/common/native_mate_converters/function_converter.h"
|
||||
#include "base/bind.h"
|
||||
#include "content/public/browser/tracing_controller.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
|
||||
#include "atom/common/node_includes.h"
|
||||
|
||||
using content::TracingController;
|
||||
|
||||
namespace mate {
|
||||
|
||||
template<typename T>
|
||||
struct Converter<std::set<T> > {
|
||||
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
const std::set<T>& val) {
|
||||
v8::Handle<v8::Array> result = v8::Array::New(
|
||||
isolate, static_cast<int>(val.size()));
|
||||
typename std::set<T>::const_iterator it;
|
||||
int i;
|
||||
for (i = 0, it = val.begin(); it != val.end(); ++it, ++i)
|
||||
result->Set(i, Converter<T>::ToV8(isolate, *it));
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Converter<TracingController::Options> {
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Value> val,
|
||||
TracingController::Options* out) {
|
||||
if (!val->IsNumber())
|
||||
return false;
|
||||
*out = static_cast<TracingController::Options>(val->IntegerValue());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace mate
|
||||
|
||||
namespace {
|
||||
|
||||
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
|
||||
v8::Handle<v8::Context> context, void* priv) {
|
||||
TracingController* controller = TracingController::GetInstance();
|
||||
mate::Dictionary dict(context->GetIsolate(), exports);
|
||||
dict.SetMethod("getCategories", base::Bind(
|
||||
&TracingController::GetCategories, base::Unretained(controller)));
|
||||
dict.SetMethod("startRecording", base::Bind(
|
||||
&TracingController::EnableRecording, base::Unretained(controller)));
|
||||
dict.SetMethod("stopRecording", base::Bind(
|
||||
&TracingController::DisableRecording, base::Unretained(controller)));
|
||||
dict.SetMethod("startMonitoring", base::Bind(
|
||||
&TracingController::EnableMonitoring, base::Unretained(controller)));
|
||||
dict.SetMethod("stopMonitoring", base::Bind(
|
||||
&TracingController::DisableMonitoring, base::Unretained(controller)));
|
||||
dict.SetMethod("captureMonitoringSnapshot", base::Bind(
|
||||
&TracingController::CaptureMonitoringSnapshot,
|
||||
base::Unretained(controller)));
|
||||
dict.SetMethod("getTraceBufferPercentFull", base::Bind(
|
||||
&TracingController::GetTraceBufferPercentFull,
|
||||
base::Unretained(controller)));
|
||||
dict.SetMethod("setWatchEvent", base::Bind(
|
||||
&TracingController::SetWatchEvent, base::Unretained(controller)));
|
||||
dict.SetMethod("cancelWatchEvent", base::Bind(
|
||||
&TracingController::CancelWatchEvent, base::Unretained(controller)));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_content_tracing, Initialize)
|
||||
@@ -5,13 +5,13 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "atom/browser/api/atom_api_window.h"
|
||||
#include "atom/browser/native_window.h"
|
||||
#include "atom/browser/ui/file_dialog.h"
|
||||
#include "atom/browser/ui/message_box.h"
|
||||
#include "atom/common/native_mate_converters/file_path_converter.h"
|
||||
#include "atom/common/native_mate_converters/function_converter.h"
|
||||
#include "base/bind.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
|
||||
#include "atom/common/node_includes.h"
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/browser/web_contents_view.h"
|
||||
|
||||
#include "atom/common/node_includes.h"
|
||||
|
||||
@@ -44,7 +43,7 @@ void MenuMac::Popup(Window* window) {
|
||||
// Show the menu.
|
||||
[NSMenu popUpContextMenu:[menu_controller menu]
|
||||
withEvent:clickEvent
|
||||
forView:web_contents->GetView()->GetContentNativeView()];
|
||||
forView:web_contents->GetContentNativeView()];
|
||||
}
|
||||
|
||||
// static
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
#include "ui/gfx/screen.h"
|
||||
#include "ui/views/controls/menu/menu_runner.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "ui/gfx/win/dpi.h"
|
||||
#endif
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace api {
|
||||
@@ -21,16 +17,12 @@ MenuViews::MenuViews() {
|
||||
|
||||
void MenuViews::Popup(Window* window) {
|
||||
gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
|
||||
#if defined(OS_WIN)
|
||||
cursor = gfx::win::ScreenToDIPPoint(cursor);
|
||||
#endif
|
||||
|
||||
views::MenuRunner menu_runner(model());
|
||||
ignore_result(menu_runner.RunMenuAt(
|
||||
static_cast<NativeWindowViews*>(window->window())->widget(),
|
||||
NULL,
|
||||
gfx::Rect(cursor, gfx::Size()),
|
||||
views::MenuItemView::TOPLEFT,
|
||||
views::MENU_ANCHOR_TOPLEFT,
|
||||
ui::MENU_SOURCE_MOUSE,
|
||||
views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU));
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "atom/common/native_mate_converters/string16_converter.h"
|
||||
#include "atom/common/native_mate_converters/value_converter.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
@@ -66,7 +67,7 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
|
||||
return handled;
|
||||
}
|
||||
|
||||
void WebContents::WebContentsDestroyed(content::WebContents*) {
|
||||
void WebContents::WebContentsDestroyed() {
|
||||
// The RenderViewDeleted was not called when the WebContents is destroyed.
|
||||
RenderViewDeleted(web_contents_->GetRenderViewHost());
|
||||
Emit("destroyed");
|
||||
@@ -155,8 +156,7 @@ bool WebContents::IsCrashed() const {
|
||||
}
|
||||
|
||||
void WebContents::ExecuteJavaScript(const base::string16& code) {
|
||||
web_contents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
|
||||
base::string16(), code);
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScript(code);
|
||||
}
|
||||
|
||||
bool WebContents::SendIPCMessage(const base::string16& channel,
|
||||
|
||||
@@ -62,7 +62,7 @@ class WebContents : public mate::EventEmitter,
|
||||
virtual void DidStopLoading(
|
||||
content::RenderViewHost* render_view_host) OVERRIDE;
|
||||
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
||||
virtual void WebContentsDestroyed(content::WebContents*) OVERRIDE;
|
||||
virtual void WebContentsDestroyed() OVERRIDE;
|
||||
|
||||
private:
|
||||
// Called when received a message from renderer.
|
||||
|
||||
@@ -161,6 +161,10 @@ void Window::Restore() {
|
||||
window_->Restore();
|
||||
}
|
||||
|
||||
bool Window::IsMinimized() {
|
||||
return window_->IsMinimized();
|
||||
}
|
||||
|
||||
void Window::SetFullscreen(bool fullscreen) {
|
||||
window_->SetFullscreen(fullscreen);
|
||||
}
|
||||
@@ -357,6 +361,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
|
||||
.SetMethod("isMaximized", &Window::IsMaximized)
|
||||
.SetMethod("minimize", &Window::Minimize)
|
||||
.SetMethod("restore", &Window::Restore)
|
||||
.SetMethod("isMinimized", &Window::IsMinimized)
|
||||
.SetMethod("setFullScreen", &Window::SetFullscreen)
|
||||
.SetMethod("isFullScreen", &Window::IsFullscreen)
|
||||
.SetMethod("getSize", &Window::GetSize)
|
||||
|
||||
@@ -66,6 +66,7 @@ class Window : public mate::EventEmitter,
|
||||
bool IsMaximized();
|
||||
void Minimize();
|
||||
void Restore();
|
||||
bool IsMinimized();
|
||||
void SetFullscreen(bool fullscreen);
|
||||
bool IsFullscreen();
|
||||
void SetSize(int width, int height);
|
||||
|
||||
@@ -36,7 +36,7 @@ void Event::SetSenderAndMessage(content::WebContents* sender,
|
||||
Observe(sender);
|
||||
}
|
||||
|
||||
void Event::WebContentsDestroyed(content::WebContents* web_contents) {
|
||||
void Event::WebContentsDestroyed() {
|
||||
sender_ = NULL;
|
||||
message_ = NULL;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class Event : public Wrappable,
|
||||
virtual ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate* isolate);
|
||||
|
||||
// content::WebContentsObserver implementations:
|
||||
virtual void WebContentsDestroyed(content::WebContents*) OVERRIDE;
|
||||
virtual void WebContentsDestroyed() OVERRIDE;
|
||||
|
||||
private:
|
||||
// Replyer for the synchronous messages.
|
||||
|
||||
@@ -24,8 +24,8 @@ if process.platform is 'darwin'
|
||||
cancelBounce: bindings.dockCancelBounce
|
||||
setBadge: bindings.dockSetBadgeText
|
||||
getBadge: bindings.dockGetBadgeText
|
||||
hide: bindings.hide
|
||||
show: bindings.show
|
||||
hide: bindings.dockHide
|
||||
show: bindings.dockShow
|
||||
|
||||
# Be compatible with old API.
|
||||
app.once 'ready', -> app.emit 'finish-launching'
|
||||
|
||||
7
atom/browser/api/lib/content-tracing.coffee
Normal file
7
atom/browser/api/lib/content-tracing.coffee
Normal file
@@ -0,0 +1,7 @@
|
||||
module.exports = process.atomBinding 'content_tracing'
|
||||
|
||||
# Mirrored from content::TracingController::Options
|
||||
module.exports.DEFAULT_OPTIONS = 0
|
||||
module.exports.ENABLE_SYSTRACE = 1 << 0
|
||||
module.exports.ENABLE_SAMPLING = 1 << 1
|
||||
module.exports.RECORD_CONTINUOUSLY = 1 << 2
|
||||
@@ -17,6 +17,7 @@ class AtomBrowserClient : public brightray::BrowserClient {
|
||||
virtual ~AtomBrowserClient();
|
||||
|
||||
protected:
|
||||
// content::ContentBrowserClient:
|
||||
net::URLRequestContextGetter* CreateRequestContext(
|
||||
content::BrowserContext* browser_context,
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
#include "atom/browser/atom_browser_client.h"
|
||||
#include "atom/browser/atom_browser_context.h"
|
||||
#include "atom/browser/browser.h"
|
||||
#include "atom/browser/javascript_environment.h"
|
||||
#include "atom/common/api/atom_bindings.h"
|
||||
#include "atom/common/node_bindings.h"
|
||||
#include "base/command_line.h"
|
||||
#include "net/proxy/proxy_resolver_v8.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "ui/gfx/win/dpi.h"
|
||||
@@ -28,14 +28,9 @@ namespace atom {
|
||||
AtomBrowserMainParts* AtomBrowserMainParts::self_ = NULL;
|
||||
|
||||
AtomBrowserMainParts::AtomBrowserMainParts()
|
||||
: atom_bindings_(new AtomBindings),
|
||||
browser_(new Browser),
|
||||
: browser_(new Browser),
|
||||
node_bindings_(NodeBindings::Create(true)),
|
||||
isolate_(v8::Isolate::GetCurrent()),
|
||||
locker_(isolate_),
|
||||
handle_scope_(isolate_),
|
||||
context_(isolate_, v8::Context::New(isolate_)),
|
||||
context_scope_(v8::Local<v8::Context>::New(isolate_, context_)) {
|
||||
atom_bindings_(new AtomBindings) {
|
||||
DCHECK(!self_) << "Cannot have two AtomBrowserMainParts";
|
||||
self_ = this;
|
||||
}
|
||||
@@ -53,25 +48,20 @@ brightray::BrowserContext* AtomBrowserMainParts::CreateBrowserContext() {
|
||||
return new AtomBrowserContext();
|
||||
}
|
||||
|
||||
void AtomBrowserMainParts::InitProxyResolverV8() {
|
||||
// Since we are integrating node in browser, we can just be sure that an
|
||||
// V8 instance would be prepared, while the ProxyResolverV8::CreateIsolate()
|
||||
// would try to create a V8 isolate, which messed everything on Windows, so
|
||||
// we have to override and call RememberDefaultIsolate on Windows instead.
|
||||
net::ProxyResolverV8::RememberDefaultIsolate();
|
||||
}
|
||||
|
||||
void AtomBrowserMainParts::PostEarlyInitialization() {
|
||||
brightray::BrowserMainParts::PostEarlyInitialization();
|
||||
|
||||
// The ProxyResolverV8 has setup a complete V8 environment, in order to avoid
|
||||
// conflicts we only initialize our V8 environment after that.
|
||||
js_env_.reset(new JavascriptEnvironment);
|
||||
|
||||
node_bindings_->Initialize();
|
||||
|
||||
// Create the global environment.
|
||||
global_env = node_bindings_->CreateEnvironment(
|
||||
v8::Local<v8::Context>::New(isolate_, context_));
|
||||
global_env = node_bindings_->CreateEnvironment(js_env_->context());
|
||||
|
||||
// Add atom-shell extended APIs.
|
||||
atom_bindings_->BindTo(isolate_, global_env->process_object());
|
||||
atom_bindings_->BindTo(js_env_->isolate(), global_env->process_object());
|
||||
}
|
||||
|
||||
void AtomBrowserMainParts::PreMainMessageLoopRun() {
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
#define ATOM_BROWSER_ATOM_BROWSER_MAIN_PARTS_H_
|
||||
|
||||
#include "brightray/browser/browser_main_parts.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
class AtomBindings;
|
||||
class Browser;
|
||||
class JavascriptEnvironment;
|
||||
class NodeBindings;
|
||||
|
||||
class AtomBrowserMainParts : public brightray::BrowserMainParts {
|
||||
@@ -26,7 +26,6 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
|
||||
protected:
|
||||
// Implementations of brightray::BrowserMainParts.
|
||||
virtual brightray::BrowserContext* CreateBrowserContext() OVERRIDE;
|
||||
virtual void InitProxyResolverV8() OVERRIDE;
|
||||
|
||||
// Implementations of content::BrowserMainParts.
|
||||
virtual void PostEarlyInitialization() OVERRIDE;
|
||||
@@ -37,16 +36,10 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
|
||||
#endif
|
||||
|
||||
private:
|
||||
scoped_ptr<AtomBindings> atom_bindings_;
|
||||
scoped_ptr<Browser> browser_;
|
||||
scoped_ptr<JavascriptEnvironment> js_env_;
|
||||
scoped_ptr<NodeBindings> node_bindings_;
|
||||
|
||||
// The V8 environment of browser process.
|
||||
v8::Isolate* isolate_;
|
||||
v8::Locker locker_;
|
||||
v8::HandleScope handle_scope_;
|
||||
v8::UniquePersistent<v8::Context> context_;
|
||||
v8::Context::Scope context_scope_;
|
||||
scoped_ptr<AtomBindings> atom_bindings_;
|
||||
|
||||
static AtomBrowserMainParts* self_;
|
||||
|
||||
|
||||
17
atom/browser/javascript_environment.cc
Normal file
17
atom/browser/javascript_environment.cc
Normal file
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/browser/javascript_environment.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
JavascriptEnvironment::JavascriptEnvironment()
|
||||
: isolate_(v8::Isolate::GetCurrent()),
|
||||
locker_(isolate_),
|
||||
handle_scope_(isolate_),
|
||||
context_(isolate_, v8::Context::New(isolate_)),
|
||||
context_scope_(v8::Local<v8::Context>::New(isolate_, context_)) {
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
34
atom/browser/javascript_environment.h
Normal file
34
atom/browser/javascript_environment.h
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_
|
||||
#define ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
class JavascriptEnvironment {
|
||||
public:
|
||||
JavascriptEnvironment();
|
||||
|
||||
v8::Isolate* isolate() const { return isolate_; }
|
||||
v8::Local<v8::Context> context() const {
|
||||
return v8::Local<v8::Context>::New(isolate_, context_);
|
||||
}
|
||||
|
||||
private:
|
||||
v8::Isolate* isolate_;
|
||||
v8::Locker locker_;
|
||||
v8::HandleScope handle_scope_;
|
||||
v8::UniquePersistent<v8::Context> context_;
|
||||
v8::Context::Scope context_scope_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(JavascriptEnvironment);
|
||||
};
|
||||
|
||||
} // namespace atom
|
||||
|
||||
#endif // ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_
|
||||
@@ -14,7 +14,7 @@ process.argv.splice 1, 1
|
||||
# Pick out switches appended by atom-shell.
|
||||
startMark = process.argv.indexOf '--atom-shell-switches-start'
|
||||
endMark = process.argv.indexOf '--atom-shell-switches-end'
|
||||
process.execArgv = process.argv.splice startMark, endMark - startMark + 1
|
||||
process.argv.splice startMark, endMark - startMark + 1
|
||||
|
||||
# Add browser/api/lib to require's search paths,
|
||||
# which contains javascript part of Atom's built-in libraries.
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "content/public/browser/web_contents_view.h"
|
||||
#include "content/public/common/renderer_preferences.h"
|
||||
#include "content/public/common/user_agent.h"
|
||||
#include "ipc/ipc_message_macros.h"
|
||||
@@ -105,10 +104,6 @@ NativeWindow::NativeWindow(content::WebContents* web_contents,
|
||||
}
|
||||
|
||||
NativeWindow::~NativeWindow() {
|
||||
// Make sure we have the OnRenderViewDeleted message sent even when the window
|
||||
// is destroyed directly.
|
||||
DestroyWebContents();
|
||||
|
||||
// It's possible that the windows gets destroyed before it's closed, in that
|
||||
// case we need to ensure the OnWindowClosed message is still notified.
|
||||
NotifyWindowClosed();
|
||||
@@ -305,7 +300,7 @@ void NativeWindow::CloseWebContents() {
|
||||
ScheduleUnresponsiveEvent(5000);
|
||||
|
||||
if (web_contents->NeedToFireBeforeUnload())
|
||||
web_contents->GetMainFrame()->DispatchBeforeUnload(false);
|
||||
web_contents->DispatchBeforeUnload(false);
|
||||
else
|
||||
web_contents->Close();
|
||||
}
|
||||
@@ -356,8 +351,6 @@ void NativeWindow::OverrideWebkitPrefs(const GURL& url, WebPreferences* prefs) {
|
||||
prefs->experimental_webgl_enabled = b;
|
||||
if (web_preferences.Get("webaudio", &b))
|
||||
prefs->webaudio_enabled = b;
|
||||
if (web_preferences.Get("accelerated-compositing", &b))
|
||||
prefs->accelerated_compositing_enabled = b;
|
||||
if (web_preferences.Get("plugins", &b))
|
||||
prefs->plugins_enabled = b;
|
||||
if (web_preferences.Get("extra-plugin-dirs", &list))
|
||||
@@ -456,9 +449,6 @@ void NativeWindow::MoveContents(content::WebContents* source,
|
||||
}
|
||||
|
||||
void NativeWindow::CloseContents(content::WebContents* source) {
|
||||
// Destroy the WebContents before we close the window.
|
||||
DestroyWebContents();
|
||||
|
||||
// When the web contents is gone, close the window immediately, but the
|
||||
// memory will not be freed until you call delete.
|
||||
// In this way, it would be safe to manage windows via smart pointers. If you
|
||||
|
||||
@@ -111,6 +111,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||
virtual bool IsMaximized() = 0;
|
||||
virtual void Minimize() = 0;
|
||||
virtual void Restore() = 0;
|
||||
virtual bool IsMinimized() = 0;
|
||||
virtual void SetFullscreen(bool fullscreen) = 0;
|
||||
virtual bool IsFullscreen() = 0;
|
||||
virtual void SetSize(const gfx::Size& size) = 0;
|
||||
|
||||
@@ -35,6 +35,7 @@ class NativeWindowMac : public NativeWindow {
|
||||
virtual bool IsMaximized() OVERRIDE;
|
||||
virtual void Minimize() OVERRIDE;
|
||||
virtual void Restore() OVERRIDE;
|
||||
virtual bool IsMinimized() OVERRIDE;
|
||||
virtual void SetFullscreen(bool fullscreen) OVERRIDE;
|
||||
virtual bool IsFullscreen() OVERRIDE;
|
||||
virtual void SetSize(const gfx::Size& size) OVERRIDE;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/browser/web_contents_view.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
@@ -50,31 +49,31 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeMain:(NSNotification*)notification {
|
||||
shell_->NotifyWindowFocus();
|
||||
|
||||
content::WebContents* web_contents = shell_->GetWebContents();
|
||||
if (!web_contents)
|
||||
return;
|
||||
|
||||
web_contents->GetView()->RestoreFocus();
|
||||
web_contents->RestoreFocus();
|
||||
|
||||
content::RenderWidgetHostView* rwhv = web_contents->GetRenderWidgetHostView();
|
||||
if (rwhv)
|
||||
rwhv->SetActive(true);
|
||||
|
||||
shell_->NotifyWindowFocus();
|
||||
}
|
||||
|
||||
- (void)windowDidResignMain:(NSNotification*)notification {
|
||||
shell_->NotifyWindowBlur();
|
||||
|
||||
content::WebContents* web_contents = shell_->GetWebContents();
|
||||
if (!web_contents)
|
||||
return;
|
||||
|
||||
web_contents->GetView()->StoreFocus();
|
||||
web_contents->StoreFocus();
|
||||
|
||||
content::RenderWidgetHostView* rwhv = web_contents->GetRenderWidgetHostView();
|
||||
if (rwhv)
|
||||
rwhv->SetActive(false);
|
||||
|
||||
shell_->NotifyWindowBlur();
|
||||
}
|
||||
|
||||
- (void)windowDidResize:(NSNotification*)otification {
|
||||
@@ -242,6 +241,7 @@ void NativeWindowMac::Close() {
|
||||
|
||||
void NativeWindowMac::CloseImmediately() {
|
||||
[window_ close];
|
||||
window_.reset();
|
||||
}
|
||||
|
||||
void NativeWindowMac::Move(const gfx::Rect& pos) {
|
||||
@@ -304,6 +304,10 @@ void NativeWindowMac::Restore() {
|
||||
[window_ deminiaturize:nil];
|
||||
}
|
||||
|
||||
bool NativeWindowMac::IsMinimized() {
|
||||
return [window_ isMiniaturized];
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetFullscreen(bool fullscreen) {
|
||||
if (fullscreen == IsFullscreen())
|
||||
return;
|
||||
@@ -488,7 +492,7 @@ gfx::NativeWindow NativeWindowMac::GetNativeWindow() {
|
||||
bool NativeWindowMac::IsWithinDraggableRegion(NSPoint point) const {
|
||||
if (!draggable_region_)
|
||||
return false;
|
||||
NSView* webView = GetWebContents()->GetView()->GetNativeView();
|
||||
NSView* webView = GetWebContents()->GetNativeView();
|
||||
NSInteger webViewHeight = NSHeight([webView bounds]);
|
||||
// |draggable_region_| is stored in local platform-indepdent coordiate system
|
||||
// while |point| is in local Cocoa coordinate system. Do the conversion
|
||||
@@ -553,8 +557,6 @@ void NativeWindowMac::InstallView() {
|
||||
base::scoped_nsobject<CALayer> layer([[CALayer alloc] init]);
|
||||
[layer setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)];
|
||||
[view setLayer:layer];
|
||||
[view setWantsLayer:YES];
|
||||
|
||||
[view setFrame:[[window_ contentView] bounds]];
|
||||
[[window_ contentView] addSubview:view];
|
||||
} else {
|
||||
@@ -577,9 +579,7 @@ void NativeWindowMac::UninstallView() {
|
||||
}
|
||||
|
||||
void NativeWindowMac::ClipWebView() {
|
||||
NSView* view = GetWebContents()->GetView()->GetNativeView();
|
||||
|
||||
view.wantsLayer = YES;
|
||||
NSView* view = GetWebContents()->GetNativeView();
|
||||
view.layer.masksToBounds = YES;
|
||||
view.layer.cornerRadius = kAtomWindowCornerRadius;
|
||||
}
|
||||
@@ -590,7 +590,7 @@ void NativeWindowMac::InstallDraggableRegionViews() {
|
||||
// All ControlRegionViews should be added as children of the WebContentsView,
|
||||
// because WebContentsView will be removed and re-added when entering and
|
||||
// leaving fullscreen mode.
|
||||
NSView* webView = GetWebContents()->GetView()->GetNativeView();
|
||||
NSView* webView = GetWebContents()->GetNativeView();
|
||||
NSInteger webViewHeight = NSHeight([webView bounds]);
|
||||
|
||||
// Remove all ControlRegionViews that are added last time.
|
||||
@@ -622,7 +622,7 @@ void NativeWindowMac::UpdateDraggableRegionsForCustomDrag(
|
||||
const std::vector<DraggableRegion>& regions) {
|
||||
// We still need one ControlRegionView to cover the whole window such that
|
||||
// mouse events could be captured.
|
||||
NSView* web_view = GetWebContents()->GetView()->GetNativeView();
|
||||
NSView* web_view = GetWebContents()->GetNativeView();
|
||||
gfx::Rect window_bounds(
|
||||
0, 0, NSWidth([web_view bounds]), NSHeight([web_view bounds]));
|
||||
system_drag_exclude_areas_.clear();
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "browser/inspectable_web_contents_view.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/browser/web_contents_view.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "ui/aura/window.h"
|
||||
#include "ui/aura/window_tree_host.h"
|
||||
@@ -40,6 +39,7 @@
|
||||
#if defined(USE_X11)
|
||||
#include "atom/browser/ui/views/global_menu_bar_x11.h"
|
||||
#include "atom/browser/ui/views/frameless_view.h"
|
||||
#include "chrome/browser/ui/libgtk2ui/unity_service.h"
|
||||
#include "ui/gfx/x/x11_types.h"
|
||||
#include "ui/views/window/native_frame_view.h"
|
||||
#elif defined(OS_WIN)
|
||||
@@ -123,6 +123,7 @@ NativeWindowViews::NativeWindowViews(content::WebContents* web_contents,
|
||||
use_content_size_)
|
||||
bounds = ContentBoundsToWindowBounds(bounds);
|
||||
|
||||
window_->UpdateWindowIcon();
|
||||
window_->CenterWindow(bounds.size());
|
||||
Layout();
|
||||
}
|
||||
@@ -186,6 +187,10 @@ void NativeWindowViews::Restore() {
|
||||
window_->Restore();
|
||||
}
|
||||
|
||||
bool NativeWindowViews::IsMinimized() {
|
||||
return window_->IsMinimized();
|
||||
}
|
||||
|
||||
void NativeWindowViews::SetFullscreen(bool fullscreen) {
|
||||
window_->SetFullscreen(fullscreen);
|
||||
}
|
||||
@@ -199,6 +204,11 @@ void NativeWindowViews::SetSize(const gfx::Size& size) {
|
||||
}
|
||||
|
||||
gfx::Size NativeWindowViews::GetSize() {
|
||||
#if defined(OS_WIN)
|
||||
if (IsMinimized())
|
||||
return window_->GetRestoredBounds().size();
|
||||
#endif
|
||||
|
||||
return window_->GetWindowBoundsInScreen().size();
|
||||
}
|
||||
|
||||
@@ -282,6 +292,11 @@ void NativeWindowViews::SetPosition(const gfx::Point& position) {
|
||||
}
|
||||
|
||||
gfx::Point NativeWindowViews::GetPosition() {
|
||||
#if defined(OS_WIN)
|
||||
if (IsMinimized())
|
||||
return window_->GetRestoredBounds().origin();
|
||||
#endif
|
||||
|
||||
return window_->GetWindowBoundsInScreen().origin();
|
||||
}
|
||||
|
||||
@@ -324,11 +339,11 @@ void NativeWindowViews::SetMenu(ui::MenuModel* menu_model) {
|
||||
RegisterAccelerators(menu_model);
|
||||
|
||||
#if defined(USE_X11)
|
||||
if (!global_menu_bar_)
|
||||
if (unity::IsRunning() && !global_menu_bar_)
|
||||
global_menu_bar_.reset(new GlobalMenuBarX11(this));
|
||||
|
||||
// Use global application menu bar when possible.
|
||||
if (global_menu_bar_->IsServerStarted()) {
|
||||
if (global_menu_bar_ && global_menu_bar_->IsServerStarted()) {
|
||||
global_menu_bar_->SetMenu(menu_model);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ class NativeWindowViews : public NativeWindow,
|
||||
virtual bool IsMaximized() OVERRIDE;
|
||||
virtual void Minimize() OVERRIDE;
|
||||
virtual void Restore() OVERRIDE;
|
||||
virtual bool IsMinimized() OVERRIDE;
|
||||
virtual void SetFullscreen(bool fullscreen) OVERRIDE;
|
||||
virtual bool IsFullscreen() OVERRIDE;
|
||||
virtual void SetSize(const gfx::Size& size) OVERRIDE;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>atom.icns</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.14.2</string>
|
||||
<string>0.15.1</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.8.0</string>
|
||||
<key>NSMainNibFile</key>
|
||||
|
||||
@@ -50,8 +50,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,14,2,0
|
||||
PRODUCTVERSION 0,14,2,0
|
||||
FILEVERSION 0,15,1,0
|
||||
PRODUCTVERSION 0,15,1,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -68,12 +68,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "GitHub, Inc."
|
||||
VALUE "FileDescription", "Atom-Shell"
|
||||
VALUE "FileVersion", "0.14.2"
|
||||
VALUE "FileVersion", "0.15.1"
|
||||
VALUE "InternalName", "atom.exe"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2013 GitHub, Inc. All rights reserved."
|
||||
VALUE "OriginalFilename", "atom.exe"
|
||||
VALUE "ProductName", "Atom-Shell"
|
||||
VALUE "ProductVersion", "0.14.2"
|
||||
VALUE "ProductVersion", "0.15.1"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -87,7 +87,7 @@ ui::KeyboardCode KeyboardCodeFromCharCode(char c, bool* shifted) {
|
||||
|
||||
bool StringToAccelerator(const std::string& description,
|
||||
ui::Accelerator* accelerator) {
|
||||
if (!IsStringASCII(description)) {
|
||||
if (!base::IsStringASCII(description)) {
|
||||
LOG(ERROR) << "The accelerator string can only contain ASCII characters";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ void SetupDialogForProperties(NSOpenPanel* dialog, int properties) {
|
||||
// Run modal dialog with parent window and return user's choice.
|
||||
int RunModalDialog(NSSavePanel* dialog, atom::NativeWindow* parent_window) {
|
||||
__block int chosen = NSFileHandlingPanelCancelButton;
|
||||
if (parent_window == NULL) {
|
||||
if (!parent_window || !parent_window->GetNativeWindow()) {
|
||||
chosen = [dialog runModal];
|
||||
} else {
|
||||
NSWindow* window = parent_window->GetNativeWindow();
|
||||
|
||||
@@ -99,7 +99,7 @@ int ShowMessageBox(NativeWindow* parent_window,
|
||||
|
||||
// Use runModal for synchronous alert without parent, since we don't have a
|
||||
// window to wait for.
|
||||
if (!parent_window)
|
||||
if (!parent_window || !parent_window->GetNativeWindow())
|
||||
return [[alert autorelease] runModal];
|
||||
|
||||
int ret_code = -1;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "atom/browser/ui/views/menu_bar.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "ui/views/controls/button/menu_button.h"
|
||||
#include "ui/views/controls/menu/menu_item_view.h"
|
||||
#include "ui/views/controls/menu/menu_model_adapter.h"
|
||||
#include "ui/views/controls/menu/menu_runner.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
@@ -39,7 +40,7 @@ void MenuDelegate::RunMenu(ui::MenuModel* model, views::MenuButton* button) {
|
||||
button->GetWidget()->GetTopLevelWidget(),
|
||||
button,
|
||||
bounds,
|
||||
views::MenuItemView::TOPRIGHT,
|
||||
views::MENU_ANCHOR_TOPRIGHT,
|
||||
ui::MENU_SOURCE_MOUSE,
|
||||
views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU));
|
||||
}
|
||||
@@ -107,14 +108,14 @@ void MenuDelegate::WillHideMenu(views::MenuItemView* menu) {
|
||||
views::MenuItemView* MenuDelegate::GetSiblingMenu(
|
||||
views::MenuItemView* menu,
|
||||
const gfx::Point& screen_point,
|
||||
views::MenuItemView::AnchorPosition* anchor,
|
||||
views::MenuAnchorPosition* anchor,
|
||||
bool* has_mnemonics,
|
||||
views::MenuButton** button) {
|
||||
ui::MenuModel* model;
|
||||
if (!menu_bar_->GetMenuButtonFromScreenPoint(screen_point, &model, button))
|
||||
return NULL;
|
||||
|
||||
*anchor = views::MenuItemView::TOPLEFT;
|
||||
*anchor = views::MENU_ANCHOR_TOPLEFT;
|
||||
*has_mnemonics = true;
|
||||
|
||||
id_ = (*button)->tag();
|
||||
|
||||
@@ -46,7 +46,7 @@ class MenuDelegate : public views::MenuDelegate {
|
||||
virtual views::MenuItemView* GetSiblingMenu(
|
||||
views::MenuItemView* menu,
|
||||
const gfx::Point& screen_point,
|
||||
views::MenuItemView::AnchorPosition* anchor,
|
||||
views::MenuAnchorPosition* anchor,
|
||||
bool* has_mnemonics,
|
||||
views::MenuButton** button);
|
||||
|
||||
|
||||
@@ -60,16 +60,14 @@ void NotifyIcon::HandleClickEvent(const gfx::Point& cursor_pos,
|
||||
if (!SetForegroundWindow(window_))
|
||||
return;
|
||||
|
||||
menu_runner_.reset(new views::MenuRunner(menu_model_));
|
||||
views::MenuRunner::RunResult result = menu_runner_->RunMenuAt(
|
||||
views::MenuRunner menu_runner(menu_model_);
|
||||
ignore_result(menu_runner.RunMenuAt(
|
||||
NULL,
|
||||
NULL,
|
||||
gfx::Rect(cursor_pos, gfx::Size()),
|
||||
views::MenuItemView::TOPLEFT,
|
||||
views::MENU_ANCHOR_TOPLEFT,
|
||||
ui::MENU_SOURCE_MOUSE,
|
||||
views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU);
|
||||
if (result == views::MenuRunner::MENU_DELETED)
|
||||
LOG(ERROR) << "Menu deleted when running";
|
||||
views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU));
|
||||
}
|
||||
|
||||
void NotifyIcon::ResetIcon() {
|
||||
|
||||
@@ -20,10 +20,6 @@ namespace gfx {
|
||||
class Point;
|
||||
}
|
||||
|
||||
namespace views {
|
||||
class MenuRunner;
|
||||
}
|
||||
|
||||
namespace atom {
|
||||
|
||||
class NotifyIconHost;
|
||||
@@ -72,7 +68,6 @@ class NotifyIcon : public TrayIcon {
|
||||
|
||||
// The context menu.
|
||||
ui::SimpleMenuModel* menu_model_;
|
||||
scoped_ptr<views::MenuRunner> menu_runner_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NotifyIcon);
|
||||
};
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#define ATOM_VERSION_H
|
||||
|
||||
#define ATOM_MAJOR_VERSION 0
|
||||
#define ATOM_MINOR_VERSION 14
|
||||
#define ATOM_PATCH_VERSION 2
|
||||
#define ATOM_MINOR_VERSION 15
|
||||
#define ATOM_PATCH_VERSION 1
|
||||
|
||||
#define ATOM_VERSION_IS_RELEASE 1
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#ifndef ATOM_COMMON_CHROME_VERSION_H_
|
||||
#define ATOM_COMMON_CHROME_VERSION_H_
|
||||
|
||||
#define CHROME_VERSION_STRING "35.0.1916.153"
|
||||
#define CHROME_VERSION_STRING "36.0.1985.125"
|
||||
#define CHROME_VERSION "v" CHROME_VERSION_STRING
|
||||
|
||||
#endif // ATOM_COMMON_CHROME_VERSION_H_
|
||||
|
||||
@@ -54,12 +54,14 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
|
||||
if (waiting_event != INVALID_HANDLE_VALUE)
|
||||
WaitForSingleObject(waiting_event, 1000);
|
||||
|
||||
int handler_types = google_breakpad::ExceptionHandler::HANDLER_EXCEPTION |
|
||||
google_breakpad::ExceptionHandler::HANDLER_PURECALL;
|
||||
breakpad_.reset(new google_breakpad::ExceptionHandler(
|
||||
temp_dir.value(),
|
||||
FilterCallback,
|
||||
MinidumpCallback,
|
||||
this,
|
||||
google_breakpad::ExceptionHandler::HANDLER_ALL,
|
||||
handler_types,
|
||||
kSmallDumpType,
|
||||
pipe_name.c_str(),
|
||||
GetCustomInfo(product_name, version, company_name)));
|
||||
|
||||
@@ -61,6 +61,7 @@ REFERENCE_MODULE(uv);
|
||||
// Atom Shell's builtin modules.
|
||||
REFERENCE_MODULE(atom_browser_app);
|
||||
REFERENCE_MODULE(atom_browser_auto_updater);
|
||||
REFERENCE_MODULE(atom_browser_content_tracing);
|
||||
REFERENCE_MODULE(atom_browser_dialog);
|
||||
REFERENCE_MODULE(atom_browser_menu);
|
||||
REFERENCE_MODULE(atom_browser_power_monitor);
|
||||
|
||||
@@ -7,19 +7,19 @@
|
||||
#include "atom/common/native_mate_converters/value_converter.h"
|
||||
#include "content/public/renderer/render_view.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "third_party/WebKit/public/web/WebFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebView.h"
|
||||
|
||||
#include "atom/common/node_includes.h"
|
||||
|
||||
using content::RenderView;
|
||||
using blink::WebFrame;
|
||||
using blink::WebLocalFrame;
|
||||
using blink::WebView;
|
||||
|
||||
namespace {
|
||||
|
||||
RenderView* GetCurrentRenderView() {
|
||||
WebFrame* frame = WebFrame::frameForCurrentContext();
|
||||
WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext();
|
||||
if (!frame)
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "native_mate/object_template_builder.h"
|
||||
#include "third_party/WebKit/public/web/WebFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebView.h"
|
||||
|
||||
#include "atom/common/node_includes.h"
|
||||
@@ -18,7 +18,7 @@ namespace api {
|
||||
namespace {
|
||||
|
||||
blink::WebView* GetCurrentWebView() {
|
||||
blink::WebFrame* frame = blink::WebFrame::frameForCurrentContext();
|
||||
blink::WebLocalFrame* frame = blink::WebLocalFrame::frameForCurrentContext();
|
||||
if (!frame)
|
||||
return NULL;
|
||||
return frame->view();
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "third_party/WebKit/public/web/WebDraggableRegion.h"
|
||||
#include "third_party/WebKit/public/web/WebDocument.h"
|
||||
#include "third_party/WebKit/public/web/WebFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebView.h"
|
||||
|
||||
#include "atom/common/node_includes.h"
|
||||
@@ -36,7 +37,8 @@ AtomRenderViewObserver::AtomRenderViewObserver(
|
||||
AtomRenderViewObserver::~AtomRenderViewObserver() {
|
||||
}
|
||||
|
||||
void AtomRenderViewObserver::DidCreateDocumentElement(blink::WebFrame* frame) {
|
||||
void AtomRenderViewObserver::DidCreateDocumentElement(
|
||||
blink::WebLocalFrame* frame) {
|
||||
// Read --zoom-factor from command line.
|
||||
std::string zoom_factor_str = CommandLine::ForCurrentProcess()->
|
||||
GetSwitchValueASCII(switches::kZoomFactor);;
|
||||
|
||||
@@ -25,7 +25,7 @@ class AtomRenderViewObserver : public content::RenderViewObserver {
|
||||
|
||||
private:
|
||||
// content::RenderViewObserver implementation.
|
||||
virtual void DidCreateDocumentElement(blink::WebFrame* frame) OVERRIDE;
|
||||
virtual void DidCreateDocumentElement(blink::WebLocalFrame* frame) OVERRIDE;
|
||||
virtual void DraggableRegionsChanged(blink::WebFrame* frame) OVERRIDE;
|
||||
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
||||
|
||||
|
||||
@@ -70,6 +70,10 @@ AtomRendererClient::AtomRendererClient()
|
||||
node_integration_ = ALL;
|
||||
|
||||
if (IsNodeBindingEnabled()) {
|
||||
// Always enable harmony when node binding is on.
|
||||
std::string flags("--harmony");
|
||||
v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size()));
|
||||
|
||||
node_bindings_.reset(NodeBindings::Create(false));
|
||||
atom_bindings_.reset(new AtomRendererBindings);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ Modules for browser side:
|
||||
* [app](api/app.md)
|
||||
* [auto-updater](api/auto-updater.md)
|
||||
* [browser-window](api/browser-window.md)
|
||||
* [content-tracing](api/content-tracing.md)
|
||||
* [dialog](api/dialog.md)
|
||||
* [ipc (browser)](api/ipc-browser.md)
|
||||
* [menu](api/menu.md)
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
The `auto-updater` module is a simple wrap around the
|
||||
[Squirrel.Mac](https://github.com/Squirrel/Squirrel.Mac) framework.
|
||||
|
||||
Squirrel.Mac requires that your `.app` folder is signed using the
|
||||
[codesign](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/codesign.1.html)
|
||||
utility for updates to be installed.
|
||||
|
||||
## Squirrel
|
||||
|
||||
Squirrel is an OS X framework focused on making application updates **as safe
|
||||
|
||||
@@ -63,7 +63,6 @@ You can also create a window without chrome by using
|
||||
* `text-areas-are-resizable` Boolean
|
||||
* `webgl` Boolean
|
||||
* `webaudio` Boolean
|
||||
* `accelerated-compositing` Boolean
|
||||
* `plugins` Boolean - Whether plugins should be enabled, currently only
|
||||
`NPAPI` plugins are supported.
|
||||
* `extra-plugin-dirs` Array - Array of paths that would be searched for
|
||||
@@ -252,6 +251,10 @@ the Dock.
|
||||
|
||||
Restores the window from minimized state to its previous state.
|
||||
|
||||
### BrowserWindow.isMinimized()
|
||||
|
||||
Returns whether the window is minimized.
|
||||
|
||||
### BrowserWindow.setFullScreen(flag)
|
||||
|
||||
* `flag` Boolean
|
||||
|
||||
136
docs/api/content-tracing.md
Normal file
136
docs/api/content-tracing.md
Normal file
@@ -0,0 +1,136 @@
|
||||
# content-tracing
|
||||
|
||||
The `content-trace` module is used to collect tracing data generated by the
|
||||
underlying Chromium content module. This module does not include a web interface
|
||||
so you need to open `chrome://tracing/` in Chrome browser and load the generated
|
||||
file to view the result.
|
||||
|
||||
```javascript
|
||||
var tracing = require('content-tracing');
|
||||
tracing.startRecording('*', tracing.DEFAULT_OPTIONS, function() {
|
||||
console.log('Tracing started');
|
||||
|
||||
setTimeout(function() {
|
||||
tracing.stopRecording('', function(path) {
|
||||
console.log('Tracing data recorded to ' + path);
|
||||
});
|
||||
}, 5000);
|
||||
});
|
||||
```
|
||||
|
||||
## tracing.getCategories(callback)
|
||||
|
||||
* `callback` Function
|
||||
|
||||
Get a set of category groups. The category groups can change as new code paths
|
||||
are reached.
|
||||
|
||||
Once all child processes have acked to the `getCategories` request, `callback`
|
||||
is called back with an array of category groups.
|
||||
|
||||
## tracing.startRecording(categoryFilter, options, callback)
|
||||
|
||||
* `categoryFilter` String
|
||||
* `options` Integer
|
||||
* `callback` Function
|
||||
|
||||
Start recording on all processes.
|
||||
|
||||
Recording begins immediately locally, and asynchronously on child processes
|
||||
as soon as they receive the EnableRecording request. Once all child processes
|
||||
have acked to the `startRecording` request, `callback` will be called back.
|
||||
|
||||
`categoryFilter` is a filter to control what category groups should be
|
||||
traced. A filter can have an optional `-` prefix to exclude category groups
|
||||
that contain a matching category. Having both included and excluded
|
||||
category patterns in the same list would not be supported.
|
||||
|
||||
Examples:
|
||||
|
||||
* `test_MyTest*`,
|
||||
* `test_MyTest*,test_OtherStuff`,
|
||||
* `"-excluded_category1,-excluded_category2`
|
||||
|
||||
`options` controls what kind of tracing is enabled, it could be a OR-ed
|
||||
combination of `tracing.DEFAULT_OPTIONS`, `tracing.ENABLE_SYSTRACE`,
|
||||
`tracing.ENABLE_SAMPLING` and `tracing.RECORD_CONTINUOUSLY`.
|
||||
|
||||
## tracing.stopRecording(resultFilePath, callback)
|
||||
|
||||
* `resultFilePath` String
|
||||
* `callback` Function
|
||||
|
||||
Stop recording on all processes.
|
||||
|
||||
Child processes typically are caching trace data and only rarely flush and send
|
||||
trace data back to the browser process. That is because it may be an expensive
|
||||
operation to send the trace data over IPC, and we would like to avoid much
|
||||
runtime overhead of tracing. So, to end tracing, we must asynchronously ask all
|
||||
child processes to flush any pending trace data.
|
||||
|
||||
Once all child processes have acked to the `stopRecording` request, `callback`
|
||||
will be called back with a file that contains the traced data.
|
||||
|
||||
Trace data will be written into `resultFilePath` if it is not empty, or into a
|
||||
temporary file. The actual file path will be passed to `callback` if it's not
|
||||
null.
|
||||
|
||||
## tracing.startMonitoring(categoryFilter, options, callback)
|
||||
|
||||
* `categoryFilter` String
|
||||
* `options` Integer
|
||||
* `callback` Function
|
||||
|
||||
Start monitoring on all processes.
|
||||
|
||||
Monitoring begins immediately locally, and asynchronously on child processes as
|
||||
soon as they receive the `startMonitoring` request.
|
||||
|
||||
Once all child processes have acked to the `startMonitoring` request, `callback`
|
||||
will be called back.
|
||||
|
||||
## tracing.stopMonitoring(callback);
|
||||
|
||||
* `callback` Function
|
||||
|
||||
Stop monitoring on all processes.
|
||||
|
||||
Once all child processes have acked to the `stopMonitoring` request, `callback`
|
||||
is called back.
|
||||
|
||||
## tracing.captureMonitoringSnapshot(resultFilePath, callback)
|
||||
|
||||
* `resultFilePath` String
|
||||
* `callback` Function
|
||||
|
||||
Get the current monitoring traced data.
|
||||
|
||||
Child processes typically are caching trace data and only rarely flush and send
|
||||
trace data back to the browser process. That is because it may be an expensive
|
||||
operation to send the trace data over IPC, and we would like to avoid much
|
||||
runtime overhead of tracing. So, to end tracing, we must asynchronously ask all
|
||||
child processes to flush any pending trace data.
|
||||
|
||||
Once all child processes have acked to the `captureMonitoringSnapshot` request,
|
||||
`callback` will be called back with a file that contains the traced data.
|
||||
|
||||
|
||||
## tracing.getTraceBufferPercentFull(callback)
|
||||
|
||||
* `callback` Function
|
||||
|
||||
Get the maximum across processes of trace buffer percent full state. When the
|
||||
TraceBufferPercentFull value is determined, the `callback` is called.
|
||||
|
||||
## tracing.setWatchEvent(categoryName, eventName, callback)
|
||||
|
||||
* `categoryName` String
|
||||
* `eventName` String
|
||||
* `callback` Function
|
||||
|
||||
`callback` will will be called every time the given event occurs on any process.
|
||||
|
||||
## tracing.cancelWatchEvent()
|
||||
|
||||
Cancel the watch event. If tracing is enabled, this may race with the watch
|
||||
event callback.
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "atom-shell",
|
||||
"version": "0.14.2",
|
||||
"version": "0.15.1",
|
||||
|
||||
"licenses": [
|
||||
{
|
||||
@@ -10,7 +10,7 @@
|
||||
],
|
||||
|
||||
"devDependencies": {
|
||||
"atom-package-manager": "0.76.x",
|
||||
"atom-package-manager": "0.84.x",
|
||||
"coffee-script": "~1.7.1",
|
||||
"coffeelint": "~1.3.0"
|
||||
},
|
||||
|
||||
@@ -36,12 +36,15 @@ TARGET_BINARIES = {
|
||||
'atom.exe',
|
||||
'chromiumcontent.dll',
|
||||
'content_shell.pak',
|
||||
'd3dcompiler_43.dll',
|
||||
'ffmpegsumo.dll',
|
||||
'icudtl.dat',
|
||||
'libEGL.dll',
|
||||
'libGLESv2.dll',
|
||||
'd3dcompiler_43.dll',
|
||||
'msvcp120.dll',
|
||||
'msvcr120.dll',
|
||||
'ui_resources_200_percent.pak',
|
||||
'vccorlib120.dll',
|
||||
'webkit_resources_200_percent.pak',
|
||||
'xinput1_3.dll',
|
||||
],
|
||||
|
||||
@@ -5,7 +5,7 @@ import sys
|
||||
|
||||
NODE_VERSION = 'v0.11.13'
|
||||
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
|
||||
LIBCHROMIUMCONTENT_COMMIT = '177f00b33d8ba5a6befe646e8d39ce19b6a3c668'
|
||||
LIBCHROMIUMCONTENT_COMMIT = 'dcd011c56f1e19885bac78ca58a397b0c5c25265'
|
||||
|
||||
ARCH = {
|
||||
'cygwin': '32bit',
|
||||
|
||||
@@ -4,10 +4,10 @@ import errno
|
||||
import sys
|
||||
import os
|
||||
|
||||
from lib.util import safe_mkdir, extract_zip, tempdir, download
|
||||
from lib.util import safe_mkdir, rm_rf, extract_zip, tempdir, download
|
||||
|
||||
|
||||
VERSION = 'v0.0.3'
|
||||
VERSION = 'v0.1.0'
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
FRAMEWORKS_URL = 'https://github.com/atom/atom-shell-frameworks/releases' \
|
||||
'/download/' + VERSION
|
||||
@@ -17,10 +17,12 @@ def main():
|
||||
os.chdir(SOURCE_ROOT)
|
||||
version_file = os.path.join(SOURCE_ROOT, 'external_binaries', '.version')
|
||||
|
||||
safe_mkdir('external_binaries')
|
||||
if (is_updated(version_file, VERSION)):
|
||||
return
|
||||
|
||||
rm_rf('external_binaries')
|
||||
safe_mkdir('external_binaries')
|
||||
|
||||
with open(version_file, 'w') as f:
|
||||
f.write(VERSION)
|
||||
|
||||
@@ -30,6 +32,7 @@ def main():
|
||||
download_and_unzip('Squirrel')
|
||||
elif sys.platform in ['cygwin', 'win32']:
|
||||
download_and_unzip('directxsdk')
|
||||
download_and_unzip('vs2012_crt')
|
||||
|
||||
|
||||
def is_updated(version_file, version):
|
||||
|
||||
@@ -32,6 +32,14 @@ describe 'node feature', ->
|
||||
done()
|
||||
child.send 'message'
|
||||
|
||||
it 'works in browser process', (done) ->
|
||||
fork = require('remote').require('child_process').fork
|
||||
child = fork path.join(fixtures, 'module', 'ping.js')
|
||||
child.on 'message', (msg) ->
|
||||
assert.equal msg, 'message'
|
||||
done()
|
||||
child.send 'message'
|
||||
|
||||
describe 'contexts', ->
|
||||
describe 'setTimeout in fs callback', ->
|
||||
it 'does not crash', (done) ->
|
||||
|
||||
2
vendor/brightray
vendored
2
vendor/brightray
vendored
Submodule vendor/brightray updated: 13628c0d7f...91a5af9223
2
vendor/node
vendored
2
vendor/node
vendored
Submodule vendor/node updated: 4d2db275a3...6d772c3cda
Reference in New Issue
Block a user