1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_NATIVE_APP_WINDOW_MAC_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_NATIVE_APP_WINDOW_MAC_H_
8 #import <Cocoa/Cocoa.h>
10 #import "base/mac/scoped_nsobject.h"
11 #include "extensions/shell/browser/shell_native_app_window.h"
15 namespace extensions
{
16 class ShellNativeAppWindowMac
;
19 // A window controller for ShellNativeAppWindowMac to handle NSNotifications
20 // and pass them to the C++ implementation.
21 @interface ShellNativeAppWindowController
22 : NSWindowController
<NSWindowDelegate
> {
24 extensions::ShellNativeAppWindowMac
* appWindow_
; // Owns us.
27 @
property(assign
, nonatomic
) extensions::ShellNativeAppWindowMac
* appWindow
;
31 namespace extensions
{
33 // A minimal implementation of ShellNativeAppWindow for Mac Cocoa.
34 // Based on the NativeAppWindowCocoa implementation.
35 class ShellNativeAppWindowMac
: public ShellNativeAppWindow
{
37 ShellNativeAppWindowMac(extensions::AppWindow
* app_window
,
38 const extensions::AppWindow::CreateParams
& params
);
39 ~ShellNativeAppWindowMac() override
;
42 bool IsActive() const override
;
43 gfx::NativeWindow
GetNativeWindow() const override
;
44 gfx::Rect
GetBounds() const override
;
47 void Activate() override
;
48 void Deactivate() override
;
49 void SetBounds(const gfx::Rect
& bounds
) override
;
51 // Called when the window is about to close.
52 void WindowWillClose();
55 ShellNSWindow
* window() const;
57 base::scoped_nsobject
<ShellNativeAppWindowController
> window_controller_
;
59 DISALLOW_COPY_AND_ASSIGN(ShellNativeAppWindowMac
);
62 } // namespace extensions
64 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_NATIVE_APP_WINDOW_MAC_H_