OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_APPS_NATIVE_APP_WINDOW_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_APPS_NATIVE_APP_WINDOW_COCOA_H_ |
6 #define CHROME_BROWSER_UI_COCOA_APPS_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/size_constraints.h" | 11 #include "apps/size_constraints.h" |
12 #include "apps/ui/native_app_window.h" | 12 #include "apps/ui/native_app_window.h" |
13 #include "base/mac/scoped_nsobject.h" | 13 #include "base/mac/scoped_nsobject.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #import "chrome/browser/ui/cocoa/browser_command_executor.h" | 15 #import "chrome/browser/ui/cocoa/browser_command_executor.h" |
16 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
17 #include "extensions/common/draggable_region.h" | 17 #include "extensions/common/draggable_region.h" |
18 #include "ui/base/accelerators/accelerator_manager.h" | |
18 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
19 | 20 |
20 namespace apps { | 21 namespace apps { |
21 class AppWindow; | 22 class AppWindow; |
22 } | 23 } |
23 | 24 |
24 class ExtensionKeybindingRegistryCocoa; | 25 class ExtensionKeybindingRegistryCocoa; |
25 class NativeAppWindowCocoa; | 26 class NativeAppWindowCocoa; |
26 @class ShellNSWindow; | 27 @class ShellNSWindow; |
27 class SkRegion; | 28 class SkRegion; |
28 | 29 |
29 // A window controller for a minimal window to host a web app view. Passes | 30 // A window controller for a minimal window to host a web app view. Passes |
30 // Objective-C notifications to the C++ bridge. | 31 // Objective-C notifications to the C++ bridge. |
31 @interface NativeAppWindowController : NSWindowController | 32 @interface NativeAppWindowController : NSWindowController |
32 <NSWindowDelegate, | 33 <NSWindowDelegate, |
33 BrowserCommandExecutor> { | 34 BrowserCommandExecutor> { |
34 @private | 35 @private |
35 NativeAppWindowCocoa* appWindow_; // Weak; owns self. | 36 NativeAppWindowCocoa* appWindow_; // Weak; owns self. |
36 } | 37 } |
37 | 38 |
38 @property(assign, nonatomic) NativeAppWindowCocoa* appWindow; | 39 @property(assign, nonatomic) NativeAppWindowCocoa* appWindow; |
39 | 40 |
40 // Consults the Command Registry to see if this |event| needs to be handled as | 41 // Consults the Command Registry to see if this |event| needs to be handled as |
41 // an extension command and returns YES if so (NO otherwise). | 42 // an extension command and returns YES if so (NO otherwise). |
42 - (BOOL)handledByExtensionCommand:(NSEvent*)event; | 43 // Only extensions with the given |priority| are considered. |
44 - (BOOL)handledByExtensionCommand:(NSEvent*)event | |
45 priority: | |
46 (ui::AcceleratorManager::HandlerPriority)priority; | |
Scott Hess - ex-Googler
2014/07/15 19:20:59
Rather than split the line I'd just relax the colo
erikchen
2014/07/15 20:48:40
I dislike formatting that conflicts with both Chro
Scott Hess - ex-Googler
2014/07/15 21:30:43
Yeah, I'll probably pay for my opinion. "clang-fo
| |
43 | 47 |
44 @end | 48 @end |
45 | 49 |
46 // Cocoa bridge to AppWindow. | 50 // Cocoa bridge to AppWindow. |
47 class NativeAppWindowCocoa : public apps::NativeAppWindow, | 51 class NativeAppWindowCocoa : public apps::NativeAppWindow, |
48 public content::WebContentsObserver { | 52 public content::WebContentsObserver { |
49 public: | 53 public: |
50 NativeAppWindowCocoa(apps::AppWindow* app_window, | 54 NativeAppWindowCocoa(apps::AppWindow* app_window, |
51 const apps::AppWindow::CreateParams& params); | 55 const apps::AppWindow::CreateParams& params); |
52 | 56 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 // Called when the window is zoomed (maximized or de-maximized). | 105 // Called when the window is zoomed (maximized or de-maximized). |
102 void WindowWillZoom(); | 106 void WindowWillZoom(); |
103 | 107 |
104 // Called when the window enters fullscreen. | 108 // Called when the window enters fullscreen. |
105 void WindowDidEnterFullscreen(); | 109 void WindowDidEnterFullscreen(); |
106 | 110 |
107 // Called when the window exits fullscreen. | 111 // Called when the window exits fullscreen. |
108 void WindowDidExitFullscreen(); | 112 void WindowDidExitFullscreen(); |
109 | 113 |
110 // Called to handle a key event. | 114 // Called to handle a key event. |
111 bool HandledByExtensionCommand(NSEvent* event); | 115 bool HandledByExtensionCommand( |
116 NSEvent* event, | |
117 ui::AcceleratorManager::HandlerPriority priority); | |
112 | 118 |
113 // Returns true if |point| in local Cocoa coordinate system falls within | 119 // Returns true if |point| in local Cocoa coordinate system falls within |
114 // the draggable region. | 120 // the draggable region. |
115 bool IsWithinDraggableRegion(NSPoint point) const; | 121 bool IsWithinDraggableRegion(NSPoint point) const; |
116 | 122 |
117 NSRect restored_bounds() const { return restored_bounds_; } | 123 NSRect restored_bounds() const { return restored_bounds_; } |
118 | 124 |
119 protected: | 125 protected: |
120 // NativeAppWindow implementation. | 126 // NativeAppWindow implementation. |
121 virtual void SetFullscreen(int fullscreen_types) OVERRIDE; | 127 virtual void SetFullscreen(int fullscreen_types) OVERRIDE; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 std::vector<extensions::DraggableRegion> draggable_regions_; | 217 std::vector<extensions::DraggableRegion> draggable_regions_; |
212 | 218 |
213 // The Extension Command Registry used to determine which keyboard events to | 219 // The Extension Command Registry used to determine which keyboard events to |
214 // handle. | 220 // handle. |
215 scoped_ptr<ExtensionKeybindingRegistryCocoa> extension_keybinding_registry_; | 221 scoped_ptr<ExtensionKeybindingRegistryCocoa> extension_keybinding_registry_; |
216 | 222 |
217 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowCocoa); | 223 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowCocoa); |
218 }; | 224 }; |
219 | 225 |
220 #endif // CHROME_BROWSER_UI_COCOA_APPS_NATIVE_APP_WINDOW_COCOA_H_ | 226 #endif // CHROME_BROWSER_UI_COCOA_APPS_NATIVE_APP_WINDOW_COCOA_H_ |
OLD | NEW |