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

Side by Side Diff: chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.h

Issue 23918002: Switch to doing user-resizing via system for panels on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch to reland Created 7 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_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 // Is user resizing in progress?
47 BOOL userResizing_;
48 // Tracks the whole window in order to receive NSMouseMoved event.
49 ui::ScopedCrTrackingArea trackingArea_;
46 } 50 }
47 51
48 // Load the window nib and do any Cocoa-specific initialization. 52 // Load the window nib and do any Cocoa-specific initialization.
49 - (id)initWithPanel:(PanelCocoa*)window; 53 - (id)initWithPanel:(PanelCocoa*)window;
50 54
55 - (Panel*)panel;
56
51 - (void)webContentsInserted:(content::WebContents*)contents; 57 - (void)webContentsInserted:(content::WebContents*)contents;
52 - (void)webContentsDetached:(content::WebContents*)contents; 58 - (void)webContentsDetached:(content::WebContents*)contents;
53 59
54 - (void)updateWebContentsViewFrame; 60 - (void)updateWebContentsViewFrame;
55 61
56 // Sometimes (when we animate the size of the window) we want to stop resizing 62 // 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 63 // the WebContents's Cocoa view to avoid unnecessary rendering and issues
58 // that can be caused by sizes near 0. 64 // that can be caused by sizes near 0.
59 - (void)disableWebContentsViewAutosizing; 65 - (void)disableWebContentsViewAutosizing;
60 - (void)enableWebContentsViewAutosizing; 66 - (void)enableWebContentsViewAutosizing;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 136
131 // Adjust NSStatusWindowLevel based on whether panel is always on top 137 // Adjust NSStatusWindowLevel based on whether panel is always on top
132 // and whether the panel is minimized. The first version wraps the second 138 // and whether the panel is minimized. The first version wraps the second
133 // version using the current panel expanstion state. 139 // version using the current panel expanstion state.
134 - (void)updateWindowLevel; 140 - (void)updateWindowLevel;
135 - (void)updateWindowLevel:(BOOL)panelIsMinimized; 141 - (void)updateWindowLevel:(BOOL)panelIsMinimized;
136 142
137 // Adjusts NSWindowCollectionBehavior based on whether panel is always on top. 143 // Adjusts NSWindowCollectionBehavior based on whether panel is always on top.
138 - (void)updateWindowCollectionBehavior; 144 - (void)updateWindowCollectionBehavior;
139 145
140 // Turns on user-resizable corners/sides indications and enables live resize. 146 // Updates the tracking area per the window size change. This is needed in
141 - (void)enableResizeByMouse:(BOOL)enable; 147 // order to receive the NSMouseMoved notification.
148 - (void)updateTrackingArea;
142 149
143 // Turns on/off shadow effect around the window shape. 150 // Turns on/off shadow effect around the window shape.
144 - (void)showShadow:(BOOL)show; 151 - (void)showShadow:(BOOL)show;
145 152
146 // Minimize the window to the dock. 153 // Minimize the window to the dock.
147 - (void)miniaturize; 154 - (void)miniaturize;
148 // Returns true if the window is minimized to the dock. 155 // Returns true if the window is minimized to the dock.
149 - (BOOL)isMiniaturized; 156 - (BOOL)isMiniaturized;
150 157
158 // Returns true if the user-resizing is allowed for the edge/corner close to
159 // current mouse location.
160 - (BOOL)canResizeByMouseAtCurrentLocation;
161
151 - (NSRect)frameRectForContentRect:(NSRect)contentRect; 162 - (NSRect)frameRectForContentRect:(NSRect)contentRect;
152 - (NSRect)contentRectForFrameRect:(NSRect)frameRect; 163 - (NSRect)contentRectForFrameRect:(NSRect)frameRect;
153 164
154 @end // @interface PanelWindowController 165 @end // @interface PanelWindowController
155 166
156 #endif // CHROME_BROWSER_UI_COCOA_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_ 167 #endif // CHROME_BROWSER_UI_COCOA_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/panels/panel_utils_cocoa.mm ('k') | chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698