| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_NATIVE_APP_WINDOW_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_APPS_NATIVE_APP_WINDOW_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_NATIVE_APP_WINDOW_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_APPS_NATIVE_APP_WINDOW_COCOA_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "apps/native_app_window.h" |
| 11 #include "apps/shell_window.h" | 12 #include "apps/shell_window.h" |
| 12 #include "base/mac/scoped_nsobject.h" | 13 #include "base/mac/scoped_nsobject.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #import "chrome/browser/ui/cocoa/browser_command_executor.h" | 15 #import "chrome/browser/ui/cocoa/browser_command_executor.h" |
| 15 #include "chrome/browser/ui/extensions/native_app_window.h" | |
| 16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 17 #include "extensions/common/draggable_region.h" | 17 #include "extensions/common/draggable_region.h" |
| 18 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
| 19 | 19 |
| 20 class ExtensionKeybindingRegistryCocoa; | 20 class ExtensionKeybindingRegistryCocoa; |
| 21 class Profile; | 21 class Profile; |
| 22 class NativeAppWindowCocoa; | 22 class NativeAppWindowCocoa; |
| 23 @class ShellNSWindow; | 23 @class ShellNSWindow; |
| 24 class SkRegion; | 24 class SkRegion; |
| 25 | 25 |
| 26 // A window controller for a minimal window to host a web app view. Passes | 26 // A window controller for a minimal window to host a web app view. Passes |
| 27 // Objective-C notifications to the C++ bridge. | 27 // Objective-C notifications to the C++ bridge. |
| 28 @interface NativeAppWindowController : NSWindowController | 28 @interface NativeAppWindowController : NSWindowController |
| 29 <NSWindowDelegate, | 29 <NSWindowDelegate, |
| 30 BrowserCommandExecutor> { | 30 BrowserCommandExecutor> { |
| 31 @private | 31 @private |
| 32 NativeAppWindowCocoa* appWindow_; // Weak; owns self. | 32 NativeAppWindowCocoa* appWindow_; // Weak; owns self. |
| 33 } | 33 } |
| 34 | 34 |
| 35 @property(assign, nonatomic) NativeAppWindowCocoa* appWindow; | 35 @property(assign, nonatomic) NativeAppWindowCocoa* appWindow; |
| 36 | 36 |
| 37 // Consults the Command Registry to see if this |event| needs to be handled as | 37 // Consults the Command Registry to see if this |event| needs to be handled as |
| 38 // an extension command and returns YES if so (NO otherwise). | 38 // an extension command and returns YES if so (NO otherwise). |
| 39 - (BOOL)handledByExtensionCommand:(NSEvent*)event; | 39 - (BOOL)handledByExtensionCommand:(NSEvent*)event; |
| 40 | 40 |
| 41 @end | 41 @end |
| 42 | 42 |
| 43 // Cocoa bridge to AppWindow. | 43 // Cocoa bridge to AppWindow. |
| 44 class NativeAppWindowCocoa : public NativeAppWindow { | 44 class NativeAppWindowCocoa : public apps::NativeAppWindow { |
| 45 public: | 45 public: |
| 46 NativeAppWindowCocoa(apps::ShellWindow* shell_window, | 46 NativeAppWindowCocoa(apps::ShellWindow* shell_window, |
| 47 const apps::ShellWindow::CreateParams& params); | 47 const apps::ShellWindow::CreateParams& params); |
| 48 | 48 |
| 49 // ui::BaseWindow implementation. | 49 // ui::BaseWindow implementation. |
| 50 virtual bool IsActive() const OVERRIDE; | 50 virtual bool IsActive() const OVERRIDE; |
| 51 virtual bool IsMaximized() const OVERRIDE; | 51 virtual bool IsMaximized() const OVERRIDE; |
| 52 virtual bool IsMinimized() const OVERRIDE; | 52 virtual bool IsMinimized() const OVERRIDE; |
| 53 virtual bool IsFullscreen() const OVERRIDE; | 53 virtual bool IsFullscreen() const OVERRIDE; |
| 54 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; | 54 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 // used in custom drag to compute the window movement. | 184 // used in custom drag to compute the window movement. |
| 185 NSPoint last_mouse_location_; | 185 NSPoint last_mouse_location_; |
| 186 | 186 |
| 187 // The Extension Command Registry used to determine which keyboard events to | 187 // The Extension Command Registry used to determine which keyboard events to |
| 188 // handle. | 188 // handle. |
| 189 scoped_ptr<ExtensionKeybindingRegistryCocoa> extension_keybinding_registry_; | 189 scoped_ptr<ExtensionKeybindingRegistryCocoa> extension_keybinding_registry_; |
| 190 | 190 |
| 191 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowCocoa); | 191 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowCocoa); |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_NATIVE_APP_WINDOW_COCOA_H_ | 194 #endif // CHROME_BROWSER_UI_COCOA_APPS_NATIVE_APP_WINDOW_COCOA_H_ |
| OLD | NEW |