Merge remote-tracking branch 'atom/master'

This commit is contained in:
Plusb Preco 2015-10-03 17:37:05 +09:00
commit 77fa02e93e
40 changed files with 350 additions and 203 deletions

View file

@ -15,7 +15,7 @@ Follow [@ElectronJS](https://twitter.com/electronjs) on Twitter for important
announcements. announcements.
This project adheres to the [Contributor Covenant 1.2](http://contributor-covenant.org/version/1/2/0). This project adheres to the [Contributor Covenant 1.2](http://contributor-covenant.org/version/1/2/0).
By participating, you are expected to uphold this code. Please report By participating, you are expected to uphold this code. Please report
unacceptable behavior to atom@github.com. unacceptable behavior to atom@github.com.
## Downloads ## Downloads
@ -55,12 +55,12 @@ contains documents describing how to build and contribute to Electron.
## Community ## Community
You can ask questions and interact with the community in the following You can ask questions and interact with the community in the following
locations: locations:
- [`electron`](http://discuss.atom.io/category/electron) category on the Atom - [`electron`](http://discuss.atom.io/category/electron) category on the Atom
forums forums
- `#atom-shell` channel on Freenode - `#atom-shell` channel on Freenode
- [`Atom`](http://atom-slack.herokuapp.com/) channel on Slack - [`Atom`](http://atom-slack.herokuapp.com/) channel on Slack
Check out [awesome-electron](https://github.com/sindresorhus/awesome-electron) Check out [awesome-electron](https://github.com/sindresorhus/awesome-electron)
for a community maintained list of useful example apps, tools and resources. for a community maintained list of useful example apps, tools and resources.

View file

@ -4,7 +4,7 @@
'product_name%': 'Electron', 'product_name%': 'Electron',
'company_name%': 'GitHub, Inc', 'company_name%': 'GitHub, Inc',
'company_abbr%': 'github', 'company_abbr%': 'github',
'version%': '0.33.3', 'version%': '0.33.4',
}, },
'includes': [ 'includes': [
'filenames.gypi', 'filenames.gypi',

View file

@ -27,10 +27,10 @@ AtomMainDelegate::~AtomMainDelegate() {
} }
bool AtomMainDelegate::BasicStartupComplete(int* exit_code) { bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
// Disable logging out to debug.log on Windows
logging::LoggingSettings settings; logging::LoggingSettings settings;
#if defined(OS_WIN) #if defined(OS_WIN)
#if defined(DEBUG) #if defined(DEBUG)
// Print logging to debug.log on Windows
settings.logging_dest = logging::LOG_TO_ALL; settings.logging_dest = logging::LOG_TO_ALL;
settings.log_file = L"debug.log"; settings.log_file = L"debug.log";
settings.lock_log = logging::LOCK_LOG_FILE; settings.lock_log = logging::LOCK_LOG_FILE;
@ -41,6 +41,12 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
#else // defined(OS_WIN) #else // defined(OS_WIN)
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
#endif // !defined(OS_WIN) #endif // !defined(OS_WIN)
// Only enable logging when --enable-logging is specified.
auto command_line = base::CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(switches::kEnableLogging))
settings.logging_dest = logging::LOG_NONE;
logging::InitLogging(settings); logging::InitLogging(settings);
// Logging with pid and timestamp. // Logging with pid and timestamp.

View file

@ -7,6 +7,7 @@
#include <set> #include <set>
#include "atom/browser/api/atom_api_session.h" #include "atom/browser/api/atom_api_session.h"
#include "atom/browser/api/atom_api_window.h"
#include "atom/browser/atom_browser_client.h" #include "atom/browser/atom_browser_client.h"
#include "atom/browser/atom_browser_context.h" #include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h" #include "atom/browser/atom_browser_main_parts.h"
@ -26,6 +27,7 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "brightray/browser/inspectable_web_contents.h" #include "brightray/browser/inspectable_web_contents.h"
#include "brightray/browser/inspectable_web_contents_view.h"
#include "chrome/browser/printing/print_view_manager_basic.h" #include "chrome/browser/printing/print_view_manager_basic.h"
#include "chrome/browser/printing/print_preview_message_handler.h" #include "chrome/browser/printing/print_preview_message_handler.h"
#include "content/common/view_messages.h" #include "content/common/view_messages.h"
@ -228,6 +230,8 @@ WebContents::WebContents(v8::Isolate* isolate,
AttachAsUserData(web_contents); AttachAsUserData(web_contents);
InitWithWebContents(web_contents); InitWithWebContents(web_contents);
managed_web_contents()->GetView()->SetDelegate(this);
// Save the preferences in C++. // Save the preferences in C++.
base::DictionaryValue web_preferences; base::DictionaryValue web_preferences;
mate::ConvertFromV8(isolate, options.GetHandle(), &web_preferences); mate::ConvertFromV8(isolate, options.GetHandle(), &web_preferences);
@ -491,6 +495,33 @@ void WebContents::DidUpdateFaviconURL(
Emit("page-favicon-updated", unique_urls); Emit("page-favicon-updated", unique_urls);
} }
void WebContents::DevToolsFocused() {
Emit("devtools-focused");
}
void WebContents::DevToolsOpened() {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
auto handle = WebContents::CreateFrom(
isolate(), managed_web_contents()->GetDevToolsWebContents());
devtools_web_contents_.Reset(isolate(), handle.ToV8());
// Inherit owner window in devtools.
if (owner_window())
handle->SetOwnerWindow(managed_web_contents()->GetDevToolsWebContents(),
owner_window());
Emit("devtools-opened");
}
void WebContents::DevToolsClosed() {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
devtools_web_contents_.Reset();
Emit("devtools-closed");
}
bool WebContents::OnMessageReceived(const IPC::Message& message) { bool WebContents::OnMessageReceived(const IPC::Message& message) {
bool handled = true; bool handled = true;
IPC_BEGIN_MESSAGE_MAP(WebContents, message) IPC_BEGIN_MESSAGE_MAP(WebContents, message)
@ -698,10 +729,6 @@ void WebContents::InspectServiceWorker() {
} }
} }
v8::Local<v8::Value> WebContents::Session(v8::Isolate* isolate) {
return v8::Local<v8::Value>::New(isolate, session_);
}
void WebContents::HasServiceWorker( void WebContents::HasServiceWorker(
const base::Callback<void(bool)>& callback) { const base::Callback<void(bool)>& callback) {
auto context = GetServiceWorkerContext(web_contents()); auto context = GetServiceWorkerContext(web_contents());
@ -893,6 +920,24 @@ v8::Local<v8::Value> WebContents::GetWebPreferences(v8::Isolate* isolate) {
return mate::ConvertToV8(isolate, *web_preferences->web_preferences()); return mate::ConvertToV8(isolate, *web_preferences->web_preferences());
} }
v8::Local<v8::Value> WebContents::GetOwnerBrowserWindow() {
if (owner_window())
return Window::From(isolate(), owner_window());
else
return v8::Null(isolate());
}
v8::Local<v8::Value> WebContents::Session(v8::Isolate* isolate) {
return v8::Local<v8::Value>::New(isolate, session_);
}
v8::Local<v8::Value> WebContents::DevToolsWebContents(v8::Isolate* isolate) {
if (devtools_web_contents_.IsEmpty())
return v8::Null(isolate);
else
return v8::Local<v8::Value>::New(isolate, devtools_web_contents_);
}
mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder( mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
v8::Isolate* isolate) { v8::Isolate* isolate) {
if (template_.IsEmpty()) if (template_.IsEmpty())
@ -949,6 +994,7 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
.SetMethod("setAllowTransparency", &WebContents::SetAllowTransparency) .SetMethod("setAllowTransparency", &WebContents::SetAllowTransparency)
.SetMethod("isGuest", &WebContents::IsGuest) .SetMethod("isGuest", &WebContents::IsGuest)
.SetMethod("getWebPreferences", &WebContents::GetWebPreferences) .SetMethod("getWebPreferences", &WebContents::GetWebPreferences)
.SetMethod("getOwnerBrowserWindow", &WebContents::GetOwnerBrowserWindow)
.SetMethod("hasServiceWorker", &WebContents::HasServiceWorker) .SetMethod("hasServiceWorker", &WebContents::HasServiceWorker)
.SetMethod("unregisterServiceWorker", .SetMethod("unregisterServiceWorker",
&WebContents::UnregisterServiceWorker) &WebContents::UnregisterServiceWorker)
@ -957,7 +1003,9 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
.SetMethod("_printToPDF", &WebContents::PrintToPDF) .SetMethod("_printToPDF", &WebContents::PrintToPDF)
.SetMethod("addWorkSpace", &WebContents::AddWorkSpace) .SetMethod("addWorkSpace", &WebContents::AddWorkSpace)
.SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace) .SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace)
.SetProperty("session", &WebContents::Session) .SetProperty("session", &WebContents::Session, true)
.SetProperty("devToolsWebContents",
&WebContents::DevToolsWebContents, true)
.Build()); .Build());
return mate::ObjectTemplateBuilder( return mate::ObjectTemplateBuilder(

View file

@ -83,7 +83,6 @@ class WebContents : public mate::TrackableObject<WebContents>,
void DisableDeviceEmulation(); void DisableDeviceEmulation();
void InspectElement(int x, int y); void InspectElement(int x, int y);
void InspectServiceWorker(); void InspectServiceWorker();
v8::Local<v8::Value> Session(v8::Isolate* isolate);
void HasServiceWorker(const base::Callback<void(bool)>&); void HasServiceWorker(const base::Callback<void(bool)>&);
void UnregisterServiceWorker(const base::Callback<void(bool)>&); void UnregisterServiceWorker(const base::Callback<void(bool)>&);
void SetAudioMuted(bool muted); void SetAudioMuted(bool muted);
@ -135,6 +134,13 @@ class WebContents : public mate::TrackableObject<WebContents>,
// Returns the web preferences of current WebContents. // Returns the web preferences of current WebContents.
v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate); v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate);
// Returns the owner window.
v8::Local<v8::Value> GetOwnerBrowserWindow();
// Properties.
v8::Local<v8::Value> Session(v8::Isolate* isolate);
v8::Local<v8::Value> DevToolsWebContents(v8::Isolate* isolate);
protected: protected:
explicit WebContents(content::WebContents* web_contents); explicit WebContents(content::WebContents* web_contents);
WebContents(v8::Isolate* isolate, const mate::Dictionary& options); WebContents(v8::Isolate* isolate, const mate::Dictionary& options);
@ -218,6 +224,11 @@ class WebContents : public mate::TrackableObject<WebContents>,
void PluginCrashed(const base::FilePath& plugin_path, void PluginCrashed(const base::FilePath& plugin_path,
base::ProcessId plugin_pid) override; base::ProcessId plugin_pid) override;
// brightray::InspectableWebContentsViewDelegate:
void DevToolsFocused() override;
void DevToolsOpened() override;
void DevToolsClosed() override;
private: private:
enum Type { enum Type {
BROWSER_WINDOW, // Used by BrowserWindow. BROWSER_WINDOW, // Used by BrowserWindow.
@ -237,6 +248,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
IPC::Message* message); IPC::Message* message);
v8::Global<v8::Value> session_; v8::Global<v8::Value> session_;
v8::Global<v8::Value> devtools_web_contents_;
scoped_ptr<WebViewGuestDelegate> guest_delegate_; scoped_ptr<WebViewGuestDelegate> guest_delegate_;

View file

@ -92,6 +92,7 @@ Window::Window(v8::Isolate* isolate, const mate::Dictionary& options) {
web_contents->SetOwnerWindow(window_.get()); web_contents->SetOwnerWindow(window_.get());
window_->InitFromOptions(options); window_->InitFromOptions(options);
window_->AddObserver(this); window_->AddObserver(this);
AttachAsUserData(window_.get());
} }
Window::~Window() { Window::~Window() {
@ -184,28 +185,6 @@ void Window::OnRendererResponsive() {
Emit("responsive"); Emit("responsive");
} }
void Window::OnDevToolsFocus() {
Emit("devtools-focused");
}
void Window::OnDevToolsOpened() {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
auto handle = WebContents::CreateFrom(
isolate(), api_web_contents_->GetDevToolsWebContents());
devtools_web_contents_.Reset(isolate(), handle.ToV8());
Emit("devtools-opened");
}
void Window::OnDevToolsClosed() {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
devtools_web_contents_.Reset();
Emit("devtools-closed");
}
void Window::OnExecuteWindowsCommand(const std::string& command_name) { void Window::OnExecuteWindowsCommand(const std::string& command_name) {
Emit("app-command", command_name); Emit("app-command", command_name);
} }
@ -540,13 +519,6 @@ v8::Local<v8::Value> Window::WebContents(v8::Isolate* isolate) {
return v8::Local<v8::Value>::New(isolate, web_contents_); return v8::Local<v8::Value>::New(isolate, web_contents_);
} }
v8::Local<v8::Value> Window::DevToolsWebContents(v8::Isolate* isolate) {
if (devtools_web_contents_.IsEmpty())
return v8::Null(isolate);
else
return v8::Local<v8::Value>::New(isolate, devtools_web_contents_);
}
// static // static
void Window::BuildPrototype(v8::Isolate* isolate, void Window::BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype) { v8::Local<v8::ObjectTemplate> prototype) {
@ -618,8 +590,17 @@ void Window::BuildPrototype(v8::Isolate* isolate,
&Window::ShowDefinitionForSelection) &Window::ShowDefinitionForSelection)
#endif #endif
.SetProperty("id", &Window::ID, true) .SetProperty("id", &Window::ID, true)
.SetProperty("webContents", &Window::WebContents, true) .SetProperty("webContents", &Window::WebContents, true);
.SetProperty("devToolsWebContents", &Window::DevToolsWebContents, true); }
// static
v8::Local<v8::Value> Window::From(v8::Isolate* isolate,
NativeWindow* native_window) {
auto existing = TrackableObject::FromWrappedClass(isolate, native_window);
if (existing)
return existing->GetWrapper(isolate);
else
return v8::Null(isolate);
} }
} // namespace api } // namespace api

View file

@ -43,6 +43,10 @@ class Window : public mate::TrackableObject<Window>,
static void BuildPrototype(v8::Isolate* isolate, static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype); v8::Local<v8::ObjectTemplate> prototype);
// Returns the BrowserWindow object from |native_window|.
static v8::Local<v8::Value> From(v8::Isolate* isolate,
NativeWindow* native_window);
NativeWindow* window() const { return window_.get(); } NativeWindow* window() const { return window_.get(); }
protected: protected:
@ -69,9 +73,6 @@ class Window : public mate::TrackableObject<Window>,
void OnWindowLeaveHtmlFullScreen() override; void OnWindowLeaveHtmlFullScreen() override;
void OnRendererUnresponsive() override; void OnRendererUnresponsive() override;
void OnRendererResponsive() override; void OnRendererResponsive() override;
void OnDevToolsFocus() override;
void OnDevToolsOpened() override;
void OnDevToolsClosed() override;
void OnExecuteWindowsCommand(const std::string& command_name) override; void OnExecuteWindowsCommand(const std::string& command_name) override;
// mate::Wrappable: // mate::Wrappable:
@ -150,10 +151,8 @@ class Window : public mate::TrackableObject<Window>,
int32_t ID() const; int32_t ID() const;
v8::Local<v8::Value> WebContents(v8::Isolate* isolate); v8::Local<v8::Value> WebContents(v8::Isolate* isolate);
v8::Local<v8::Value> DevToolsWebContents(v8::Isolate* isolate);
v8::Global<v8::Value> web_contents_; v8::Global<v8::Value> web_contents_;
v8::Global<v8::Value> devtools_web_contents_;
v8::Global<v8::Value> menu_; v8::Global<v8::Value> menu_;
api::WebContents* api_web_contents_; api::WebContents* api_web_contents_;

View file

@ -48,6 +48,15 @@ BrowserWindow::_init = ->
# Notify the creation of the window. # Notify the creation of the window.
app.emit 'browser-window-created', {}, this app.emit 'browser-window-created', {}, this
# Be compatible with old APIs.
@webContents.on 'devtools-focused', => @emit 'devtools-focused'
@webContents.on 'devtools-opened', => @emit 'devtools-opened'
@webContents.on 'devtools-closed', => @emit 'devtools-closed'
Object.defineProperty this, 'devToolsWebContents',
enumerable: true,
configurable: false,
get: -> @webContents.devToolsWebContents
BrowserWindow.getFocusedWindow = -> BrowserWindow.getFocusedWindow = ->
windows = BrowserWindow.getAllWindows() windows = BrowserWindow.getAllWindows()
return window for window in windows when window.isFocused() return window for window in windows when window.isFocused()

View file

@ -79,7 +79,11 @@ Menu::_init = ->
v8Util.setHiddenValue group[0], 'checked', true unless checked v8Util.setHiddenValue group[0], 'checked', true unless checked
Menu::popup = (window, x, y) -> Menu::popup = (window, x, y) ->
throw new TypeError('Invalid window') unless window?.constructor is BrowserWindow unless window?.constructor is BrowserWindow
# Shift.
y = x
x = window
window = BrowserWindow.getFocusedWindow()
if x? and y? if x? and y?
@_popupAt(window, x, y) @_popupAt(window, x, y)
else else

View file

@ -12,6 +12,7 @@
#include "atom/browser/atom_browser_context.h" #include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h" #include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_quota_permission_context.h" #include "atom/browser/atom_quota_permission_context.h"
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
#include "atom/browser/atom_speech_recognition_manager_delegate.h" #include "atom/browser/atom_speech_recognition_manager_delegate.h"
#include "atom/browser/browser.h" #include "atom/browser/browser.h"
#include "atom/browser/native_window.h" #include "atom/browser/native_window.h"
@ -30,6 +31,7 @@
#include "content/public/browser/client_certificate_delegate.h" #include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/site_instance.h" #include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/web_preferences.h" #include "content/public/common/web_preferences.h"
@ -226,6 +228,13 @@ void AtomBrowserClient::SelectClientCertificate(
delegate.Pass()); delegate.Pass());
} }
void AtomBrowserClient::ResourceDispatcherHostCreated() {
resource_dispatcher_host_delegate_.reset(
new AtomResourceDispatcherHostDelegate);
content::ResourceDispatcherHost::Get()->SetDelegate(
resource_dispatcher_host_delegate_.get());
}
brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts( brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts(
const content::MainFunctionParams&) { const content::MainFunctionParams&) {
v8::V8::Initialize(); // Init V8 before creating main parts. v8::V8::Initialize(); // Init V8 before creating main parts.

View file

@ -23,6 +23,8 @@ class SSLCertRequestInfo;
namespace atom { namespace atom {
class AtomResourceDispatcherHostDelegate;
class AtomBrowserClient : public brightray::BrowserClient, class AtomBrowserClient : public brightray::BrowserClient,
public content::RenderProcessHostObserver { public content::RenderProcessHostObserver {
public: public:
@ -56,6 +58,7 @@ class AtomBrowserClient : public brightray::BrowserClient,
content::WebContents* web_contents, content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info, net::SSLCertRequestInfo* cert_request_info,
scoped_ptr<content::ClientCertificateDelegate> delegate) override; scoped_ptr<content::ClientCertificateDelegate> delegate) override;
void ResourceDispatcherHostCreated() override;
// brightray::BrowserClient: // brightray::BrowserClient:
brightray::BrowserMainParts* OverrideCreateBrowserMainParts( brightray::BrowserMainParts* OverrideCreateBrowserMainParts(
@ -68,6 +71,9 @@ class AtomBrowserClient : public brightray::BrowserClient,
// pending_render_process => current_render_process. // pending_render_process => current_render_process.
std::map<int, int> pending_processes_; std::map<int, int> pending_processes_;
scoped_ptr<AtomResourceDispatcherHostDelegate>
resource_dispatcher_host_delegate_;
DISALLOW_COPY_AND_ASSIGN(AtomBrowserClient); DISALLOW_COPY_AND_ASSIGN(AtomBrowserClient);
}; };

View file

@ -0,0 +1,32 @@
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
#include "atom/common/platform_util.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/escape.h"
#include "url/gurl.h"
using content::BrowserThread;
namespace atom {
AtomResourceDispatcherHostDelegate::AtomResourceDispatcherHostDelegate() {
}
bool AtomResourceDispatcherHostDelegate::HandleExternalProtocol(
const GURL& url,
int render_process_id,
int render_view_id,
bool is_main_frame,
ui::PageTransition transition,
bool has_user_gesture) {
GURL escaped_url(net::EscapeExternalHandlerValue(url.spec()));
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(base::IgnoreResult(platform_util::OpenExternal), escaped_url));
return true;
}
} // namespace atom

View file

@ -0,0 +1,28 @@
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
#define ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
#include "content/public/browser/resource_dispatcher_host_delegate.h"
namespace atom {
class AtomResourceDispatcherHostDelegate
: public content::ResourceDispatcherHostDelegate {
public:
AtomResourceDispatcherHostDelegate();
// content::ResourceDispatcherHostDelegate:
bool HandleExternalProtocol(const GURL& url,
int render_process_id,
int render_view_id,
bool is_main_frame,
ui::PageTransition transition,
bool has_user_gesture) override;
};
} // namespace atom
#endif // ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_

View file

@ -21,6 +21,14 @@
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "storage/browser/fileapi/isolated_context.h" #include "storage/browser/fileapi/isolated_context.h"
#if defined(TOOLKIT_VIEWS)
#include "atom/browser/native_window_views.h"
#endif
#if defined(USE_X11)
#include "atom/browser/browser.h"
#endif
using content::BrowserThread; using content::BrowserThread;
namespace atom { namespace atom {
@ -128,7 +136,11 @@ void CommonWebContentsDelegate::InitWithWebContents(
} }
void CommonWebContentsDelegate::SetOwnerWindow(NativeWindow* owner_window) { void CommonWebContentsDelegate::SetOwnerWindow(NativeWindow* owner_window) {
content::WebContents* web_contents = GetWebContents(); SetOwnerWindow(GetWebContents(), owner_window);
}
void CommonWebContentsDelegate::SetOwnerWindow(
content::WebContents* web_contents, NativeWindow* owner_window) {
owner_window_ = owner_window->GetWeakPtr(); owner_window_ = owner_window->GetWeakPtr();
NativeWindowRelay* relay = new NativeWindowRelay(owner_window_); NativeWindowRelay* relay = new NativeWindowRelay(owner_window_);
web_contents->SetUserData(relay->key, relay); web_contents->SetUserData(relay->key, relay);
@ -355,6 +367,23 @@ void CommonWebContentsDelegate::OnDevToolsAppendToFile(
"DevToolsAPI.appendedToURL", &url_value, nullptr, nullptr); "DevToolsAPI.appendedToURL", &url_value, nullptr, nullptr);
} }
#if defined(TOOLKIT_VIEWS)
gfx::ImageSkia CommonWebContentsDelegate::GetDevToolsWindowIcon() {
if (!owner_window())
return gfx::ImageSkia();
return static_cast<views::WidgetDelegate*>(static_cast<NativeWindowViews*>(
owner_window()))->GetWindowAppIcon();
}
#endif
#if defined(USE_X11)
void CommonWebContentsDelegate::GetDevToolsWindowWMClass(
std::string* name, std::string* class_name) {
*class_name = Browser::Get()->GetName();
*name = base::StringToLowerASCII(*class_name);
}
#endif
void CommonWebContentsDelegate::SetHtmlApiFullscreen(bool enter_fullscreen) { void CommonWebContentsDelegate::SetHtmlApiFullscreen(bool enter_fullscreen) {
// Window is already in fullscreen mode, save the state. // Window is already in fullscreen mode, save the state.
if (enter_fullscreen && owner_window_->IsFullscreen()) { if (enter_fullscreen && owner_window_->IsFullscreen()) {

View file

@ -12,6 +12,7 @@
#include "brightray/browser/default_web_contents_delegate.h" #include "brightray/browser/default_web_contents_delegate.h"
#include "brightray/browser/inspectable_web_contents_impl.h" #include "brightray/browser/inspectable_web_contents_impl.h"
#include "brightray/browser/inspectable_web_contents_delegate.h" #include "brightray/browser/inspectable_web_contents_delegate.h"
#include "brightray/browser/inspectable_web_contents_view_delegate.h"
namespace atom { namespace atom {
@ -21,7 +22,8 @@ class WebDialogHelper;
class CommonWebContentsDelegate class CommonWebContentsDelegate
: public brightray::DefaultWebContentsDelegate, : public brightray::DefaultWebContentsDelegate,
public brightray::InspectableWebContentsDelegate { public brightray::InspectableWebContentsDelegate,
public brightray::InspectableWebContentsViewDelegate {
public: public:
CommonWebContentsDelegate(); CommonWebContentsDelegate();
virtual ~CommonWebContentsDelegate(); virtual ~CommonWebContentsDelegate();
@ -32,6 +34,8 @@ class CommonWebContentsDelegate
// Set the window as owner window. // Set the window as owner window.
void SetOwnerWindow(NativeWindow* owner_window); void SetOwnerWindow(NativeWindow* owner_window);
void SetOwnerWindow(content::WebContents* web_contents,
NativeWindow* owner_window);
// Destroy the managed InspectableWebContents object. // Destroy the managed InspectableWebContents object.
void DestroyWebContents(); void DestroyWebContents();
@ -86,6 +90,15 @@ class CommonWebContentsDelegate
void DevToolsRemoveFileSystem( void DevToolsRemoveFileSystem(
const base::FilePath& file_system_path) override; const base::FilePath& file_system_path) override;
// brightray::InspectableWebContentsViewDelegate:
#if defined(TOOLKIT_VIEWS)
gfx::ImageSkia GetDevToolsWindowIcon() override;
#endif
#if defined(USE_X11)
void GetDevToolsWindowWMClass(
std::string* name, std::string* class_name) override;
#endif
private: private:
// Callback for when DevToolsSaveToFile has completed. // Callback for when DevToolsSaveToFile has completed.
void OnDevToolsSaveToFile(const std::string& url); void OnDevToolsSaveToFile(const std::string& url);

View file

@ -64,7 +64,9 @@ for packagePath in searchPaths
catch e catch e
continue continue
throw new Error("Unable to find a valid app") unless packageJson? unless packageJson?
process.nextTick -> process.exit 1
throw new Error("Unable to find a valid app")
# Set application's version. # Set application's version.
app.setVersion packageJson.version if packageJson.version? app.setVersion packageJson.version if packageJson.version?

View file

@ -106,16 +106,9 @@ ipc.on 'ATOM_BROWSER_GLOBAL', (event, name) ->
catch e catch e
event.returnValue = errorToMeta e event.returnValue = errorToMeta e
ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event, guestInstanceId) -> ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event) ->
try try
BrowserWindow = require 'browser-window' event.returnValue = valueToMeta event.sender, event.sender.getOwnerBrowserWindow()
if guestInstanceId?
guestViewManager = require './guest-view-manager'
window = BrowserWindow.fromWebContents guestViewManager.getEmbedder(guestInstanceId)
else
window = BrowserWindow.fromWebContents event.sender
window = BrowserWindow.fromDevToolsWebContents event.sender unless window?
event.returnValue = valueToMeta event.sender, window
catch e catch e
event.returnValue = errorToMeta e event.returnValue = errorToMeta e

View file

@ -76,8 +76,6 @@ NativeWindow::NativeWindow(
aspect_ratio_(0.0), aspect_ratio_(0.0),
inspectable_web_contents_(inspectable_web_contents), inspectable_web_contents_(inspectable_web_contents),
weak_factory_(this) { weak_factory_(this) {
inspectable_web_contents->GetView()->SetDelegate(this);
options.Get(switches::kFrame, &has_frame_); options.Get(switches::kFrame, &has_frame_);
options.Get(switches::kTransparent, &transparent_); options.Get(switches::kTransparent, &transparent_);
options.Get(switches::kEnableLargerThanScreen, &enable_larger_than_screen_); options.Get(switches::kEnableLargerThanScreen, &enable_larger_than_screen_);
@ -160,13 +158,8 @@ void NativeWindow::InitFromOptions(const mate::Dictionary& options) {
// Then show it. // Then show it.
bool show = true; bool show = true;
options.Get(switches::kShow, &show); options.Get(switches::kShow, &show);
if (show) { if (show)
Show(); Show();
} else {
// When RenderView is created it sets to visible, this is to prevent
// breaking the visibility API.
web_contents()->WasHidden();
}
} }
void NativeWindow::SetSize(const gfx::Size& size) { void NativeWindow::SetSize(const gfx::Size& size) {
@ -418,18 +411,6 @@ void NativeWindow::NotifyWindowExecuteWindowsCommand(
OnExecuteWindowsCommand(command)); OnExecuteWindowsCommand(command));
} }
void NativeWindow::DevToolsFocused() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnDevToolsFocus());
}
void NativeWindow::DevToolsOpened() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnDevToolsOpened());
}
void NativeWindow::DevToolsClosed() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnDevToolsClosed());
}
void NativeWindow::RenderViewCreated( void NativeWindow::RenderViewCreated(
content::RenderViewHost* render_view_host) { content::RenderViewHost* render_view_host) {
if (!transparent_) if (!transparent_)

View file

@ -15,7 +15,7 @@
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "brightray/browser/inspectable_web_contents_view_delegate.h" #include "base/supports_user_data.h"
#include "content/public/browser/readback_types.h" #include "content/public/browser/readback_types.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h" #include "content/public/browser/web_contents_user_data.h"
@ -50,8 +50,8 @@ namespace atom {
struct DraggableRegion; struct DraggableRegion;
class NativeWindow : public content::WebContentsObserver, class NativeWindow : public base::SupportsUserData,
public brightray::InspectableWebContentsViewDelegate { public content::WebContentsObserver {
public: public:
using CapturePageCallback = base::Callback<void(const SkBitmap& bitmap)>; using CapturePageCallback = base::Callback<void(const SkBitmap& bitmap)>;
@ -234,11 +234,6 @@ class NativeWindow : public content::WebContentsObserver,
NativeWindow(brightray::InspectableWebContents* inspectable_web_contents, NativeWindow(brightray::InspectableWebContents* inspectable_web_contents,
const mate::Dictionary& options); const mate::Dictionary& options);
// brightray::InspectableWebContentsViewDelegate:
void DevToolsFocused() override;
void DevToolsOpened() override;
void DevToolsClosed() override;
// content::WebContentsObserver: // content::WebContentsObserver:
void RenderViewCreated(content::RenderViewHost* render_view_host) override; void RenderViewCreated(content::RenderViewHost* render_view_host) override;
void BeforeUnloadDialogCancelled() override; void BeforeUnloadDialogCancelled() override;

View file

@ -470,8 +470,6 @@ bool NativeWindowMac::IsFocused() {
} }
void NativeWindowMac::Show() { void NativeWindowMac::Show() {
web_contents()->WasShown();
// This method is supposed to put focus on window, however if the app does not // This method is supposed to put focus on window, however if the app does not
// have focus then "makeKeyAndOrderFront" will only show the window. // have focus then "makeKeyAndOrderFront" will only show the window.
[NSApp activateIgnoringOtherApps:YES]; [NSApp activateIgnoringOtherApps:YES];
@ -480,13 +478,11 @@ void NativeWindowMac::Show() {
} }
void NativeWindowMac::ShowInactive() { void NativeWindowMac::ShowInactive() {
web_contents()->WasShown();
[window_ orderFrontRegardless]; [window_ orderFrontRegardless];
} }
void NativeWindowMac::Hide() { void NativeWindowMac::Hide() {
[window_ orderOut:nil]; [window_ orderOut:nil];
web_contents()->WasHidden();
} }
bool NativeWindowMac::IsVisible() { bool NativeWindowMac::IsVisible() {

View file

@ -55,11 +55,6 @@ class NativeWindowObserver {
virtual void OnWindowEnterHtmlFullScreen() {} virtual void OnWindowEnterHtmlFullScreen() {}
virtual void OnWindowLeaveHtmlFullScreen() {} virtual void OnWindowLeaveHtmlFullScreen() {}
// Redirect devtools events.
virtual void OnDevToolsFocus() {}
virtual void OnDevToolsOpened() {}
virtual void OnDevToolsClosed() {}
// Called when renderer is hung. // Called when renderer is hung.
virtual void OnRendererUnresponsive() {} virtual void OnRendererUnresponsive() {}

View file

@ -343,17 +343,14 @@ bool NativeWindowViews::IsFocused() {
} }
void NativeWindowViews::Show() { void NativeWindowViews::Show() {
web_contents()->WasShown();
window_->native_widget_private()->ShowWithWindowState(GetRestoredState()); window_->native_widget_private()->ShowWithWindowState(GetRestoredState());
} }
void NativeWindowViews::ShowInactive() { void NativeWindowViews::ShowInactive() {
web_contents()->WasShown();
window_->ShowInactive(); window_->ShowInactive();
} }
void NativeWindowViews::Hide() { void NativeWindowViews::Hide() {
window_->Hide();
web_contents()->WasHidden(); web_contents()->WasHidden();
} }
@ -823,18 +820,6 @@ bool NativeWindowViews::ExecuteWindowsCommand(int command_id) {
} }
#endif #endif
gfx::ImageSkia NativeWindowViews::GetDevToolsWindowIcon() {
return GetWindowAppIcon();
}
#if defined(USE_X11)
void NativeWindowViews::GetDevToolsWindowWMClass(
std::string* name, std::string* class_name) {
*class_name = Browser::Get()->GetName();
*name = base::StringToLowerASCII(*class_name);
}
#endif
#if defined(OS_WIN) #if defined(OS_WIN)
bool NativeWindowViews::PreHandleMSG( bool NativeWindowViews::PreHandleMSG(
UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) { UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) {

View file

@ -131,13 +131,6 @@ class NativeWindowViews : public NativeWindow,
bool ExecuteWindowsCommand(int command_id) override; bool ExecuteWindowsCommand(int command_id) override;
#endif #endif
// brightray::InspectableWebContentsViewDelegate:
gfx::ImageSkia GetDevToolsWindowIcon() override;
#if defined(USE_X11)
void GetDevToolsWindowWMClass(
std::string* name, std::string* class_name) override;
#endif
#if defined(OS_WIN) #if defined(OS_WIN)
// MessageHandlerDelegate: // MessageHandlerDelegate:
bool PreHandleMSG( bool PreHandleMSG(

View file

@ -17,7 +17,7 @@
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string>atom.icns</string> <string>atom.icns</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>0.33.3</string> <string>0.33.4</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>10.8.0</string> <string>10.8.0</string>
<key>NSMainNibFile</key> <key>NSMainNibFile</key>

View file

@ -56,8 +56,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,33,3,0 FILEVERSION 0,33,4,0
PRODUCTVERSION 0,33,3,0 PRODUCTVERSION 0,33,4,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -74,12 +74,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "GitHub, Inc." VALUE "CompanyName", "GitHub, Inc."
VALUE "FileDescription", "Electron" VALUE "FileDescription", "Electron"
VALUE "FileVersion", "0.33.3" VALUE "FileVersion", "0.33.4"
VALUE "InternalName", "electron.exe" VALUE "InternalName", "electron.exe"
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved." VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
VALUE "OriginalFilename", "electron.exe" VALUE "OriginalFilename", "electron.exe"
VALUE "ProductName", "Electron" VALUE "ProductName", "Electron"
VALUE "ProductVersion", "0.33.3" VALUE "ProductVersion", "0.33.4"
VALUE "SquirrelAwareVersion", "1" VALUE "SquirrelAwareVersion", "1"
END END
END END

View file

@ -7,7 +7,7 @@
#define ATOM_MAJOR_VERSION 0 #define ATOM_MAJOR_VERSION 0
#define ATOM_MINOR_VERSION 33 #define ATOM_MINOR_VERSION 33
#define ATOM_PATCH_VERSION 3 #define ATOM_PATCH_VERSION 4
#define ATOM_VERSION_IS_RELEASE 1 #define ATOM_VERSION_IS_RELEASE 1

View file

@ -130,7 +130,7 @@ exports.require = (module) ->
windowCache = null windowCache = null
exports.getCurrentWindow = -> exports.getCurrentWindow = ->
return windowCache if windowCache? return windowCache if windowCache?
meta = ipc.sendSync 'ATOM_BROWSER_CURRENT_WINDOW', process.guestInstanceId meta = ipc.sendSync 'ATOM_BROWSER_CURRENT_WINDOW'
windowCache = metaToValue meta windowCache = metaToValue meta
# Get current WebContents object. # Get current WebContents object.

View file

@ -44,7 +44,7 @@ createMenu = (x, y, items, document) ->
showFileChooserDialog = (callback) -> showFileChooserDialog = (callback) ->
remote = require 'remote' remote = require 'remote'
dialog = remote.require 'dialog' dialog = remote.require 'dialog'
files = dialog.showOpenDialog remote.getCurrentWindow(), null files = dialog.showOpenDialog {}
callback pathToHtml5FileObject files[0] if files? callback pathToHtml5FileObject files[0] if files?
pathToHtml5FileObject = (path) -> pathToHtml5FileObject = (path) ->

View file

@ -122,3 +122,7 @@ window.history.go = (offset) -> sendHistoryOperation 'goToOffset', offset
Object.defineProperty window.history, 'length', Object.defineProperty window.history, 'length',
get: -> get: ->
getHistoryOperation 'length' getHistoryOperation 'length'
# Make document.hidden return the correct value.
Object.defineProperty document, 'hidden',
get: -> !remote.getCurrentWindow().isVisible()

View file

@ -46,6 +46,7 @@ class WebViewImpl
# that we don't end up allocating a second guest. # that we don't end up allocating a second guest.
if @guestInstanceId if @guestInstanceId
guestViewInternal.destroyGuest @guestInstanceId guestViewInternal.destroyGuest @guestInstanceId
@webContents = null
@guestInstanceId = undefined @guestInstanceId = undefined
@beforeFirstNavigation = true @beforeFirstNavigation = true
@attributes[webViewConstants.ATTRIBUTE_PARTITION].validPartitionId = true @attributes[webViewConstants.ATTRIBUTE_PARTITION].validPartitionId = true
@ -188,6 +189,7 @@ class WebViewImpl
attachWindow: (guestInstanceId) -> attachWindow: (guestInstanceId) ->
@guestInstanceId = guestInstanceId @guestInstanceId = guestInstanceId
@webContents = remote.getGuestWebContents @guestInstanceId
return true unless @internalInstanceId return true unless @internalInstanceId
guestViewInternal.attachGuest @internalInstanceId, @guestInstanceId, @buildParams() guestViewInternal.attachGuest @internalInstanceId, @guestInstanceId, @buildParams()
@ -299,7 +301,7 @@ registerWebViewElement = ->
createHandler = (m) -> createHandler = (m) ->
(args...) -> (args...) ->
internal = v8Util.getHiddenValue this, 'internal' internal = v8Util.getHiddenValue this, 'internal'
remote.getGuestWebContents(internal.guestInstanceId)[m] args... internal.webContents[m] args...
proto[m] = createHandler m for m in methods proto[m] = createHandler m for m in methods
window.WebView = webFrame.registerEmbedderCustomElement 'webview', window.WebView = webFrame.registerEmbedderCustomElement 'webview',

View file

@ -1,5 +1,6 @@
## Guides ## Guides
* [Supported Platforms](tutorial/supported-platforms.md)
* [Application Distribution](tutorial/application-distribution.md) * [Application Distribution](tutorial/application-distribution.md)
* [Application Packaging](tutorial/application-packaging.md) * [Application Packaging](tutorial/application-packaging.md)
* [Using Native Node Modules](tutorial/using-native-node-modules.md) * [Using Native Node Modules](tutorial/using-native-node-modules.md)

View file

@ -24,14 +24,13 @@ You can also create a window without chrome by using
[EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter). [EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter).
It creates a new `BrowserWindow` with native properties as set by the `options`. It creates a new `BrowserWindow` with native properties as set by the `options`.
Properties `width` and `height` are required.
### `new BrowserWindow(options)` ### `new BrowserWindow(options)`
`options` Object, properties: `options` Object, properties:
* `width` Integer (**required**) - Window's width. * `width` Integer - Window's width.
* `height` Integer (**required**) - Window's height. * `height` Integer - Window's height.
* `x` Integer - Window's left offset from screen. * `x` Integer - Window's left offset from screen.
* `y` Integer - Window's top offset from screen. * `y` Integer - Window's top offset from screen.
* `use-content-size` Boolean - The `width` and `height` would be used as web * `use-content-size` Boolean - The `width` and `height` would be used as web
@ -232,18 +231,6 @@ Emitted when the window enters full screen state triggered by html api.
Emitted when the window leaves full screen state triggered by html api. Emitted when the window leaves full screen state triggered by html api.
### Event: 'devtools-opened'
Emitted when DevTools is opened.
### Event: 'devtools-closed'
Emitted when DevTools is closed.
### Event: 'devtools-focused'
Emitted when DevTools is focused / opened.
### Event: 'app-command': ### Event: 'app-command':
Emitted when an [App Command](https://msdn.microsoft.com/en-us/library/windows/desktop/ms646275(v=vs.85).aspx) Emitted when an [App Command](https://msdn.microsoft.com/en-us/library/windows/desktop/ms646275(v=vs.85).aspx)
@ -318,16 +305,6 @@ operations will be done via it.
See the [`webContents` documentation](web-contents.md) for its methods and See the [`webContents` documentation](web-contents.md) for its methods and
events. events.
**Note:** Users should never store this object because it may become `null`
when the renderer process (web page) has crashed.
### `win.devToolsWebContents`
Get the `WebContents` of DevTools for this window.
**Note:** Users should never store this object because it may become `null`
when the DevTools has been closed.
### `win.id` ### `win.id`
The unique ID of this window. The unique ID of this window.
@ -596,41 +573,6 @@ bar will become grey when set to `true`.
Whether the window's document has been edited. Whether the window's document has been edited.
### `win.openDevTools([options])`
* `options` Object (optional). Properties:
* `detach` Boolean - opens DevTools in a new window
Opens the developer tools.
### `win.closeDevTools()`
Closes the developer tools.
### `win.isDevToolsOpened()`
Returns whether the developer tools are opened.
### `win.toggleDevTools()`
Toggles the developer tools.
### `win.isDevToolsFocused()`
Returns whether the developer tools is focused.
### `win.inspectElement(x, y)`
* `x` Integer
* `y` Integer
Starts inspecting element at position (`x`, `y`).
### `win.inspectServiceWorker()`
Opens the developer tools for the service worker context present in the web
contents.
### `win.focusOnWebView()` ### `win.focusOnWebView()`
### `win.blurWebView()` ### `win.blurWebView()`

View file

@ -89,15 +89,21 @@ Enables net log events to be saved and writes them to `path`.
## --ssl-version-fallback-min=`version` ## --ssl-version-fallback-min=`version`
Set the minimum SSL/TLS version ("tls1", "tls1.1" or "tls1.2") that TLS Sets the minimum SSL/TLS version ("tls1", "tls1.1" or "tls1.2") that TLS
fallback will accept. fallback will accept.
## --enable-logging
Prints Chromium's logging into console.
This switch can not be used in `app.commandLine.appendSwitch` since it is parsed earlier than user's app is loaded.
## --v=`log_level` ## --v=`log_level`
Gives the default maximal active V-logging level; 0 is the default. Normally Gives the default maximal active V-logging level; 0 is the default. Normally
positive values are used for V-logging levels. positive values are used for V-logging levels.
Passing `--v=-1` will disable logging. This switch only works when `--enable-logging` is also passed.
## --vmodule=`pattern` ## --vmodule=`pattern`
@ -109,10 +115,4 @@ Any pattern containing a forward or backward slash will be tested against the
whole pathname and not just the module. E.g. `*/foo/bar/*=2` would change the whole pathname and not just the module. E.g. `*/foo/bar/*=2` would change the
logging level for all code in the source files under a `foo/bar` directory. logging level for all code in the source files under a `foo/bar` directory.
To disable all chromium related logs and only enable your application logs you This switch only works when `--enable-logging` is also passed.
can do:
```javascript
app.commandLine.appendSwitch('v', -1);
app.commandLine.appendSwitch('vmodule', 'console=0');
```

View file

@ -1,6 +1,6 @@
# MenuItem # MenuItem
The `menu-item` module allows you to add items to an application or content The `menu-item` module allows you to add items to an application or context
[`menu`](menu.md). [`menu`](menu.md).
See [`menu`](menu.md) for examples. See [`menu`](menu.md) for examples.

View file

@ -237,9 +237,9 @@ Generally, the `template` is just an array of `options` for constructing a
You can also attach other fields to the element of the `template` and they You can also attach other fields to the element of the `template` and they
will become properties of the constructed menu items. will become properties of the constructed menu items.
### `Menu.popup(browserWindow[, x, y])` ### `Menu.popup([browserWindow, x, y])`
* `browserWindow` BrowserWindow * `browserWindow` BrowserWindow (optional)
* `x` Number (optional) * `x` Number (optional)
* `y` Number (**required** if `x` is used) * `y` Number (**required** if `x` is used)

View file

@ -154,6 +154,18 @@ Emitted when a plugin process has crashed.
Emitted when `webContents` is destroyed. Emitted when `webContents` is destroyed.
### Event: 'devtools-opened'
Emitted when DevTools is opened.
### Event: 'devtools-closed'
Emitted when DevTools is closed.
### Event: 'devtools-focused'
Emitted when DevTools is focused / opened.
## Instance Methods ## Instance Methods
The `webContents` object has the following instance methods: The `webContents` object has the following instance methods:
@ -441,6 +453,40 @@ Adds the specified path to DevTools workspace.
Removes the specified path from DevTools workspace. Removes the specified path from DevTools workspace.
### `webContents.openDevTools([options])`
* `options` Object (optional). Properties:
* `detach` Boolean - opens DevTools in a new window
Opens the developer tools.
### `webContents.closeDevTools()`
Closes the developer tools.
### `webContents.isDevToolsOpened()`
Returns whether the developer tools are opened.
### `webContents.toggleDevTools()`
Toggles the developer tools.
### `webContents.isDevToolsFocused()`
Returns whether the developer tools is focused.
### `webContents.inspectElement(x, y)`
* `x` Integer
* `y` Integer
Starts inspecting element at position (`x`, `y`).
### `webContents.inspectServiceWorker()`
Opens the developer tools for the service worker context.
### `webContents.send(channel[, args...])` ### `webContents.send(channel[, args...])`
* `channel` String * `channel` String
@ -574,3 +620,14 @@ is in 32bit ARGB format).
### `webContents.endFrameSubscription()` ### `webContents.endFrameSubscription()`
End subscribing for frame presentation events. End subscribing for frame presentation events.
## Instance Properties
`WebContents` objects also have the following properties:
### `webContents.devToolsWebContents`
Get the `WebContents` of DevTools for this `WebContents`.
**Note:** Users should never store this object because it may become `null`
when the DevTools has been closed.

View file

@ -0,0 +1,23 @@
# Supported Platforms
Following platforms are supported by Electron:
### OS X
Only 64bit binaries are provided for OS X, and the minimum OS X version supported is OS X 10.8.
### Windows
Windows 7 and later are supported, Electron should be able to run on Windows Vista, but there is no testing done on it.
Both `x86` and `x64` binaries are provided for Windows, and `ARM` version of Windows is not supported for now.
### Linux
The prebuilt `ia32`(`i686`) and `x64`(`amd64`) binaries of Electron are built on Ubuntu 12.04, the `arm` binary is built against ARM v7 with hard-float ABI and NEON for Debian Wheezy.
Whether the prebuilt binary can run on a distribution depends on whether the distribution includes the libraries that Electron is linked to on the building platform, so only Ubuntu 12.04 is guaranteed to work, but following platforms are also verified to be able to run the prebuilt binaries of Electron:
* Ubuntu 12.04 and later
* Fedora 21
* Debian 8

View file

@ -74,7 +74,7 @@ driver.
First you need to download the `chromedriver` binary, and run it: First you need to download the `chromedriver` binary, and run it:
```bash ```bash
$ chromedriver --url-base=/wd/hub --port=9515 $ chromedriver --url-base=wd/hub --port=9515
Starting ChromeDriver (v2.10.291558) on port 9515 Starting ChromeDriver (v2.10.291558) on port 9515
Only local connections are allowed. Only local connections are allowed.
``` ```

View file

@ -129,6 +129,8 @@
'atom/browser/atom_javascript_dialog_manager.h', 'atom/browser/atom_javascript_dialog_manager.h',
'atom/browser/atom_quota_permission_context.cc', 'atom/browser/atom_quota_permission_context.cc',
'atom/browser/atom_quota_permission_context.h', 'atom/browser/atom_quota_permission_context.h',
'atom/browser/atom_resource_dispatcher_host_delegate.cc',
'atom/browser/atom_resource_dispatcher_host_delegate.h',
'atom/browser/atom_speech_recognition_manager_delegate.cc', 'atom/browser/atom_speech_recognition_manager_delegate.cc',
'atom/browser/atom_speech_recognition_manager_delegate.h', 'atom/browser/atom_speech_recognition_manager_delegate.h',
'atom/browser/atom_ssl_config_service.cc', 'atom/browser/atom_ssl_config_service.cc',

2
vendor/brightray vendored

@ -1 +1 @@
Subproject commit 75f7d3fd88ae60026a0717b93e3bf7182f827dc3 Subproject commit 6cbb4ad4d173d25b66eecf675c2b25ee64196429