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 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h" | 5 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h" | 10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 | 191 |
192 // Show the sheet. | 192 // Show the sheet. |
193 [info showSheet]; | 193 [info showSheet]; |
194 } | 194 } |
195 | 195 |
196 - (void)hideSheet { | 196 - (void)hideSheet { |
197 [[self findSheetInfoForParentView:activeView_] hideSheet]; | 197 [[self findSheetInfoForParentView:activeView_] hideSheet]; |
198 activeView_.reset(); | 198 activeView_.reset(); |
199 } | 199 } |
200 | 200 |
201 - (void)hideSheetForFullscreenTransition { | |
202 if (ConstrainedWindowSheetInfo* sheetInfo = | |
203 [self findSheetInfoForParentView:activeView_]) { | |
204 [sheetInfo hideSheet]; | |
205 isSheetHiddenForFullscreen_ = YES; | |
206 } | |
207 } | |
208 | |
209 - (void)unhideSheetForFullscreenTransition { | |
210 isSheetHiddenForFullscreen_ = NO; | |
211 if (ConstrainedWindowSheetInfo* sheetInfo = | |
212 [self findSheetInfoForParentView:activeView_]) | |
213 [self showSheet:[sheetInfo sheet] forParentView:activeView_]; | |
Robert Sesek
2015/12/04 17:56:30
nit: needs {} since the condition is multi-line
spqchan
2015/12/07 18:27:52
Done.
| |
214 } | |
215 | |
201 - (NSPoint)originForSheet:(id<ConstrainedWindowSheet>)sheet | 216 - (NSPoint)originForSheet:(id<ConstrainedWindowSheet>)sheet |
202 withWindowSize:(NSSize)size { | 217 withWindowSize:(NSSize)size { |
203 ConstrainedWindowSheetInfo* info = [self findSheetInfoForSheet:sheet]; | 218 ConstrainedWindowSheetInfo* info = [self findSheetInfoForSheet:sheet]; |
204 DCHECK(info); | 219 DCHECK(info); |
205 NSRect containerRect = | 220 NSRect containerRect = |
206 [self overlayWindowFrameForParentView:[info parentView]]; | 221 [self overlayWindowFrameForParentView:[info parentView]]; |
207 return [self originForSheetSize:size inContainerRect:containerRect]; | 222 return [self originForSheetSize:size inContainerRect:containerRect]; |
208 } | 223 } |
209 | 224 |
210 - (void)closeSheet:(id<ConstrainedWindowSheet>)sheet { | 225 - (void)closeSheet:(id<ConstrainedWindowSheet>)sheet { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 | 275 |
261 // Delete this instance. | 276 // Delete this instance. |
262 [g_sheetControllers removeObjectForKey:GetKeyForParentWindow(parentWindow_)]; | 277 [g_sheetControllers removeObjectForKey:GetKeyForParentWindow(parentWindow_)]; |
263 if (![g_sheetControllers count]) { | 278 if (![g_sheetControllers count]) { |
264 [g_sheetControllers release]; | 279 [g_sheetControllers release]; |
265 g_sheetControllers = nil; | 280 g_sheetControllers = nil; |
266 } | 281 } |
267 } | 282 } |
268 | 283 |
269 - (void)onParentWindowSizeDidChange:(NSNotification*)note { | 284 - (void)onParentWindowSizeDidChange:(NSNotification*)note { |
285 if (isSheetHiddenForFullscreen_) | |
286 return; | |
287 | |
270 [self updateSheetPosition:activeView_]; | 288 [self updateSheetPosition:activeView_]; |
271 } | 289 } |
272 | 290 |
273 - (void)updateSheetPosition:(NSView*)parentView { | 291 - (void)updateSheetPosition:(NSView*)parentView { |
274 ConstrainedWindowSheetInfo* info = | 292 ConstrainedWindowSheetInfo* info = |
275 [self findSheetInfoForParentView:parentView]; | 293 [self findSheetInfoForParentView:parentView]; |
276 if (!info) | 294 if (!info) |
277 return; | 295 return; |
278 | 296 |
279 NSRect rect = [self overlayWindowFrameForParentView:parentView]; | 297 NSRect rect = [self overlayWindowFrameForParentView:parentView]; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 if ([activeView_ isEqual:[info parentView]]) | 352 if ([activeView_ isEqual:[info parentView]]) |
335 activeView_.reset(); | 353 activeView_.reset(); |
336 | 354 |
337 [parentWindow_ removeChildWindow:[info overlayWindow]]; | 355 [parentWindow_ removeChildWindow:[info overlayWindow]]; |
338 [[info sheet] closeSheetWithAnimation:withAnimation]; | 356 [[info sheet] closeSheetWithAnimation:withAnimation]; |
339 [[info overlayWindow] close]; | 357 [[info overlayWindow] close]; |
340 [sheets_ removeObject:info]; | 358 [sheets_ removeObject:info]; |
341 } | 359 } |
342 | 360 |
343 @end | 361 @end |
OLD | NEW |