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

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

Issue 2263863002: Remove implementation of Panels on OSes other than ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR feedback Created 4 years, 4 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_COCOA_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_
7
8 // A class acting as the Objective-C controller for the Panel window
9 // object. Handles interactions between Cocoa and the cross-platform
10 // code. Each window has a single titlebar and is managed/owned by Panel.
11
12 #import <Cocoa/Cocoa.h>
13
14 #include <memory>
15
16 #include "base/mac/scoped_nsobject.h"
17 #import "chrome/browser/ui/cocoa/chrome_browser_window.h"
18 #include "chrome/browser/ui/panels/panel.h"
19 #import "ui/base/cocoa/tracking_area.h"
20
21 class PanelCocoa;
22 @class PanelTitlebarViewCocoa;
23
24 @interface PanelWindowCocoaImpl : ChromeBrowserWindow {
25 }
26 @end
27
28 @interface PanelWindowControllerCocoa : NSWindowController
29 <NSWindowDelegate,
30 NSAnimationDelegate> {
31 @private
32 IBOutlet PanelTitlebarViewCocoa* titlebar_view_;
33 std::unique_ptr<PanelCocoa> windowShim_;
34 base::scoped_nsobject<NSString> pendingWindowTitle_;
35 NSViewAnimation* boundsAnimation_; // Lifetime controlled manually, needs
36 // more than just |release| to terminate.
37 BOOL animateOnBoundsChange_;
38 BOOL throbberShouldSpin_;
39 BOOL playingMinimizeAnimation_;
40 float animationStopToShowTitlebarOnly_;
41 BOOL canBecomeKeyWindow_;
42 // Allow a panel to become key if activated via Panel logic, as opposed
43 // to by default system selection. The system will prefer a panel
44 // window over other application windows due to panels having a higher
45 // priority NSWindowLevel, so we distinguish between the two scenarios.
46 BOOL activationRequestedByPanel_;
47 // Is user resizing in progress?
48 BOOL userResizing_;
49 // Tracks the whole window in order to receive NSMouseMoved event.
50 ui::ScopedCrTrackingArea trackingArea_;
51 }
52
53 // Load the window nib and do any Cocoa-specific initialization.
54 - (id)initWithPanel:(PanelCocoa*)window;
55
56 - (Panel*)panel;
57
58 - (void)webContentsInserted:(content::WebContents*)contents;
59 - (void)webContentsDetached:(content::WebContents*)contents;
60
61 - (void)updateWebContentsViewFrame;
62
63 // Sometimes (when we animate the size of the window) we want to stop resizing
64 // the WebContents's Cocoa view to avoid unnecessary rendering and issues
65 // that can be caused by sizes near 0.
66 - (void)disableWebContentsViewAutosizing;
67 - (void)enableWebContentsViewAutosizing;
68
69 // Shows the window for the first time. Only happens once.
70 - (void)revealAnimatedWithFrame:(const NSRect&)frame;
71
72 - (void)updateTitleBar;
73 - (void)updateIcon;
74 - (void)updateThrobber:(BOOL)shouldSpin;
75 - (void)updateTitleBarMinimizeRestoreButtonVisibility;
76
77 // Initiate the closing of the panel, starting from the platform-independent
78 // layer. This will take care of PanelManager, other panels and close the
79 // native window at the end.
80 - (void)closePanel;
81
82 // Minimize/Restore the panel or all panels, depending on the modifier.
83 // Invoked when the minimize/restore button is clicked.
84 - (void)minimizeButtonClicked:(int)modifierFlags;
85 - (void)restoreButtonClicked:(int)modifierFlags;
86
87 // Uses nonblocking animation for moving the Panels. It's especially
88 // important in case of dragging a Panel when other Panels should 'slide out',
89 // indicating the potential drop slot.
90 // |frame| is in screen coordinates, same as [window frame].
91 // |animate| controls if the bounds animation is needed or not.
92 - (void)setPanelFrame:(NSRect)frame
93 animate:(BOOL)animate;
94
95 // Used by PanelTitlebarViewCocoa when user rearranges the Panels by dragging.
96 // |mouseLocation| is in Cocoa's screen coordinates.
97 - (void)startDrag:(NSPoint)mouseLocation;
98 - (void)endDrag:(BOOL)cancelled;
99 - (void)drag:(NSPoint)mouseLocation;
100
101 // Accessor for titlebar view.
102 - (PanelTitlebarViewCocoa*)titlebarView;
103 // Returns the height of titlebar, used to show the titlebar in
104 // "Draw Attention" state.
105 - (int)titlebarHeightInScreenCoordinates;
106
107 // Invoked when user clicks on the titlebar. Attempts to flip the
108 // Minimized/Restored states.
109 - (void)onTitlebarMouseClicked:(int)modifierFlags;
110
111 // Invoked when user double-clicks on the titlebar.
112 - (void)onTitlebarDoubleClicked:(int)modifierFlags;
113
114 // NSAnimationDelegate method, invoked when bounds animation is finished.
115 - (void)animationDidEnd:(NSAnimation*)animation;
116 // Terminates current bounds animation, if any.
117 - (void)terminateBoundsAnimation;
118
119 - (BOOL)isAnimatingBounds;
120
121 // Sets/Removes the Key status from the panel to some other window.
122 - (void)activate;
123 - (void)deactivate;
124
125 // Changes the canBecomeKeyWindow state
126 - (void)preventBecomingKeyWindow:(BOOL)prevent;
127
128 // See Panel::FullScreenModeChanged.
129 - (void)fullScreenModeChanged:(bool)isFullScreen;
130
131 // Helper for NSWindow, returns NO for minimized panels in some cases, so they
132 // are not un-minimized when another panel is minimized.
133 - (BOOL)canBecomeKeyWindow;
134
135 // Returns true if Panel requested activation of the window.
136 - (BOOL)activationRequestedByPanel;
137
138 // Adjust NSStatusWindowLevel based on whether panel is always on top
139 // and whether the panel is minimized. The first version wraps the second
140 // version using the current panel expanstion state.
141 - (void)updateWindowLevel;
142 - (void)updateWindowLevel:(BOOL)panelIsMinimized;
143
144 // Adjusts NSWindowCollectionBehavior based on whether panel is always on top.
145 - (void)updateWindowCollectionBehavior;
146
147 // Updates the tracking area per the window size change. This is needed in
148 // order to receive the NSMouseMoved notification.
149 - (void)updateTrackingArea;
150
151 // Turns on/off shadow effect around the window shape.
152 - (void)showShadow:(BOOL)show;
153
154 // Minimize the window to the dock.
155 - (void)miniaturize;
156 // Returns true if the window is minimized to the dock.
157 - (BOOL)isMiniaturized;
158
159 // Returns true if the user-resizing is allowed for the edge/corner close to
160 // current mouse location.
161 - (BOOL)canResizeByMouseAtCurrentLocation;
162
163 - (NSRect)frameRectForContentRect:(NSRect)contentRect;
164 - (NSRect)contentRectForFrameRect:(NSRect)frameRect;
165
166 @end // @interface PanelWindowController
167
168 #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