OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_NATIVE_APP_WINDOW_MAC_H_ |
| 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_NATIVE_APP_WINDOW_MAC_H_ |
| 7 |
| 8 #import <Cocoa/Cocoa.h> |
| 9 |
| 10 #import "base/mac/scoped_nsobject.h" |
| 11 #include "extensions/shell/browser/shell_native_app_window.h" |
| 12 |
| 13 @class ShellNSWindow; |
| 14 |
| 15 namespace extensions { |
| 16 class ShellNativeAppWindowMac; |
| 17 } |
| 18 |
| 19 // A window controller for ShellNativeAppWindowMac to handle NSNotifications |
| 20 // and pass them to the C++ implementation. |
| 21 @interface ShellNativeAppWindowController |
| 22 : NSWindowController<NSWindowDelegate> { |
| 23 @private |
| 24 extensions::ShellNativeAppWindowMac* appWindow_; // Owns us. |
| 25 } |
| 26 |
| 27 @property(assign, nonatomic) extensions::ShellNativeAppWindowMac* appWindow; |
| 28 |
| 29 @end |
| 30 |
| 31 namespace extensions { |
| 32 |
| 33 // A minimal implementation of ShellNativeAppWindow for Mac Cocoa. |
| 34 // Based on the NativeAppWindowCocoa implementation. |
| 35 class ShellNativeAppWindowMac : public ShellNativeAppWindow { |
| 36 public: |
| 37 ShellNativeAppWindowMac(extensions::AppWindow* app_window, |
| 38 const extensions::AppWindow::CreateParams& params); |
| 39 ~ShellNativeAppWindowMac() override; |
| 40 |
| 41 // ui::BaseWindow: |
| 42 bool IsActive() const override; |
| 43 gfx::NativeWindow GetNativeWindow() const override; |
| 44 gfx::Rect GetBounds() const override; |
| 45 void Show() override; |
| 46 void Hide() override; |
| 47 void Activate() override; |
| 48 void Deactivate() override; |
| 49 void SetBounds(const gfx::Rect& bounds) override; |
| 50 |
| 51 // Called when the window is about to close. |
| 52 void WindowWillClose(); |
| 53 |
| 54 private: |
| 55 ShellNSWindow* window() const; |
| 56 |
| 57 base::scoped_nsobject<ShellNativeAppWindowController> window_controller_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(ShellNativeAppWindowMac); |
| 60 }; |
| 61 |
| 62 } // namespace extensions |
| 63 |
| 64 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_NATIVE_APP_WINDOW_MAC_H_ |
OLD | NEW |