| 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_]; |
| 214 } |
| 215 } |
| 216 |
| 201 - (NSPoint)originForSheet:(id<ConstrainedWindowSheet>)sheet | 217 - (NSPoint)originForSheet:(id<ConstrainedWindowSheet>)sheet |
| 202 withWindowSize:(NSSize)size { | 218 withWindowSize:(NSSize)size { |
| 203 ConstrainedWindowSheetInfo* info = [self findSheetInfoForSheet:sheet]; | 219 ConstrainedWindowSheetInfo* info = [self findSheetInfoForSheet:sheet]; |
| 204 DCHECK(info); | 220 DCHECK(info); |
| 205 NSRect containerRect = | 221 NSRect containerRect = |
| 206 [self overlayWindowFrameForParentView:[info parentView]]; | 222 [self overlayWindowFrameForParentView:[info parentView]]; |
| 207 return [self originForSheetSize:size inContainerRect:containerRect]; | 223 return [self originForSheetSize:size inContainerRect:containerRect]; |
| 208 } | 224 } |
| 209 | 225 |
| 210 - (void)closeSheet:(id<ConstrainedWindowSheet>)sheet { | 226 - (void)closeSheet:(id<ConstrainedWindowSheet>)sheet { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 276 |
| 261 // Delete this instance. | 277 // Delete this instance. |
| 262 [g_sheetControllers removeObjectForKey:GetKeyForParentWindow(parentWindow_)]; | 278 [g_sheetControllers removeObjectForKey:GetKeyForParentWindow(parentWindow_)]; |
| 263 if (![g_sheetControllers count]) { | 279 if (![g_sheetControllers count]) { |
| 264 [g_sheetControllers release]; | 280 [g_sheetControllers release]; |
| 265 g_sheetControllers = nil; | 281 g_sheetControllers = nil; |
| 266 } | 282 } |
| 267 } | 283 } |
| 268 | 284 |
| 269 - (void)onParentWindowSizeDidChange:(NSNotification*)note { | 285 - (void)onParentWindowSizeDidChange:(NSNotification*)note { |
| 286 if (isSheetHiddenForFullscreen_) |
| 287 return; |
| 288 |
| 270 [self updateSheetPosition:activeView_]; | 289 [self updateSheetPosition:activeView_]; |
| 271 } | 290 } |
| 272 | 291 |
| 273 - (void)updateSheetPosition:(NSView*)parentView { | 292 - (void)updateSheetPosition:(NSView*)parentView { |
| 274 ConstrainedWindowSheetInfo* info = | 293 ConstrainedWindowSheetInfo* info = |
| 275 [self findSheetInfoForParentView:parentView]; | 294 [self findSheetInfoForParentView:parentView]; |
| 276 if (!info) | 295 if (!info) |
| 277 return; | 296 return; |
| 278 | 297 |
| 279 NSRect rect = [self overlayWindowFrameForParentView:parentView]; | 298 NSRect rect = [self overlayWindowFrameForParentView:parentView]; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 if ([activeView_ isEqual:[info parentView]]) | 353 if ([activeView_ isEqual:[info parentView]]) |
| 335 activeView_.reset(); | 354 activeView_.reset(); |
| 336 | 355 |
| 337 [parentWindow_ removeChildWindow:[info overlayWindow]]; | 356 [parentWindow_ removeChildWindow:[info overlayWindow]]; |
| 338 [[info sheet] closeSheetWithAnimation:withAnimation]; | 357 [[info sheet] closeSheetWithAnimation:withAnimation]; |
| 339 [[info overlayWindow] close]; | 358 [[info overlayWindow] close]; |
| 340 [sheets_ removeObject:info]; | 359 [sheets_ removeObject:info]; |
| 341 } | 360 } |
| 342 | 361 |
| 343 @end | 362 @end |
| OLD | NEW |