mirror of
https://github.com/electron/electron.git
synced 2026-02-26 03:01:17 -05:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96b23830cd | ||
|
|
b0b5d1b1b0 | ||
|
|
b994ae8174 | ||
|
|
6f4aed83f0 | ||
|
|
d654afde5f | ||
|
|
5c5cf3c66e | ||
|
|
84d458687a | ||
|
|
2ab5d6e35a | ||
|
|
d6079782d1 | ||
|
|
e576d4c014 | ||
|
|
a16ea1fbf2 | ||
|
|
f0d9ee4ca9 | ||
|
|
538bd1116d | ||
|
|
5ead4f655a | ||
|
|
b975d4c41f | ||
|
|
cca0d8d583 | ||
|
|
d7a54cf3a6 | ||
|
|
a50d3bde5c |
@@ -73,16 +73,6 @@ void App::Quit(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
Browser::Get()->Quit();
|
||||
}
|
||||
|
||||
// static
|
||||
void App::Exit(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
exit(args[0]->IntegerValue());
|
||||
}
|
||||
|
||||
// static
|
||||
void App::Terminate(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
Browser::Get()->Terminate();
|
||||
}
|
||||
|
||||
// static
|
||||
void App::Focus(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
Browser::Get()->Focus();
|
||||
@@ -185,8 +175,6 @@ void App::Initialize(v8::Handle<v8::Object> target) {
|
||||
t->SetClassName(v8::String::NewSymbol("Application"));
|
||||
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "quit", Quit);
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "exit", Exit);
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "terminate", Terminate);
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "focus", Focus);
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "getVersion", GetVersion);
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "setVersion", SetVersion);
|
||||
|
||||
@@ -39,8 +39,6 @@ class App : public EventEmitter,
|
||||
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
|
||||
static void Quit(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void Exit(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void Terminate(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void Focus(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void GetVersion(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void SetVersion(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
|
||||
@@ -516,6 +516,18 @@ void Window::GetDevTools(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
args.GetReturnValue().Set(devtools);
|
||||
}
|
||||
|
||||
// static
|
||||
void Window::ExecuteJavaScriptInDevTools(
|
||||
const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
UNWRAP_WINDOW_AND_CHECK;
|
||||
|
||||
std::string code;
|
||||
if (!FromV8Arguments(args, &code))
|
||||
return node::ThrowTypeError("Bad argument");
|
||||
|
||||
self->window_->ExecuteJavaScriptInDevTools(code);
|
||||
}
|
||||
|
||||
// static
|
||||
void Window::LoadURL(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
UNWRAP_WINDOW_AND_CHECK;
|
||||
@@ -700,6 +712,8 @@ void Window::Initialize(v8::Handle<v8::Object> target) {
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "isCrashed", IsCrashed);
|
||||
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "getDevTools", GetDevTools);
|
||||
NODE_SET_PROTOTYPE_METHOD(
|
||||
t, "executeJavaScriptInDevTools", ExecuteJavaScriptInDevTools);
|
||||
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "loadUrl", LoadURL);
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "getUrl", GetURL);
|
||||
|
||||
@@ -105,6 +105,8 @@ class Window : public EventEmitter,
|
||||
|
||||
// APIs for devtools.
|
||||
static void GetDevTools(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void ExecuteJavaScriptInDevTools(
|
||||
const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
|
||||
// APIs for NavigationController.
|
||||
static void LoadURL(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
|
||||
@@ -27,8 +27,10 @@ if process.platform is 'darwin'
|
||||
setBadge: bindings.dockSetBadgeText
|
||||
getBadge: bindings.dockGetBadgeText
|
||||
|
||||
# Support old event name.
|
||||
# Be compatible with old API.
|
||||
app.once 'ready', -> app.emit 'finish-launching'
|
||||
app.terminate = app.quit
|
||||
app.exit = process.exit
|
||||
|
||||
# Only one App object pemitted.
|
||||
module.exports = app
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
} else {
|
||||
// System started termination.
|
||||
atom::Browser::Get()->Quit();
|
||||
return NSTerminateLater;
|
||||
return NSTerminateCancel;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "atom/browser/atom_browser_main_parts.h"
|
||||
#include "atom/browser/window_list.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
@@ -30,11 +31,16 @@ void Browser::Quit() {
|
||||
|
||||
atom::WindowList* window_list = atom::WindowList::GetInstance();
|
||||
if (window_list->size() == 0)
|
||||
NotifyAndTerminate();
|
||||
NotifyAndShutdown();
|
||||
|
||||
window_list->CloseAllWindows();
|
||||
}
|
||||
|
||||
void Browser::Shutdown() {
|
||||
is_quiting_ = true;
|
||||
base::MessageLoop::current()->Quit();
|
||||
}
|
||||
|
||||
std::string Browser::GetVersion() const {
|
||||
if (version_override_.empty()) {
|
||||
std::string version = GetExecutableFileVersion();
|
||||
@@ -88,7 +94,7 @@ void Browser::DidFinishLaunching() {
|
||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnFinishLaunching());
|
||||
}
|
||||
|
||||
void Browser::NotifyAndTerminate() {
|
||||
void Browser::NotifyAndShutdown() {
|
||||
bool prevent_default = false;
|
||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWillQuit(&prevent_default));
|
||||
|
||||
@@ -97,22 +103,19 @@ void Browser::NotifyAndTerminate() {
|
||||
return;
|
||||
}
|
||||
|
||||
Terminate();
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
void Browser::OnWindowCloseCancelled(NativeWindow* window) {
|
||||
if (is_quiting_) {
|
||||
if (is_quiting_)
|
||||
// Once a beforeunload handler has prevented the closing, we think the quit
|
||||
// is cancelled too.
|
||||
is_quiting_ = false;
|
||||
|
||||
CancelQuit();
|
||||
}
|
||||
}
|
||||
|
||||
void Browser::OnWindowAllClosed() {
|
||||
if (is_quiting_)
|
||||
NotifyAndTerminate();
|
||||
NotifyAndShutdown();
|
||||
else
|
||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWindowAllClosed());
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ class Browser : public WindowListObserver {
|
||||
// Try to close all windows and quit the application.
|
||||
void Quit();
|
||||
|
||||
// Quit the application immediately without cleanup work.
|
||||
void Terminate();
|
||||
// Cleanup everything and shutdown the application gracefully.
|
||||
void Shutdown();
|
||||
|
||||
// Focus the application.
|
||||
void Focus();
|
||||
@@ -88,11 +88,8 @@ class Browser : public WindowListObserver {
|
||||
// Returns the name of application bundle or executable file.
|
||||
std::string GetExecutableFileProductName() const;
|
||||
|
||||
// Send the will-quit message and then terminate the application.
|
||||
void NotifyAndTerminate();
|
||||
|
||||
// Tell the system we have cancelled quiting.
|
||||
void CancelQuit();
|
||||
// Send the will-quit message and then shutdown the application.
|
||||
void NotifyAndShutdown();
|
||||
|
||||
bool is_quiting_;
|
||||
|
||||
|
||||
@@ -12,11 +12,6 @@
|
||||
|
||||
namespace atom {
|
||||
|
||||
void Browser::Terminate() {
|
||||
is_quiting_ = true;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void Browser::Focus() {
|
||||
// Focus on the first visible window.
|
||||
WindowList* list = WindowList::GetInstance();
|
||||
@@ -37,8 +32,4 @@ std::string Browser::GetExecutableFileProductName() const {
|
||||
return "Atom-Shell";
|
||||
}
|
||||
|
||||
void Browser::CancelQuit() {
|
||||
// No way to cancel quit on Linux.
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
||||
@@ -10,11 +10,6 @@
|
||||
|
||||
namespace atom {
|
||||
|
||||
void Browser::Terminate() {
|
||||
is_quiting_ = true;
|
||||
[[AtomApplication sharedApplication] terminate:nil];
|
||||
}
|
||||
|
||||
void Browser::Focus() {
|
||||
[[AtomApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||
}
|
||||
@@ -31,10 +26,6 @@ std::string Browser::GetExecutableFileProductName() const {
|
||||
return base::SysNSStringToUTF8(version);
|
||||
}
|
||||
|
||||
void Browser::CancelQuit() {
|
||||
[[AtomApplication sharedApplication] replyToApplicationShouldTerminate:NO];
|
||||
}
|
||||
|
||||
int Browser::DockBounce(BounceType type) {
|
||||
return [[AtomApplication sharedApplication] requestUserAttention:type];
|
||||
}
|
||||
|
||||
@@ -33,11 +33,6 @@ BOOL CALLBACK WindowsEnumerationHandler(HWND hwnd, LPARAM param) {
|
||||
|
||||
} // namespace
|
||||
|
||||
void Browser::Terminate() {
|
||||
is_quiting_ = true;
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
|
||||
void Browser::Focus() {
|
||||
// On Windows we just focus on the first window found for this process.
|
||||
DWORD pid = GetCurrentProcessId();
|
||||
@@ -66,8 +61,4 @@ std::string Browser::GetExecutableFileProductName() const {
|
||||
return "Atom-Shell";
|
||||
}
|
||||
|
||||
void Browser::CancelQuit() {
|
||||
// TODO(zcbenz): Research on how to cancel shutdown in Windows.
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
||||
@@ -10,7 +10,7 @@ var menu = null;
|
||||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', function() {
|
||||
app.terminate();
|
||||
app.quit();
|
||||
});
|
||||
|
||||
app.on('open-url', function(event, url) {
|
||||
|
||||
@@ -225,6 +225,11 @@ void NativeWindow::InspectElement(int x, int y) {
|
||||
agent->InspectElement(x, y);
|
||||
}
|
||||
|
||||
void NativeWindow::ExecuteJavaScriptInDevTools(const std::string& script) {
|
||||
GetDevToolsWebContents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
|
||||
string16(), base::UTF8ToUTF16(script));
|
||||
}
|
||||
|
||||
void NativeWindow::FocusOnWebView() {
|
||||
GetWebContents()->GetRenderViewHost()->Focus();
|
||||
}
|
||||
@@ -308,8 +313,7 @@ void NativeWindow::CloseWebContents() {
|
||||
// not closed in 5000ms, in this way we can quickly show the unresponsive
|
||||
// dialog when the window is busy executing some script withouth waiting for
|
||||
// the unresponsive timeout.
|
||||
if (!Browser::Get()->is_quiting() &&
|
||||
window_unresposive_closure_.IsCancelled())
|
||||
if (window_unresposive_closure_.IsCancelled())
|
||||
ScheduleUnresponsiveEvent(5000);
|
||||
|
||||
if (web_contents->NeedToFireBeforeUnload())
|
||||
@@ -361,6 +365,10 @@ void NativeWindow::NotifyWindowBlur() {
|
||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowBlur());
|
||||
}
|
||||
|
||||
void NativeWindow::DestroyWebContents() {
|
||||
inspectable_web_contents_.reset();
|
||||
}
|
||||
|
||||
// In atom-shell all reloads and navigations started by renderer process would
|
||||
// be redirected to this method, so we can have precise control of how we
|
||||
// would open the url (in our case, is to restart the renderer process). See
|
||||
@@ -612,10 +620,7 @@ void NativeWindow::CallDevToolsFunction(const std::string& function_name,
|
||||
}
|
||||
}
|
||||
}
|
||||
base::string16 javascript =
|
||||
base::ASCIIToUTF16(function_name + "(" + params + ");");
|
||||
GetDevToolsWebContents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
|
||||
string16(), javascript);
|
||||
ExecuteJavaScriptInDevTools(function_name + "(" + params + ");");
|
||||
}
|
||||
|
||||
void NativeWindow::OnRendererMessage(const string16& channel,
|
||||
|
||||
@@ -136,6 +136,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||
virtual void CloseDevTools();
|
||||
virtual bool IsDevToolsOpened();
|
||||
virtual void InspectElement(int x, int y);
|
||||
virtual void ExecuteJavaScriptInDevTools(const std::string& script);
|
||||
|
||||
virtual void FocusOnWebView();
|
||||
virtual void BlurWebView();
|
||||
@@ -195,6 +196,9 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||
void NotifyWindowClosed();
|
||||
void NotifyWindowBlur();
|
||||
|
||||
// Destroy the inspectable_web_contents.
|
||||
void DestroyWebContents();
|
||||
|
||||
// Called when the window needs to update its draggable region.
|
||||
virtual void UpdateDraggableRegions(
|
||||
const std::vector<DraggableRegion>& regions) = 0;
|
||||
@@ -303,6 +307,10 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||
scoped_ptr<DevToolsWebContentsObserver> devtools_web_contents_observer_;
|
||||
|
||||
scoped_ptr<AtomJavaScriptDialogManager> dialog_manager_;
|
||||
|
||||
// Notice that inspectable_web_contents_ must be placed after dialog_manager_,
|
||||
// so we can make sure inspectable_web_contents_ is destroyed before
|
||||
// dialog_manager_, otherwise a crash would happen.
|
||||
scoped_ptr<brightray::InspectableWebContents> inspectable_web_contents_;
|
||||
|
||||
// Maps url to file path, used by the file requests sent from devtools.
|
||||
|
||||
@@ -105,6 +105,8 @@ NativeWindowGtk::NativeWindowGtk(content::WebContents* web_contents,
|
||||
G_CALLBACK(OnWindowDeleteEventThunk), this);
|
||||
g_signal_connect(window_, "focus-out-event",
|
||||
G_CALLBACK(OnFocusOutThunk), this);
|
||||
g_signal_connect(window_, "window-state-event",
|
||||
G_CALLBACK(OnWindowStateThunk), this);
|
||||
|
||||
if (!has_frame_) {
|
||||
gtk_window_set_decorated(window_, false);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include "base/mac/scoped_nsobject.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "atom/browser/native_window.h"
|
||||
|
||||
@@ -68,7 +69,6 @@ class NativeWindowMac : public NativeWindow {
|
||||
// Clip web view to rounded corner.
|
||||
void ClipWebView();
|
||||
|
||||
NSWindow*& window() { return window_; }
|
||||
SkRegion* draggable_region() const { return draggable_region_.get(); }
|
||||
|
||||
protected:
|
||||
@@ -87,7 +87,7 @@ class NativeWindowMac : public NativeWindow {
|
||||
void UpdateDraggableRegionsForCustomDrag(
|
||||
const std::vector<DraggableRegion>& regions);
|
||||
|
||||
NSWindow* window_;
|
||||
base::scoped_nsobject<NSWindow> window_;
|
||||
|
||||
bool is_kiosk_;
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <string>
|
||||
|
||||
#include "base/mac/mac_util.h"
|
||||
#include "base/mac/scoped_nsobject.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "base/values.h"
|
||||
#import "atom/browser/ui/cocoa/event_processing_window.h"
|
||||
@@ -66,7 +65,6 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
|
||||
}
|
||||
|
||||
- (void)windowWillClose:(NSNotification*)notification {
|
||||
shell_->window() = nil;
|
||||
[self autorelease];
|
||||
}
|
||||
|
||||
@@ -171,11 +169,14 @@ NativeWindowMac::NativeWindowMac(content::WebContents* web_contents,
|
||||
defer:YES];
|
||||
|
||||
[atomWindow setShell:this];
|
||||
window_ = atomWindow;
|
||||
window_.reset(atomWindow);
|
||||
|
||||
AtomNSWindowDelegate* delegate =
|
||||
[[AtomNSWindowDelegate alloc] initWithShell:this];
|
||||
[window() setDelegate:delegate];
|
||||
[window_ setDelegate:delegate];
|
||||
|
||||
// We will manage window's lifetime ourselves.
|
||||
[window_ setReleasedWhenClosed:NO];
|
||||
|
||||
// Enable the NSView to accept first mouse event.
|
||||
bool acceptsFirstMouse = false;
|
||||
@@ -186,9 +187,9 @@ NativeWindowMac::NativeWindowMac(content::WebContents* web_contents,
|
||||
bool fullscreen;
|
||||
if (!(options->GetBoolean(switches::kFullscreen, &fullscreen) &&
|
||||
!fullscreen)) {
|
||||
NSUInteger collectionBehavior = [window() collectionBehavior];
|
||||
NSUInteger collectionBehavior = [window_ collectionBehavior];
|
||||
collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary;
|
||||
[window() setCollectionBehavior:collectionBehavior];
|
||||
[window_ setCollectionBehavior:collectionBehavior];
|
||||
}
|
||||
|
||||
NSView* view = inspectable_web_contents()->GetView()->GetNativeView();
|
||||
@@ -198,18 +199,18 @@ NativeWindowMac::NativeWindowMac(content::WebContents* web_contents,
|
||||
}
|
||||
|
||||
NativeWindowMac::~NativeWindowMac() {
|
||||
if (window())
|
||||
// Use autorelease since we may have delegates or observers at this time.
|
||||
[window() autorelease];
|
||||
// Force InspectableWebContents to be destroyed before we destroy window,
|
||||
// because it may still be observing the window at this time.
|
||||
DestroyWebContents();
|
||||
}
|
||||
|
||||
void NativeWindowMac::Close() {
|
||||
[window() performClose:nil];
|
||||
[window_ performClose:nil];
|
||||
}
|
||||
|
||||
void NativeWindowMac::CloseImmediately() {
|
||||
[window() orderOut:nil];
|
||||
[window() close];
|
||||
[window_ orderOut:nil];
|
||||
[window_ close];
|
||||
}
|
||||
|
||||
void NativeWindowMac::Move(const gfx::Rect& pos) {
|
||||
@@ -221,7 +222,7 @@ void NativeWindowMac::Move(const gfx::Rect& pos) {
|
||||
cocoa_bounds.origin.y =
|
||||
NSHeight([screen frame]) - pos.height() - pos.y();
|
||||
|
||||
[window() setFrame:cocoa_bounds display:YES];
|
||||
[window_ setFrame:cocoa_bounds display:YES];
|
||||
}
|
||||
|
||||
void NativeWindowMac::Focus(bool focus) {
|
||||
@@ -230,42 +231,42 @@ void NativeWindowMac::Focus(bool focus) {
|
||||
|
||||
if (focus) {
|
||||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||
[window() makeKeyAndOrderFront:nil];
|
||||
[window_ makeKeyAndOrderFront:nil];
|
||||
} else {
|
||||
[window() orderBack:nil];
|
||||
[window_ orderBack:nil];
|
||||
}
|
||||
}
|
||||
|
||||
bool NativeWindowMac::IsFocused() {
|
||||
return [window() isKeyWindow];
|
||||
return [window_ isKeyWindow];
|
||||
}
|
||||
|
||||
void NativeWindowMac::Show() {
|
||||
[window() makeKeyAndOrderFront:nil];
|
||||
[window_ makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
void NativeWindowMac::Hide() {
|
||||
[window() orderOut:nil];
|
||||
[window_ orderOut:nil];
|
||||
}
|
||||
|
||||
bool NativeWindowMac::IsVisible() {
|
||||
return [window() isVisible];
|
||||
return [window_ isVisible];
|
||||
}
|
||||
|
||||
void NativeWindowMac::Maximize() {
|
||||
[window() zoom:nil];
|
||||
[window_ zoom:nil];
|
||||
}
|
||||
|
||||
void NativeWindowMac::Unmaximize() {
|
||||
[window() zoom:nil];
|
||||
[window_ zoom:nil];
|
||||
}
|
||||
|
||||
void NativeWindowMac::Minimize() {
|
||||
[window() miniaturize:nil];
|
||||
[window_ miniaturize:nil];
|
||||
}
|
||||
|
||||
void NativeWindowMac::Restore() {
|
||||
[window() deminiaturize:nil];
|
||||
[window_ deminiaturize:nil];
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetFullscreen(bool fullscreen) {
|
||||
@@ -277,11 +278,11 @@ void NativeWindowMac::SetFullscreen(bool fullscreen) {
|
||||
return;
|
||||
}
|
||||
|
||||
[window() toggleFullScreen:nil];
|
||||
[window_ toggleFullScreen:nil];
|
||||
}
|
||||
|
||||
bool NativeWindowMac::IsFullscreen() {
|
||||
return [window() styleMask] & NSFullScreenWindowMask;
|
||||
return [window_ styleMask] & NSFullScreenWindowMask;
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetSize(const gfx::Size& size) {
|
||||
@@ -290,7 +291,7 @@ void NativeWindowMac::SetSize(const gfx::Size& size) {
|
||||
frame.size.width = size.width();
|
||||
frame.size.height = size.height();
|
||||
|
||||
[window() setFrame:frame display:YES];
|
||||
[window_ setFrame:frame display:YES];
|
||||
}
|
||||
|
||||
gfx::Size NativeWindowMac::GetSize() {
|
||||
@@ -300,54 +301,54 @@ gfx::Size NativeWindowMac::GetSize() {
|
||||
|
||||
void NativeWindowMac::SetMinimumSize(const gfx::Size& size) {
|
||||
NSSize min_size = NSMakeSize(size.width(), size.height());
|
||||
NSView* content = [window() contentView];
|
||||
[window() setContentMinSize:[content convertSize:min_size toView:nil]];
|
||||
NSView* content = [window_ contentView];
|
||||
[window_ setContentMinSize:[content convertSize:min_size toView:nil]];
|
||||
}
|
||||
|
||||
gfx::Size NativeWindowMac::GetMinimumSize() {
|
||||
NSView* content = [window() contentView];
|
||||
NSSize min_size = [content convertSize:[window() contentMinSize]
|
||||
NSView* content = [window_ contentView];
|
||||
NSSize min_size = [content convertSize:[window_ contentMinSize]
|
||||
fromView:nil];
|
||||
return gfx::Size(min_size.width, min_size.height);
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetMaximumSize(const gfx::Size& size) {
|
||||
NSSize max_size = NSMakeSize(size.width(), size.height());
|
||||
NSView* content = [window() contentView];
|
||||
[window() setContentMaxSize:[content convertSize:max_size toView:nil]];
|
||||
NSView* content = [window_ contentView];
|
||||
[window_ setContentMaxSize:[content convertSize:max_size toView:nil]];
|
||||
}
|
||||
|
||||
gfx::Size NativeWindowMac::GetMaximumSize() {
|
||||
NSView* content = [window() contentView];
|
||||
NSSize max_size = [content convertSize:[window() contentMaxSize]
|
||||
NSView* content = [window_ contentView];
|
||||
NSSize max_size = [content convertSize:[window_ contentMaxSize]
|
||||
fromView:nil];
|
||||
return gfx::Size(max_size.width, max_size.height);
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetResizable(bool resizable) {
|
||||
if (resizable) {
|
||||
[[window() standardWindowButton:NSWindowZoomButton] setEnabled:YES];
|
||||
[window() setStyleMask:window().styleMask | NSResizableWindowMask];
|
||||
[[window_ standardWindowButton:NSWindowZoomButton] setEnabled:YES];
|
||||
[window_ setStyleMask:[window_ styleMask] | NSResizableWindowMask];
|
||||
} else {
|
||||
[[window() standardWindowButton:NSWindowZoomButton] setEnabled:NO];
|
||||
[window() setStyleMask:window().styleMask ^ NSResizableWindowMask];
|
||||
[[window_ standardWindowButton:NSWindowZoomButton] setEnabled:NO];
|
||||
[window_ setStyleMask:[window_ styleMask] ^ NSResizableWindowMask];
|
||||
}
|
||||
}
|
||||
|
||||
bool NativeWindowMac::IsResizable() {
|
||||
return [window() styleMask] & NSResizableWindowMask;
|
||||
return [window_ styleMask] & NSResizableWindowMask;
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetAlwaysOnTop(bool top) {
|
||||
[window() setLevel:(top ? NSFloatingWindowLevel : NSNormalWindowLevel)];
|
||||
[window_ setLevel:(top ? NSFloatingWindowLevel : NSNormalWindowLevel)];
|
||||
}
|
||||
|
||||
bool NativeWindowMac::IsAlwaysOnTop() {
|
||||
return [window() level] == NSFloatingWindowLevel;
|
||||
return [window_ level] == NSFloatingWindowLevel;
|
||||
}
|
||||
|
||||
void NativeWindowMac::Center() {
|
||||
[window() center];
|
||||
[window_ center];
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetPosition(const gfx::Point& position) {
|
||||
@@ -363,11 +364,11 @@ gfx::Point NativeWindowMac::GetPosition() {
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetTitle(const std::string& title) {
|
||||
[window() setTitle:base::SysUTF8ToNSString(title)];
|
||||
[window_ setTitle:base::SysUTF8ToNSString(title)];
|
||||
}
|
||||
|
||||
std::string NativeWindowMac::GetTitle() {
|
||||
return base::SysNSStringToUTF8([window() title]);
|
||||
return base::SysNSStringToUTF8([window_ title]);
|
||||
}
|
||||
|
||||
void NativeWindowMac::FlashFrame(bool flash) {
|
||||
@@ -404,11 +405,11 @@ bool NativeWindowMac::IsKiosk() {
|
||||
}
|
||||
|
||||
bool NativeWindowMac::HasModalDialog() {
|
||||
return [window() attachedSheet] != nil;
|
||||
return [window_ attachedSheet] != nil;
|
||||
}
|
||||
|
||||
gfx::NativeWindow NativeWindowMac::GetNativeWindow() {
|
||||
return window();
|
||||
return window_;
|
||||
}
|
||||
|
||||
bool NativeWindowMac::IsWithinDraggableRegion(NSPoint point) const {
|
||||
@@ -424,15 +425,15 @@ bool NativeWindowMac::IsWithinDraggableRegion(NSPoint point) const {
|
||||
|
||||
void NativeWindowMac::HandleMouseEvent(NSEvent* event) {
|
||||
NSPoint current_mouse_location =
|
||||
[window() convertBaseToScreen:[event locationInWindow]];
|
||||
[window_ convertBaseToScreen:[event locationInWindow]];
|
||||
|
||||
if ([event type] == NSLeftMouseDown) {
|
||||
NSPoint frame_origin = [window() frame].origin;
|
||||
NSPoint frame_origin = [window_ frame].origin;
|
||||
last_mouse_offset_ = NSMakePoint(
|
||||
frame_origin.x - current_mouse_location.x,
|
||||
frame_origin.y - current_mouse_location.y);
|
||||
} else if ([event type] == NSLeftMouseDragged) {
|
||||
[window() setFrameOrigin:NSMakePoint(
|
||||
[window_ setFrameOrigin:NSMakePoint(
|
||||
current_mouse_location.x + last_mouse_offset_.x,
|
||||
current_mouse_location.y + last_mouse_offset_.y)];
|
||||
}
|
||||
@@ -456,7 +457,7 @@ void NativeWindowMac::HandleKeyboardEvent(
|
||||
return;
|
||||
|
||||
EventProcessingWindow* event_window =
|
||||
static_cast<EventProcessingWindow*>(window());
|
||||
static_cast<EventProcessingWindow*>(window_);
|
||||
DCHECK([event_window isKindOfClass:[EventProcessingWindow class]]);
|
||||
[event_window redispatchKeyEvent:event.os_event];
|
||||
}
|
||||
@@ -464,19 +465,19 @@ void NativeWindowMac::HandleKeyboardEvent(
|
||||
void NativeWindowMac::InstallView() {
|
||||
NSView* view = inspectable_web_contents()->GetView()->GetNativeView();
|
||||
if (has_frame_) {
|
||||
[view setFrame:[[window() contentView] bounds]];
|
||||
[[window() contentView] addSubview:view];
|
||||
[view setFrame:[[window_ contentView] bounds]];
|
||||
[[window_ contentView] addSubview:view];
|
||||
} else {
|
||||
NSView* frameView = [[window() contentView] superview];
|
||||
NSView* frameView = [[window_ contentView] superview];
|
||||
[view setFrame:[frameView bounds]];
|
||||
[frameView addSubview:view];
|
||||
|
||||
ClipWebView();
|
||||
|
||||
[[window() standardWindowButton:NSWindowZoomButton] setHidden:YES];
|
||||
[[window() standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES];
|
||||
[[window() standardWindowButton:NSWindowCloseButton] setHidden:YES];
|
||||
[[window() standardWindowButton:NSWindowFullScreenButton] setHidden:YES];
|
||||
[[window_ standardWindowButton:NSWindowZoomButton] setHidden:YES];
|
||||
[[window_ standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES];
|
||||
[[window_ standardWindowButton:NSWindowCloseButton] setHidden:YES];
|
||||
[[window_ standardWindowButton:NSWindowFullScreenButton] setHidden:YES];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>atom.icns</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.11.6</string>
|
||||
<string>0.11.10</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
||||
@@ -50,8 +50,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,11,6,0
|
||||
PRODUCTVERSION 0,11,6,0
|
||||
FILEVERSION 0,11,10,0
|
||||
PRODUCTVERSION 0,11,10,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -68,12 +68,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "GitHub, Inc."
|
||||
VALUE "FileDescription", "Atom-Shell"
|
||||
VALUE "FileVersion", "0.11.6"
|
||||
VALUE "FileVersion", "0.11.10"
|
||||
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.11.6"
|
||||
VALUE "ProductVersion", "0.11.10"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#define ATOM_MAJOR_VERSION 0
|
||||
#define ATOM_MINOR_VERSION 11
|
||||
#define ATOM_PATCH_VERSION 6
|
||||
#define ATOM_PATCH_VERSION 10
|
||||
|
||||
#define ATOM_VERSION_IS_RELEASE 1
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@
|
||||
'conditions': [
|
||||
['OS=="mac"', {
|
||||
'xcode_settings': {
|
||||
'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
|
||||
'WARNING_CFLAGS': [
|
||||
'-Wno-deprecated-declarations',
|
||||
'-Wno-unused-private-field',
|
||||
|
||||
@@ -334,6 +334,13 @@ Closes the developer tools.
|
||||
|
||||
Starts inspecting element at position (`x`, `y`).
|
||||
|
||||
### BrowserWindow.executeJavaScriptInDevTools(code)
|
||||
|
||||
* `code` String
|
||||
|
||||
Evaluate `code` in devtools to use
|
||||
[InspectorFrontendAPI](https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/devtools/front_end/InspectorFrontendAPI.js&q=InspectorFrontendAPI&sq=package:chromium&type=cs)
|
||||
|
||||
### BrowserWindow.focusOnWebView()
|
||||
|
||||
### BrowserWindow.blurWebView()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "atom-shell",
|
||||
"version": "0.11.6",
|
||||
"version": "0.11.10",
|
||||
|
||||
"devDependencies": {
|
||||
"coffee-script": "~1.6.3",
|
||||
|
||||
@@ -38,7 +38,7 @@ process.on('uncaughtException', function(error) {
|
||||
});
|
||||
|
||||
app.on('window-all-closed', function() {
|
||||
app.terminate();
|
||||
app.quit();
|
||||
});
|
||||
|
||||
app.on('ready', function() {
|
||||
|
||||
Reference in New Issue
Block a user