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_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_ |
6 #define CHROME_BROWSER_UI_COCOA_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_ |
7 | 7 |
8 // A class acting as the Objective-C controller for the Panel window | 8 // A class acting as the Objective-C controller for the Panel window |
9 // object. Handles interactions between Cocoa and the cross-platform | 9 // object. Handles interactions between Cocoa and the cross-platform |
10 // code. Each window has a single titlebar and is managed/owned by Panel. | 10 // code. Each window has a single titlebar and is managed/owned by Panel. |
11 | 11 |
12 #import <Cocoa/Cocoa.h> | 12 #import <Cocoa/Cocoa.h> |
13 | 13 |
14 #include "base/mac/scoped_nsobject.h" | 14 #include "base/mac/scoped_nsobject.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #import "chrome/browser/ui/cocoa/chrome_browser_window.h" | 16 #import "chrome/browser/ui/cocoa/chrome_browser_window.h" |
17 #include "chrome/browser/ui/panels/panel.h" | 17 #include "chrome/browser/ui/panels/panel.h" |
| 18 #import "ui/base/cocoa/tracking_area.h" |
18 | 19 |
19 class PanelCocoa; | 20 class PanelCocoa; |
20 @class PanelTitlebarViewCocoa; | 21 @class PanelTitlebarViewCocoa; |
21 | 22 |
22 @interface PanelWindowCocoaImpl : ChromeBrowserWindow { | 23 @interface PanelWindowCocoaImpl : ChromeBrowserWindow { |
23 } | 24 } |
24 @end | 25 @end |
25 | 26 |
26 @interface PanelWindowControllerCocoa : NSWindowController | 27 @interface PanelWindowControllerCocoa : NSWindowController |
27 <NSWindowDelegate, | 28 <NSWindowDelegate, |
28 NSAnimationDelegate> { | 29 NSAnimationDelegate> { |
29 @private | 30 @private |
30 IBOutlet PanelTitlebarViewCocoa* titlebar_view_; | 31 IBOutlet PanelTitlebarViewCocoa* titlebar_view_; |
31 scoped_ptr<PanelCocoa> windowShim_; | 32 scoped_ptr<PanelCocoa> windowShim_; |
32 base::scoped_nsobject<NSString> pendingWindowTitle_; | 33 base::scoped_nsobject<NSString> pendingWindowTitle_; |
33 NSViewAnimation* boundsAnimation_; // Lifetime controlled manually, needs | 34 NSViewAnimation* boundsAnimation_; // Lifetime controlled manually, needs |
34 // more then just |release| to terminate. | 35 // more then just |release| to terminate. |
35 BOOL animateOnBoundsChange_; | 36 BOOL animateOnBoundsChange_; |
36 BOOL throbberShouldSpin_; | 37 BOOL throbberShouldSpin_; |
37 BOOL playingMinimizeAnimation_; | 38 BOOL playingMinimizeAnimation_; |
38 float animationStopToShowTitlebarOnly_; | 39 float animationStopToShowTitlebarOnly_; |
39 BOOL canBecomeKeyWindow_; | 40 BOOL canBecomeKeyWindow_; |
40 // Allow a panel to become key if activated via Panel logic, as opposed | 41 // Allow a panel to become key if activated via Panel logic, as opposed |
41 // to by default system selection. The system will prefer a panel | 42 // to by default system selection. The system will prefer a panel |
42 // window over other application windows due to panels having a higher | 43 // window over other application windows due to panels having a higher |
43 // priority NSWindowLevel, so we distinguish between the two scenarios. | 44 // priority NSWindowLevel, so we distinguish between the two scenarios. |
44 BOOL activationRequestedByPanel_; | 45 BOOL activationRequestedByPanel_; |
45 base::scoped_nsobject<NSView> overlayView_; | 46 |
| 47 BOOL userResizing_; |
| 48 ui::ScopedCrTrackingArea trackingArea_; |
46 } | 49 } |
47 | 50 |
48 // Load the window nib and do any Cocoa-specific initialization. | 51 // Load the window nib and do any Cocoa-specific initialization. |
49 - (id)initWithPanel:(PanelCocoa*)window; | 52 - (id)initWithPanel:(PanelCocoa*)window; |
50 | 53 |
| 54 - (Panel*)panel; |
| 55 |
51 - (void)webContentsInserted:(content::WebContents*)contents; | 56 - (void)webContentsInserted:(content::WebContents*)contents; |
52 - (void)webContentsDetached:(content::WebContents*)contents; | 57 - (void)webContentsDetached:(content::WebContents*)contents; |
53 | 58 |
54 - (void)updateWebContentsViewFrame; | 59 - (void)updateWebContentsViewFrame; |
55 | 60 |
56 // Sometimes (when we animate the size of the window) we want to stop resizing | 61 // Sometimes (when we animate the size of the window) we want to stop resizing |
57 // the WebContents's Cocoa view to avoid unnecessary rendering and issues | 62 // the WebContents's Cocoa view to avoid unnecessary rendering and issues |
58 // that can be caused by sizes near 0. | 63 // that can be caused by sizes near 0. |
59 - (void)disableWebContentsViewAutosizing; | 64 - (void)disableWebContentsViewAutosizing; |
60 - (void)enableWebContentsViewAutosizing; | 65 - (void)enableWebContentsViewAutosizing; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 132 |
128 // Adjust NSStatusWindowLevel based on whether panel is always on top | 133 // Adjust NSStatusWindowLevel based on whether panel is always on top |
129 // and whether the panel is minimized. The first version wraps the second | 134 // and whether the panel is minimized. The first version wraps the second |
130 // version using the current panel expanstion state. | 135 // version using the current panel expanstion state. |
131 - (void)updateWindowLevel; | 136 - (void)updateWindowLevel; |
132 - (void)updateWindowLevel:(BOOL)panelIsMinimized; | 137 - (void)updateWindowLevel:(BOOL)panelIsMinimized; |
133 | 138 |
134 // Adjusts NSWindowCollectionBehavior based on whether panel is always on top. | 139 // Adjusts NSWindowCollectionBehavior based on whether panel is always on top. |
135 - (void)updateWindowCollectionBehavior; | 140 - (void)updateWindowCollectionBehavior; |
136 | 141 |
137 // Turns on user-resizable corners/sides indications and enables live resize. | 142 // Updates the tracking area per the window size change. This is needed in |
138 - (void)enableResizeByMouse:(BOOL)enable; | 143 // order to receive the NSMouseMoved notification. |
| 144 - (void)updateTrackingArea; |
139 | 145 |
140 // Turns on/off shadow effect around the window shape. | 146 // Turns on/off shadow effect around the window shape. |
141 - (void)showShadow:(BOOL)show; | 147 - (void)showShadow:(BOOL)show; |
142 | 148 |
143 // Minimize the window to the dock. | 149 // Minimize the window to the dock. |
144 - (void)miniaturize; | 150 - (void)miniaturize; |
145 // Returns true if the window is minimized to the dock. | 151 // Returns true if the window is minimized to the dock. |
146 - (BOOL)isMiniaturized; | 152 - (BOOL)isMiniaturized; |
147 | 153 |
148 - (NSRect)frameRectForContentRect:(NSRect)contentRect; | 154 - (NSRect)frameRectForContentRect:(NSRect)contentRect; |
149 - (NSRect)contentRectForFrameRect:(NSRect)frameRect; | 155 - (NSRect)contentRectForFrameRect:(NSRect)frameRect; |
150 | 156 |
151 @end // @interface PanelWindowController | 157 @end // @interface PanelWindowController |
152 | 158 |
153 #endif // CHROME_BROWSER_UI_COCOA_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_ | 159 #endif // CHROME_BROWSER_UI_COCOA_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_ |
OLD | NEW |