| 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/shell_window.h" | 11 #include "apps/app_window.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/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
| 19 | 19 |
| 20 class ExtensionKeybindingRegistryCocoa; | 20 class ExtensionKeybindingRegistryCocoa; |
| 21 class NativeAppWindowCocoa; | 21 class NativeAppWindowCocoa; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 36 // Consults the Command Registry to see if this |event| needs to be handled as | 36 // Consults the Command Registry to see if this |event| needs to be handled as |
| 37 // an extension command and returns YES if so (NO otherwise). | 37 // an extension command and returns YES if so (NO otherwise). |
| 38 - (BOOL)handledByExtensionCommand:(NSEvent*)event; | 38 - (BOOL)handledByExtensionCommand:(NSEvent*)event; |
| 39 | 39 |
| 40 @end | 40 @end |
| 41 | 41 |
| 42 // Cocoa bridge to AppWindow. | 42 // Cocoa bridge to AppWindow. |
| 43 class NativeAppWindowCocoa : public apps::NativeAppWindow, | 43 class NativeAppWindowCocoa : public apps::NativeAppWindow, |
| 44 public content::WebContentsObserver { | 44 public content::WebContentsObserver { |
| 45 public: | 45 public: |
| 46 NativeAppWindowCocoa(apps::ShellWindow* shell_window, | 46 NativeAppWindowCocoa(apps::AppWindow* app_window, |
| 47 const apps::ShellWindow::CreateParams& params); | 47 const apps::AppWindow::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; |
| 55 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; | 55 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; |
| 56 virtual ui::WindowShowState GetRestoredState() const OVERRIDE; | 56 virtual ui::WindowShowState GetRestoredState() const OVERRIDE; |
| 57 virtual gfx::Rect GetBounds() const OVERRIDE; | 57 virtual gfx::Rect GetBounds() const OVERRIDE; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 web_modal::ModalDialogHostObserver* observer) OVERRIDE; | 148 web_modal::ModalDialogHostObserver* observer) OVERRIDE; |
| 149 virtual void RemoveObserver( | 149 virtual void RemoveObserver( |
| 150 web_modal::ModalDialogHostObserver* observer) OVERRIDE; | 150 web_modal::ModalDialogHostObserver* observer) OVERRIDE; |
| 151 | 151 |
| 152 private: | 152 private: |
| 153 virtual ~NativeAppWindowCocoa(); | 153 virtual ~NativeAppWindowCocoa(); |
| 154 | 154 |
| 155 ShellNSWindow* window() const; | 155 ShellNSWindow* window() const; |
| 156 | 156 |
| 157 content::WebContents* web_contents() const { | 157 content::WebContents* web_contents() const { |
| 158 return shell_window_->web_contents(); | 158 return app_window_->web_contents(); |
| 159 } | 159 } |
| 160 const extensions::Extension* extension() const { | 160 const extensions::Extension* extension() const { |
| 161 return shell_window_->extension(); | 161 return app_window_->extension(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 // Returns the WindowStyleMask based on the type of window frame. | 164 // Returns the WindowStyleMask based on the type of window frame. |
| 165 // Specifically, this includes NSResizableWindowMask if the window is | 165 // Specifically, this includes NSResizableWindowMask if the window is |
| 166 // resizable, and does not include NSTexturedBackgroundWindowMask when a | 166 // resizable, and does not include NSTexturedBackgroundWindowMask when a |
| 167 // native frame is used. | 167 // native frame is used. |
| 168 NSUInteger GetWindowStyleMask() const; | 168 NSUInteger GetWindowStyleMask() const; |
| 169 | 169 |
| 170 void InstallView(); | 170 void InstallView(); |
| 171 void UninstallView(); | 171 void UninstallView(); |
| 172 void InstallDraggableRegionViews(); | 172 void InstallDraggableRegionViews(); |
| 173 void UpdateDraggableRegionsForSystemDrag( | 173 void UpdateDraggableRegionsForSystemDrag( |
| 174 const std::vector<extensions::DraggableRegion>& regions, | 174 const std::vector<extensions::DraggableRegion>& regions, |
| 175 const extensions::DraggableRegion* draggable_area); | 175 const extensions::DraggableRegion* draggable_area); |
| 176 void UpdateDraggableRegionsForCustomDrag( | 176 void UpdateDraggableRegionsForCustomDrag( |
| 177 const std::vector<extensions::DraggableRegion>& regions); | 177 const std::vector<extensions::DraggableRegion>& regions); |
| 178 | 178 |
| 179 // Cache |restored_bounds_| only if the window is currently restored. | 179 // Cache |restored_bounds_| only if the window is currently restored. |
| 180 void UpdateRestoredBounds(); | 180 void UpdateRestoredBounds(); |
| 181 | 181 |
| 182 // Hides the window unconditionally. Used by Hide and HideWithApp. | 182 // Hides the window unconditionally. Used by Hide and HideWithApp. |
| 183 void HideWithoutMarkingHidden(); | 183 void HideWithoutMarkingHidden(); |
| 184 | 184 |
| 185 apps::ShellWindow* shell_window_; // weak - ShellWindow owns NativeAppWindow. | 185 apps::AppWindow* app_window_; // weak - AppWindow owns NativeAppWindow. |
| 186 | 186 |
| 187 bool has_frame_; | 187 bool has_frame_; |
| 188 | 188 |
| 189 // Whether this window is hidden according to the app.window API. This is set | 189 // Whether this window is hidden according to the app.window API. This is set |
| 190 // by Hide, Show, and ShowInactive. | 190 // by Hide, Show, and ShowInactive. |
| 191 bool is_hidden_; | 191 bool is_hidden_; |
| 192 // Whether this window last became hidden due to a request to hide the entire | 192 // Whether this window last became hidden due to a request to hide the entire |
| 193 // app, e.g. via the dock menu or Cmd+H. This is set by Hide/ShowWithApp. | 193 // app, e.g. via the dock menu or Cmd+H. This is set by Hide/ShowWithApp. |
| 194 bool is_hidden_with_app_; | 194 bool is_hidden_with_app_; |
| 195 | 195 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 220 NSPoint last_mouse_location_; | 220 NSPoint last_mouse_location_; |
| 221 | 221 |
| 222 // The Extension Command Registry used to determine which keyboard events to | 222 // The Extension Command Registry used to determine which keyboard events to |
| 223 // handle. | 223 // handle. |
| 224 scoped_ptr<ExtensionKeybindingRegistryCocoa> extension_keybinding_registry_; | 224 scoped_ptr<ExtensionKeybindingRegistryCocoa> extension_keybinding_registry_; |
| 225 | 225 |
| 226 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowCocoa); | 226 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowCocoa); |
| 227 }; | 227 }; |
| 228 | 228 |
| 229 #endif // CHROME_BROWSER_UI_COCOA_APPS_NATIVE_APP_WINDOW_COCOA_H_ | 229 #endif // CHROME_BROWSER_UI_COCOA_APPS_NATIVE_APP_WINDOW_COCOA_H_ |
| OLD | NEW |