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

Side by Side Diff: chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h

Issue 494033002: Move AppWindow to extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unneeded include in chrome_shell_delegate.cc Created 6 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 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/app_window.h"
12 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
13 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
14 #import "chrome/browser/ui/cocoa/browser_command_executor.h" 13 #import "chrome/browser/ui/cocoa/browser_command_executor.h"
15 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
15 #include "extensions/browser/app_window/app_window.h"
16 #include "extensions/browser/app_window/native_app_window.h" 16 #include "extensions/browser/app_window/native_app_window.h"
17 #include "extensions/browser/app_window/size_constraints.h" 17 #include "extensions/browser/app_window/size_constraints.h"
18 #include "extensions/common/draggable_region.h" 18 #include "extensions/common/draggable_region.h"
19 #include "ui/base/accelerators/accelerator_manager.h" 19 #include "ui/base/accelerators/accelerator_manager.h"
20 #include "ui/gfx/rect.h" 20 #include "ui/gfx/rect.h"
21 21
22 namespace apps {
23 class AppWindow;
24 }
25
26 class ExtensionKeybindingRegistryCocoa; 22 class ExtensionKeybindingRegistryCocoa;
27 class NativeAppWindowCocoa; 23 class NativeAppWindowCocoa;
28 @class ShellNSWindow; 24 @class ShellNSWindow;
29 class SkRegion; 25 class SkRegion;
30 26
31 // A window controller for a minimal window to host a web app view. Passes 27 // A window controller for a minimal window to host a web app view. Passes
32 // Objective-C notifications to the C++ bridge. 28 // Objective-C notifications to the C++ bridge.
33 @interface NativeAppWindowController : NSWindowController 29 @interface NativeAppWindowController : NSWindowController
34 <NSWindowDelegate, 30 <NSWindowDelegate,
35 BrowserCommandExecutor> { 31 BrowserCommandExecutor> {
36 @private 32 @private
37 NativeAppWindowCocoa* appWindow_; // Weak; owns self. 33 NativeAppWindowCocoa* appWindow_; // Weak; owns self.
38 } 34 }
39 35
40 @property(assign, nonatomic) NativeAppWindowCocoa* appWindow; 36 @property(assign, nonatomic) NativeAppWindowCocoa* appWindow;
41 37
42 // Consults the Command Registry to see if this |event| needs to be handled as 38 // Consults the Command Registry to see if this |event| needs to be handled as
43 // an extension command and returns YES if so (NO otherwise). 39 // an extension command and returns YES if so (NO otherwise).
44 // Only extensions with the given |priority| are considered. 40 // Only extensions with the given |priority| are considered.
45 - (BOOL)handledByExtensionCommand:(NSEvent*)event 41 - (BOOL)handledByExtensionCommand:(NSEvent*)event
46 priority:(ui::AcceleratorManager::HandlerPriority)priority; 42 priority:(ui::AcceleratorManager::HandlerPriority)priority;
47 43
48 @end 44 @end
49 45
50 // Cocoa bridge to AppWindow. 46 // Cocoa bridge to AppWindow.
51 class NativeAppWindowCocoa : public extensions::NativeAppWindow, 47 class NativeAppWindowCocoa : public extensions::NativeAppWindow,
52 public content::WebContentsObserver { 48 public content::WebContentsObserver {
53 public: 49 public:
54 NativeAppWindowCocoa(apps::AppWindow* app_window, 50 NativeAppWindowCocoa(extensions::AppWindow* app_window,
55 const apps::AppWindow::CreateParams& params); 51 const extensions::AppWindow::CreateParams& params);
56 52
57 // ui::BaseWindow implementation. 53 // ui::BaseWindow implementation.
58 virtual bool IsActive() const OVERRIDE; 54 virtual bool IsActive() const OVERRIDE;
59 virtual bool IsMaximized() const OVERRIDE; 55 virtual bool IsMaximized() const OVERRIDE;
60 virtual bool IsMinimized() const OVERRIDE; 56 virtual bool IsMinimized() const OVERRIDE;
61 virtual bool IsFullscreen() const OVERRIDE; 57 virtual bool IsFullscreen() const OVERRIDE;
62 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; 58 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
63 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; 59 virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
64 virtual ui::WindowShowState GetRestoredState() const OVERRIDE; 60 virtual ui::WindowShowState GetRestoredState() const OVERRIDE;
65 virtual gfx::Rect GetBounds() const OVERRIDE; 61 virtual gfx::Rect GetBounds() const OVERRIDE;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 void InstallView(); 176 void InstallView();
181 void UninstallView(); 177 void UninstallView();
182 void UpdateDraggableRegionViews(); 178 void UpdateDraggableRegionViews();
183 179
184 // Cache |restored_bounds_| only if the window is currently restored. 180 // Cache |restored_bounds_| only if the window is currently restored.
185 void UpdateRestoredBounds(); 181 void UpdateRestoredBounds();
186 182
187 // Hides the window unconditionally. Used by Hide and HideWithApp. 183 // Hides the window unconditionally. Used by Hide and HideWithApp.
188 void HideWithoutMarkingHidden(); 184 void HideWithoutMarkingHidden();
189 185
190 apps::AppWindow* app_window_; // weak - AppWindow owns NativeAppWindow. 186 extensions::AppWindow* app_window_; // weak - AppWindow owns NativeAppWindow.
191 187
192 bool has_frame_; 188 bool has_frame_;
193 189
194 // Whether this window last became hidden due to a request to hide the entire 190 // Whether this window last became hidden due to a request to hide the entire
195 // app, e.g. via the dock menu or Cmd+H. This is set by Hide/ShowWithApp. 191 // app, e.g. via the dock menu or Cmd+H. This is set by Hide/ShowWithApp.
196 bool is_hidden_with_app_; 192 bool is_hidden_with_app_;
197 193
198 bool is_maximized_; 194 bool is_maximized_;
199 bool is_fullscreen_; 195 bool is_fullscreen_;
200 NSRect restored_bounds_; 196 NSRect restored_bounds_;
(...skipping 15 matching lines...) Expand all
216 std::vector<extensions::DraggableRegion> draggable_regions_; 212 std::vector<extensions::DraggableRegion> draggable_regions_;
217 213
218 // The Extension Command Registry used to determine which keyboard events to 214 // The Extension Command Registry used to determine which keyboard events to
219 // handle. 215 // handle.
220 scoped_ptr<ExtensionKeybindingRegistryCocoa> extension_keybinding_registry_; 216 scoped_ptr<ExtensionKeybindingRegistryCocoa> extension_keybinding_registry_;
221 217
222 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowCocoa); 218 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowCocoa);
223 }; 219 };
224 220
225 #endif // CHROME_BROWSER_UI_COCOA_APPS_NATIVE_APP_WINDOW_COCOA_H_ 221 #endif // CHROME_BROWSER_UI_COCOA_APPS_NATIVE_APP_WINDOW_COCOA_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/apps/chrome_apps_client_cocoa.mm ('k') | chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698