2013-04-14 07:36:48 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2013-04-15 15:01:12 +00:00
|
|
|
#ifndef ATOM_BROWSER_API_ATOM_API_WINDOW_H_
|
|
|
|
#define ATOM_BROWSER_API_ATOM_API_WINDOW_H_
|
2013-04-14 07:36:48 +00:00
|
|
|
|
2013-04-18 15:50:47 +00:00
|
|
|
#include "base/memory/scoped_ptr.h"
|
2013-04-15 16:25:08 +00:00
|
|
|
#include "browser/api/atom_api_event_emitter.h"
|
2013-04-18 15:50:47 +00:00
|
|
|
#include "browser/native_window_observer.h"
|
2013-04-15 16:25:08 +00:00
|
|
|
|
|
|
|
namespace base {
|
|
|
|
class DictionaryValue;
|
|
|
|
}
|
2013-04-14 07:36:48 +00:00
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
2013-04-15 16:25:08 +00:00
|
|
|
class NativeWindow;
|
|
|
|
|
|
|
|
namespace api {
|
|
|
|
|
2013-04-18 15:50:47 +00:00
|
|
|
class Window : public EventEmitter,
|
|
|
|
public NativeWindowObserver {
|
2013-04-15 16:25:08 +00:00
|
|
|
public:
|
|
|
|
virtual ~Window();
|
|
|
|
|
|
|
|
static void Initialize(v8::Handle<v8::Object> target);
|
|
|
|
|
|
|
|
NativeWindow* window() { return window_.get(); }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
explicit Window(v8::Handle<v8::Object> wrapper,
|
|
|
|
base::DictionaryValue* options);
|
|
|
|
|
2013-04-18 15:50:47 +00:00
|
|
|
// Implementations of NativeWindowObserver.
|
|
|
|
virtual void OnPageTitleUpdated(bool* prevent_default,
|
|
|
|
const std::string& title) OVERRIDE;
|
2013-05-01 15:28:01 +00:00
|
|
|
virtual void WillCloseWindow(bool* prevent_default) OVERRIDE;
|
|
|
|
virtual void OnWindowClosed() OVERRIDE;
|
2013-05-24 09:58:39 +00:00
|
|
|
virtual void OnWindowBlur() OVERRIDE;
|
2013-06-06 11:45:48 +00:00
|
|
|
virtual void OnRendererUnresponsive() OVERRIDE;
|
|
|
|
virtual void OnRendererResponsive() OVERRIDE;
|
2013-06-10 12:50:25 +00:00
|
|
|
virtual void OnRendererCrashed() OVERRIDE;
|
2013-04-18 15:50:47 +00:00
|
|
|
|
2013-04-15 16:25:08 +00:00
|
|
|
private:
|
|
|
|
static v8::Handle<v8::Value> New(const v8::Arguments &args);
|
2013-04-17 14:49:49 +00:00
|
|
|
static v8::Handle<v8::Value> Destroy(const v8::Arguments &args);
|
|
|
|
|
|
|
|
// APIs for NativeWindow.
|
|
|
|
static v8::Handle<v8::Value> Close(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> Focus(const v8::Arguments &args);
|
2013-05-16 14:56:52 +00:00
|
|
|
static v8::Handle<v8::Value> IsFocused(const v8::Arguments &args);
|
2013-04-17 14:49:49 +00:00
|
|
|
static v8::Handle<v8::Value> Show(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> Hide(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> Maximize(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> Unmaximize(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> Minimize(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> Restore(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> SetFullscreen(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> IsFullscreen(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> SetSize(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> GetSize(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> SetMinimumSize(const v8::Arguments &args);
|
2013-04-18 07:38:04 +00:00
|
|
|
static v8::Handle<v8::Value> GetMinimumSize(const v8::Arguments &args);
|
2013-04-17 14:49:49 +00:00
|
|
|
static v8::Handle<v8::Value> SetMaximumSize(const v8::Arguments &args);
|
2013-04-18 07:38:04 +00:00
|
|
|
static v8::Handle<v8::Value> GetMaximumSize(const v8::Arguments &args);
|
2013-04-17 14:49:49 +00:00
|
|
|
static v8::Handle<v8::Value> SetResizable(const v8::Arguments &args);
|
2013-04-18 07:38:04 +00:00
|
|
|
static v8::Handle<v8::Value> IsResizable(const v8::Arguments &args);
|
2013-04-17 14:49:49 +00:00
|
|
|
static v8::Handle<v8::Value> SetAlwaysOnTop(const v8::Arguments &args);
|
2013-04-18 07:38:04 +00:00
|
|
|
static v8::Handle<v8::Value> IsAlwaysOnTop(const v8::Arguments &args);
|
2013-05-10 12:34:05 +00:00
|
|
|
static v8::Handle<v8::Value> Center(const v8::Arguments &args);
|
2013-04-17 14:49:49 +00:00
|
|
|
static v8::Handle<v8::Value> SetPosition(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> GetPosition(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> SetTitle(const v8::Arguments &args);
|
2013-04-18 06:30:05 +00:00
|
|
|
static v8::Handle<v8::Value> GetTitle(const v8::Arguments &args);
|
2013-04-17 14:49:49 +00:00
|
|
|
static v8::Handle<v8::Value> FlashFrame(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> SetKiosk(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> IsKiosk(const v8::Arguments &args);
|
2013-05-10 12:34:05 +00:00
|
|
|
static v8::Handle<v8::Value> OpenDevTools(const v8::Arguments &args);
|
2013-04-17 14:49:49 +00:00
|
|
|
static v8::Handle<v8::Value> CloseDevTools(const v8::Arguments &args);
|
2013-07-18 11:21:25 +00:00
|
|
|
static v8::Handle<v8::Value> InspectElement(const v8::Arguments &args);
|
2013-05-24 09:51:15 +00:00
|
|
|
static v8::Handle<v8::Value> FocusOnWebView(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> BlurWebView(const v8::Arguments &args);
|
2013-06-07 10:42:57 +00:00
|
|
|
static v8::Handle<v8::Value> RestartHangMonitorTimeout(
|
|
|
|
const v8::Arguments &args);
|
2013-04-15 16:25:08 +00:00
|
|
|
|
2013-04-18 07:09:53 +00:00
|
|
|
// APIs for WebContents.
|
|
|
|
static v8::Handle<v8::Value> GetPageTitle(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> IsLoading(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> IsWaitingForResponse(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> Stop(const v8::Arguments &args);
|
2013-04-23 09:21:34 +00:00
|
|
|
static v8::Handle<v8::Value> GetRoutingID(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> GetProcessID(const v8::Arguments &args);
|
2013-06-10 12:50:25 +00:00
|
|
|
static v8::Handle<v8::Value> IsCrashed(const v8::Arguments &args);
|
2013-04-18 07:09:53 +00:00
|
|
|
|
|
|
|
// APIs for NavigationController.
|
|
|
|
static v8::Handle<v8::Value> LoadURL(const v8::Arguments &args);
|
2013-04-18 16:06:10 +00:00
|
|
|
static v8::Handle<v8::Value> GetURL(const v8::Arguments &args);
|
2013-04-18 07:09:53 +00:00
|
|
|
static v8::Handle<v8::Value> CanGoBack(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> CanGoForward(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> CanGoToOffset(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> GoBack(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> GoForward(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> GoToIndex(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> GoToOffset(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> Reload(const v8::Arguments &args);
|
|
|
|
static v8::Handle<v8::Value> ReloadIgnoringCache(const v8::Arguments &args);
|
|
|
|
|
2013-04-15 16:25:08 +00:00
|
|
|
scoped_ptr<NativeWindow> window_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(Window);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace api
|
|
|
|
|
2013-04-14 07:36:48 +00:00
|
|
|
} // namespace atom
|
|
|
|
|
2013-04-15 15:01:12 +00:00
|
|
|
#endif // ATOM_BROWSER_API_ATOM_API_WINDOW_H_
|