2013-04-12 07:04:46 +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.
|
|
|
|
|
|
|
|
#ifndef ATOM_BROWSER_NATIVE_WINDOW_MAC_H_
|
|
|
|
#define ATOM_BROWSER_NATIVE_WINDOW_MAC_H_
|
|
|
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
|
|
|
|
#include "base/memory/scoped_ptr.h"
|
|
|
|
#include "browser/native_window.h"
|
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
class NativeWindowMac : public NativeWindow {
|
|
|
|
public:
|
2013-04-20 05:42:39 +00:00
|
|
|
explicit NativeWindowMac(content::WebContents* web_contents,
|
2013-04-12 07:04:46 +00:00
|
|
|
base::DictionaryValue* options);
|
|
|
|
virtual ~NativeWindowMac();
|
|
|
|
|
|
|
|
// NativeWindow implementation.
|
|
|
|
virtual void Close() OVERRIDE;
|
2013-05-01 08:12:00 +00:00
|
|
|
virtual void CloseImmediately() OVERRIDE;
|
2013-04-12 07:04:46 +00:00
|
|
|
virtual void Move(const gfx::Rect& pos) OVERRIDE;
|
|
|
|
virtual void Focus(bool focus) OVERRIDE;
|
2013-05-16 14:56:52 +00:00
|
|
|
virtual bool IsFocused() OVERRIDE;
|
2013-04-12 07:04:46 +00:00
|
|
|
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;
|
2013-04-17 14:49:49 +00:00
|
|
|
virtual void SetMinimumSize(const gfx::Size& size) OVERRIDE;
|
2013-04-18 07:38:04 +00:00
|
|
|
virtual gfx::Size GetMinimumSize() OVERRIDE;
|
2013-04-17 14:49:49 +00:00
|
|
|
virtual void SetMaximumSize(const gfx::Size& size) OVERRIDE;
|
2013-04-18 07:38:04 +00:00
|
|
|
virtual gfx::Size GetMaximumSize() OVERRIDE;
|
2013-04-12 07:04:46 +00:00
|
|
|
virtual void SetResizable(bool resizable) OVERRIDE;
|
2013-04-18 07:38:04 +00:00
|
|
|
virtual bool IsResizable() OVERRIDE;
|
2013-04-12 07:04:46 +00:00
|
|
|
virtual void SetAlwaysOnTop(bool top) OVERRIDE;
|
2013-04-18 07:38:04 +00:00
|
|
|
virtual bool IsAlwaysOnTop() OVERRIDE;
|
2013-05-10 12:34:05 +00:00
|
|
|
virtual void Center() OVERRIDE;
|
2013-04-12 07:04:46 +00:00
|
|
|
virtual void SetPosition(const gfx::Point& position) OVERRIDE;
|
|
|
|
virtual gfx::Point GetPosition() OVERRIDE;
|
|
|
|
virtual void SetTitle(const std::string& title) OVERRIDE;
|
2013-04-18 06:30:05 +00:00
|
|
|
virtual std::string GetTitle() OVERRIDE;
|
2013-04-12 07:04:46 +00:00
|
|
|
virtual void FlashFrame(bool flash) OVERRIDE;
|
|
|
|
virtual void SetKiosk(bool kiosk) OVERRIDE;
|
|
|
|
virtual bool IsKiosk() OVERRIDE;
|
2013-05-03 11:31:24 +00:00
|
|
|
virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
|
2013-04-12 07:04:46 +00:00
|
|
|
|
2013-05-01 15:28:01 +00:00
|
|
|
NSWindow*& window() { return window_; }
|
2013-04-12 07:04:46 +00:00
|
|
|
|
2013-05-24 09:51:15 +00:00
|
|
|
void NotifyWindowBlur() { NativeWindow::NotifyWindowBlur(); }
|
|
|
|
|
2013-04-12 07:04:46 +00:00
|
|
|
protected:
|
2013-04-12 12:31:15 +00:00
|
|
|
// Implementations of content::WebContentsDelegate.
|
|
|
|
virtual void HandleKeyboardEvent(
|
|
|
|
content::WebContents*,
|
|
|
|
const content::NativeWebKeyboardEvent&) OVERRIDE;
|
|
|
|
|
2013-04-12 07:04:46 +00:00
|
|
|
private:
|
|
|
|
void InstallView();
|
|
|
|
void UninstallView();
|
|
|
|
|
|
|
|
NSWindow* window_;
|
|
|
|
|
|
|
|
bool is_kiosk_;
|
|
|
|
|
|
|
|
NSInteger attention_request_id_; // identifier from requestUserAttention
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(NativeWindowMac);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace atom
|
|
|
|
|
|
|
|
#endif // ATOM_BROWSER_NATIVE_WINDOW_MAC_H_
|