// 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_NATIVE_WINDOW_MAC_H_ #define ATOM_BROWSER_NATIVE_WINDOW_MAC_H_ #import #include "base/memory/scoped_ptr.h" #include "browser/native_window.h" namespace atom { class NativeWindowMac : public NativeWindow { public: explicit NativeWindowMac(content::WebContents* web_contents, base::DictionaryValue* options); virtual ~NativeWindowMac(); // NativeWindow implementation. virtual void Close() OVERRIDE; virtual void CloseImmediately() OVERRIDE; virtual void Move(const gfx::Rect& pos) OVERRIDE; virtual void Focus(bool focus) OVERRIDE; virtual bool IsFocused() OVERRIDE; virtual void Show() OVERRIDE; virtual void Hide() OVERRIDE; virtual void Maximize() OVERRIDE; virtual void Unmaximize() OVERRIDE; virtual void Minimize() OVERRIDE; virtual void Restore() OVERRIDE; virtual void SetFullscreen(bool fullscreen) OVERRIDE; virtual bool IsFullscreen() OVERRIDE; virtual void SetSize(const gfx::Size& size) OVERRIDE; virtual gfx::Size GetSize() OVERRIDE; virtual void SetMinimumSize(const gfx::Size& size) OVERRIDE; virtual gfx::Size GetMinimumSize() OVERRIDE; virtual void SetMaximumSize(const gfx::Size& size) OVERRIDE; virtual gfx::Size GetMaximumSize() OVERRIDE; virtual void SetResizable(bool resizable) OVERRIDE; virtual bool IsResizable() OVERRIDE; virtual void SetAlwaysOnTop(bool top) OVERRIDE; virtual bool IsAlwaysOnTop() OVERRIDE; virtual void Center() OVERRIDE; virtual void SetPosition(const gfx::Point& position) OVERRIDE; virtual gfx::Point GetPosition() OVERRIDE; virtual void SetTitle(const std::string& title) OVERRIDE; virtual std::string GetTitle() OVERRIDE; virtual void FlashFrame(bool flash) OVERRIDE; virtual void SetKiosk(bool kiosk) OVERRIDE; virtual bool IsKiosk() OVERRIDE; virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; NSWindow*& window() { return window_; } protected: void SetNonLionFullscreen(bool fullscreen); // Implementations of content::WebContentsDelegate. virtual void HandleKeyboardEvent( content::WebContents*, const content::NativeWebKeyboardEvent&) OVERRIDE; private: void InstallView(); void UninstallView(); NSWindow* window_; bool is_fullscreen_; bool is_kiosk_; NSRect restored_bounds_; NSInteger attention_request_id_; // identifier from requestUserAttention DISALLOW_COPY_AND_ASSIGN(NativeWindowMac); }; } // namespace atom #endif // ATOM_BROWSER_NATIVE_WINDOW_MAC_H_