// 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. #ifndef ATOM_BROWSER_API_ATOM_API_WINDOW_H_ #define ATOM_BROWSER_API_ATOM_API_WINDOW_H_ #include "base/memory/scoped_ptr.h" #include "browser/api/atom_api_event_emitter.h" #include "browser/native_window_observer.h" namespace base { class DictionaryValue; } namespace atom { class NativeWindow; namespace api { class Window : public EventEmitter, public NativeWindowObserver { public: virtual ~Window(); static void Initialize(v8::Handle target); NativeWindow* window() { return window_.get(); } protected: explicit Window(v8::Handle wrapper, base::DictionaryValue* options); // Implementations of NativeWindowObserver. virtual void OnPageTitleUpdated(bool* prevent_default, const std::string& title) OVERRIDE; virtual void WillCloseWindow(bool* prevent_default) OVERRIDE; virtual void OnWindowClosed() OVERRIDE; virtual void OnWindowBlur() OVERRIDE; private: static v8::Handle New(const v8::Arguments &args); static v8::Handle Destroy(const v8::Arguments &args); // APIs for NativeWindow. static v8::Handle Close(const v8::Arguments &args); static v8::Handle Focus(const v8::Arguments &args); static v8::Handle IsFocused(const v8::Arguments &args); static v8::Handle Show(const v8::Arguments &args); static v8::Handle Hide(const v8::Arguments &args); static v8::Handle Maximize(const v8::Arguments &args); static v8::Handle Unmaximize(const v8::Arguments &args); static v8::Handle Minimize(const v8::Arguments &args); static v8::Handle Restore(const v8::Arguments &args); static v8::Handle SetFullscreen(const v8::Arguments &args); static v8::Handle IsFullscreen(const v8::Arguments &args); static v8::Handle SetSize(const v8::Arguments &args); static v8::Handle GetSize(const v8::Arguments &args); static v8::Handle SetMinimumSize(const v8::Arguments &args); static v8::Handle GetMinimumSize(const v8::Arguments &args); static v8::Handle SetMaximumSize(const v8::Arguments &args); static v8::Handle GetMaximumSize(const v8::Arguments &args); static v8::Handle SetResizable(const v8::Arguments &args); static v8::Handle IsResizable(const v8::Arguments &args); static v8::Handle SetAlwaysOnTop(const v8::Arguments &args); static v8::Handle IsAlwaysOnTop(const v8::Arguments &args); static v8::Handle Center(const v8::Arguments &args); static v8::Handle SetPosition(const v8::Arguments &args); static v8::Handle GetPosition(const v8::Arguments &args); static v8::Handle SetTitle(const v8::Arguments &args); static v8::Handle GetTitle(const v8::Arguments &args); static v8::Handle FlashFrame(const v8::Arguments &args); static v8::Handle SetKiosk(const v8::Arguments &args); static v8::Handle IsKiosk(const v8::Arguments &args); static v8::Handle OpenDevTools(const v8::Arguments &args); static v8::Handle CloseDevTools(const v8::Arguments &args); static v8::Handle FocusOnWebView(const v8::Arguments &args); static v8::Handle BlurWebView(const v8::Arguments &args); // APIs for WebContents. static v8::Handle GetPageTitle(const v8::Arguments &args); static v8::Handle IsLoading(const v8::Arguments &args); static v8::Handle IsWaitingForResponse(const v8::Arguments &args); static v8::Handle Stop(const v8::Arguments &args); static v8::Handle GetRoutingID(const v8::Arguments &args); static v8::Handle GetProcessID(const v8::Arguments &args); // APIs for NavigationController. static v8::Handle LoadURL(const v8::Arguments &args); static v8::Handle GetURL(const v8::Arguments &args); static v8::Handle CanGoBack(const v8::Arguments &args); static v8::Handle CanGoForward(const v8::Arguments &args); static v8::Handle CanGoToOffset(const v8::Arguments &args); static v8::Handle GoBack(const v8::Arguments &args); static v8::Handle GoForward(const v8::Arguments &args); static v8::Handle GoToIndex(const v8::Arguments &args); static v8::Handle GoToOffset(const v8::Arguments &args); static v8::Handle Reload(const v8::Arguments &args); static v8::Handle ReloadIgnoringCache(const v8::Arguments &args); scoped_ptr window_; DISALLOW_COPY_AND_ASSIGN(Window); }; } // namespace api } // namespace atom #endif // ATOM_BROWSER_API_ATOM_API_WINDOW_H_