Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h

Issue 10911020: Enable commands API for platform apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_SHELL_WINDOW_COCOA_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_SHELL_WINDOW_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_SHELL_WINDOW_COCOA_H_ 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_SHELL_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 "base/memory/scoped_nsobject.h" 11 #include "base/memory/scoped_nsobject.h"
12 #import "chrome/browser/ui/cocoa/browser_command_executor.h" 12 #import "chrome/browser/ui/cocoa/browser_command_executor.h"
13 #include "chrome/browser/ui/cocoa/constrained_window_mac.h" 13 #include "chrome/browser/ui/cocoa/constrained_window_mac.h"
14 #include "chrome/browser/ui/extensions/native_shell_window.h" 14 #include "chrome/browser/ui/extensions/native_shell_window.h"
15 #include "chrome/browser/ui/extensions/shell_window.h" 15 #include "chrome/browser/ui/extensions/shell_window.h"
16 #include "chrome/common/extensions/draggable_region.h" 16 #include "chrome/common/extensions/draggable_region.h"
17 #import "third_party/GTM/AppKit/GTMWindowSheetController.h" 17 #import "third_party/GTM/AppKit/GTMWindowSheetController.h"
18 #include "ui/gfx/rect.h" 18 #include "ui/gfx/rect.h"
19 19
20 class ExtensionKeybindingRegistryCocoa;
20 class Profile; 21 class Profile;
21 class ShellWindowCocoa; 22 class ShellWindowCocoa;
22 @class ShellNSWindow; 23 @class ShellNSWindow;
23 24
24 // A window controller for a minimal window to host a web app view. Passes 25 // A window controller for a minimal window to host a web app view. Passes
25 // Objective-C notifications to the C++ bridge. 26 // Objective-C notifications to the C++ bridge.
26 @interface ShellWindowController : NSWindowController 27 @interface ShellWindowController : NSWindowController
27 <NSWindowDelegate, 28 <NSWindowDelegate,
28 GTMWindowSheetControllerDelegate, 29 GTMWindowSheetControllerDelegate,
29 ConstrainedWindowSupport, 30 ConstrainedWindowSupport,
30 BrowserCommandExecutor> { 31 BrowserCommandExecutor> {
31 @private 32 @private
32 ShellWindowCocoa* shellWindow_; // Weak; owns self. 33 ShellWindowCocoa* shellWindow_; // Weak; owns self.
33 // Manages per-window sheets. 34 // Manages per-window sheets.
34 scoped_nsobject<GTMWindowSheetController> sheetController_; 35 scoped_nsobject<GTMWindowSheetController> sheetController_;
35 } 36 }
36 37
37 @property(assign, nonatomic) ShellWindowCocoa* shellWindow; 38 @property(assign, nonatomic) ShellWindowCocoa* shellWindow;
38 39
40 // 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 - (BOOL)handledByExtensionCommand:(NSEvent*)event;
43
39 @end 44 @end
40 45
41 // Cocoa bridge to ShellWindow. 46 // Cocoa bridge to ShellWindow.
42 class ShellWindowCocoa : public NativeShellWindow { 47 class ShellWindowCocoa : public NativeShellWindow {
43 public: 48 public:
44 ShellWindowCocoa(ShellWindow* shell_window, 49 ShellWindowCocoa(ShellWindow* shell_window,
45 const ShellWindow::CreateParams& params); 50 const ShellWindow::CreateParams& params);
46 51
47 // BaseWindow implementation. 52 // BaseWindow implementation.
48 virtual bool IsActive() const OVERRIDE; 53 virtual bool IsActive() const OVERRIDE;
(...skipping 23 matching lines...) Expand all
72 77
73 // Called when the window is defocused. 78 // Called when the window is defocused.
74 void WindowDidResignKey(); 79 void WindowDidResignKey();
75 80
76 // Called when the window is resized. 81 // Called when the window is resized.
77 void WindowDidResize(); 82 void WindowDidResize();
78 83
79 // Called when the window is moved. 84 // Called when the window is moved.
80 void WindowDidMove(); 85 void WindowDidMove();
81 86
87 // Called to handle a key event.
88 bool HandledByExtensionCommand(NSEvent* event);
89
82 protected: 90 protected:
83 // NativeShellWindow implementation. 91 // NativeShellWindow implementation.
84 virtual void SetFullscreen(bool fullscreen) OVERRIDE; 92 virtual void SetFullscreen(bool fullscreen) OVERRIDE;
85 virtual bool IsFullscreenOrPending() const OVERRIDE; 93 virtual bool IsFullscreenOrPending() const OVERRIDE;
86 virtual void UpdateWindowIcon() OVERRIDE; 94 virtual void UpdateWindowIcon() OVERRIDE;
87 virtual void UpdateWindowTitle() OVERRIDE; 95 virtual void UpdateWindowTitle() OVERRIDE;
88 virtual void UpdateDraggableRegions( 96 virtual void UpdateDraggableRegions(
89 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; 97 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE;
90 virtual void HandleKeyboardEvent( 98 virtual void HandleKeyboardEvent(
91 const content::NativeWebKeyboardEvent& event) OVERRIDE; 99 const content::NativeWebKeyboardEvent& event) OVERRIDE;
(...skipping 19 matching lines...) Expand all
111 bool has_frame_; 119 bool has_frame_;
112 120
113 bool is_fullscreen_; 121 bool is_fullscreen_;
114 NSRect restored_bounds_; 122 NSRect restored_bounds_;
115 123
116 scoped_nsobject<ShellWindowController> window_controller_; 124 scoped_nsobject<ShellWindowController> window_controller_;
117 NSInteger attention_request_id_; // identifier from requestUserAttention 125 NSInteger attention_request_id_; // identifier from requestUserAttention
118 126
119 std::vector<extensions::DraggableRegion> draggable_regions_; 127 std::vector<extensions::DraggableRegion> draggable_regions_;
120 128
129 // The Extension Command Registry used to determine which keyboard events to
130 // handle.
131 scoped_ptr<ExtensionKeybindingRegistryCocoa> extension_keybinding_registry_;
132
121 DISALLOW_COPY_AND_ASSIGN(ShellWindowCocoa); 133 DISALLOW_COPY_AND_ASSIGN(ShellWindowCocoa);
122 }; 134 };
123 135
124 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_SHELL_WINDOW_COCOA_H_ 136 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_SHELL_WINDOW_COCOA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698