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

Side by Side Diff: chrome/browser/ui/panels/panel_window_controller_cocoa.mm

Issue 8775022: Add Panel::SetPanelBoundsInstantly for all platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/panels/panel_window_controller_cocoa.h" 5 #include "chrome/browser/ui/panels/panel_window_controller_cocoa.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 398
399 - (void)endDrag:(BOOL)cancelled { 399 - (void)endDrag:(BOOL)cancelled {
400 animateOnBoundsChange_ = YES; 400 animateOnBoundsChange_ = YES;
401 windowShim_->panel()->manager()->EndDragging(cancelled); 401 windowShim_->panel()->manager()->EndDragging(cancelled);
402 } 402 }
403 403
404 - (void)dragWithDeltaX:(int)deltaX { 404 - (void)dragWithDeltaX:(int)deltaX {
405 windowShim_->panel()->manager()->Drag(deltaX); 405 windowShim_->panel()->manager()->Drag(deltaX);
406 } 406 }
407 407
408 - (void)setPanelFrame:(NSRect)frame { 408 - (void)setPanelFrame:(NSRect)frame
409 animate:(BOOL)animate {
409 // Setup the whole window as the tracking area so that we can get notified 410 // Setup the whole window as the tracking area so that we can get notified
410 // when the mouse enters or leaves the window. This will make us be able to 411 // when the mouse enters or leaves the window. This will make us be able to
411 // show or hide settings button accordingly. 412 // show or hide settings button accordingly.
412 NSRect localBounds = frame; 413 NSRect localBounds = frame;
413 localBounds.origin = NSZeroPoint; 414 localBounds.origin = NSZeroPoint;
414 windowTrackingArea_.reset( 415 windowTrackingArea_.reset(
415 [[CrTrackingArea alloc] initWithRect:localBounds 416 [[CrTrackingArea alloc] initWithRect:localBounds
416 options:(NSTrackingMouseEnteredAndExited | 417 options:(NSTrackingMouseEnteredAndExited |
417 NSTrackingActiveAlways) 418 NSTrackingActiveAlways)
418 proxiedOwner:self 419 proxiedOwner:self
419 userInfo:nil]); 420 userInfo:nil]);
420 [windowTrackingArea_.get() clearOwnerWhenWindowWillClose:[self window]]; 421 [windowTrackingArea_.get() clearOwnerWhenWindowWillClose:[self window]];
421 [[[[self window] contentView] superview] 422 [[[[self window] contentView] superview]
422 addTrackingArea:windowTrackingArea_.get()]; 423 addTrackingArea:windowTrackingArea_.get()];
423 424
424 if (!animateOnBoundsChange_) { 425 if (!animateOnBoundsChange_ || !animate) {
425 [[self window] setFrame:frame display:YES animate:NO]; 426 [[self window] setFrame:frame display:YES animate:NO];
426 return; 427 return;
427 } 428 }
428 // Will be enabled back in animationDidEnd callback. 429 // Will be enabled back in animationDidEnd callback.
429 [self disableTabContentsViewAutosizing]; 430 [self disableTabContentsViewAutosizing];
430 431
431 NSDictionary *windowResize = [NSDictionary dictionaryWithObjectsAndKeys: 432 NSDictionary *windowResize = [NSDictionary dictionaryWithObjectsAndKeys:
432 [self window], NSViewAnimationTargetKey, 433 [self window], NSViewAnimationTargetKey,
433 [NSValue valueWithRect:frame], NSViewAnimationEndFrameKey, nil]; 434 [NSValue valueWithRect:frame], NSViewAnimationEndFrameKey, nil];
434 435
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 - (BOOL)canBecomeKeyWindow { 570 - (BOOL)canBecomeKeyWindow {
570 // Panel can only gain focus if it is expanded. Minimized panels do not 571 // Panel can only gain focus if it is expanded. Minimized panels do not
571 // participate in Cmd-~ rotation. 572 // participate in Cmd-~ rotation.
572 // TODO(dimich): If it will be ever desired to expand/focus the Panel on 573 // TODO(dimich): If it will be ever desired to expand/focus the Panel on
573 // keyboard navigation or via main menu, the care should be taken to avoid 574 // keyboard navigation or via main menu, the care should be taken to avoid
574 // cases when minimized Panel is getting keyboard input, invisibly. 575 // cases when minimized Panel is getting keyboard input, invisibly.
575 return windowShim_->panel()->expansion_state() == Panel::EXPANDED; 576 return windowShim_->panel()->expansion_state() == Panel::EXPANDED;
576 } 577 }
577 578
578 @end 579 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698