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

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

Issue 9546001: Support detaching/attaching panels via inter-strip drags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mac trybot Created 8 years, 9 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
« no previous file with comments | « chrome/browser/ui/panels/panel_window_controller_cocoa.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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/bundle_locations.h" 10 #include "base/mac/bundle_locations.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 74
75 @implementation PanelWindowControllerCocoa 75 @implementation PanelWindowControllerCocoa
76 76
77 - (id)initWithBrowserWindow:(PanelBrowserWindowCocoa*)window { 77 - (id)initWithBrowserWindow:(PanelBrowserWindowCocoa*)window {
78 NSString* nibpath = 78 NSString* nibpath =
79 [base::mac::FrameworkBundle() pathForResource:@"Panel" ofType:@"nib"]; 79 [base::mac::FrameworkBundle() pathForResource:@"Panel" ofType:@"nib"];
80 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { 80 if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
81 windowShim_.reset(window); 81 windowShim_.reset(window);
82 animateOnBoundsChange_ = YES; 82 animateOnBoundsChange_ = YES;
83 alwaysOnTop_ = YES;
83 } 84 }
84 contentsController_.reset( 85 contentsController_.reset(
85 [[TabContentsController alloc] initWithContents:nil]); 86 [[TabContentsController alloc] initWithContents:nil]);
86 return self; 87 return self;
87 } 88 }
88 89
89 - (void)dealloc { 90 - (void)dealloc {
90 if (windowTrackingArea_.get()) { 91 if (windowTrackingArea_.get()) {
91 [[[[self window] contentView] superview] 92 [[[[self window] contentView] superview]
92 removeTrackingArea:windowTrackingArea_.get()]; 93 removeTrackingArea:windowTrackingArea_.get()];
(...skipping 17 matching lines...) Expand all
110 return [BrowserWindowUtils themePatternPhaseFor:windowView withTabStrip:nil]; 111 return [BrowserWindowUtils themePatternPhaseFor:windowView withTabStrip:nil];
111 } 112 }
112 113
113 - (void)awakeFromNib { 114 - (void)awakeFromNib {
114 NSWindow* window = [self window]; 115 NSWindow* window = [self window];
115 116
116 DCHECK(window); 117 DCHECK(window);
117 DCHECK(titlebar_view_); 118 DCHECK(titlebar_view_);
118 DCHECK_EQ(self, [window delegate]); 119 DCHECK_EQ(self, [window delegate]);
119 120
120 if (!windowShim_->panel()->manager()->is_full_screen()) 121 [self updateWindowLevel];
121 [window setLevel:NSStatusWindowLevel];
122 122
123 if (base::mac::IsOSSnowLeopardOrLater()) { 123 if (base::mac::IsOSSnowLeopardOrLater()) {
124 [window setCollectionBehavior: 124 [window setCollectionBehavior:
125 NSWindowCollectionBehaviorParticipatesInCycle]; 125 NSWindowCollectionBehaviorParticipatesInCycle];
126 } 126 }
127 127
128 [titlebar_view_ attach]; 128 [titlebar_view_ attach];
129 129
130 // Set initial size of the window to match the size of the panel to give 130 // Set initial size of the window to match the size of the panel to give
131 // the renderer the proper size to work with earlier, avoiding a resize 131 // the renderer the proper size to work with earlier, avoiding a resize
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 windowShim_->panel()->manager()->GetNextBrowserWindowToActivate( 627 windowShim_->panel()->manager()->GetNextBrowserWindowToActivate(
628 windowShim_->panel()); 628 windowShim_->panel());
629 629
630 if (browser_window) 630 if (browser_window)
631 browser_window->Activate(); 631 browser_window->Activate();
632 else 632 else
633 [NSApp deactivate]; 633 [NSApp deactivate];
634 } 634 }
635 635
636 - (void)fullScreenModeChanged:(bool)isFullScreen { 636 - (void)fullScreenModeChanged:(bool)isFullScreen {
637 NSWindow* window = [self window]; 637 [self updateWindowLevel];
jennb 2012/03/08 23:44:19 You've ignored the isFullScreen param...
jianli 2012/03/09 21:48:58 Yes since updateWindowLevel checks windowShim_->pa
638 [window setLevel:(isFullScreen ? NSNormalWindowLevel : NSStatusWindowLevel)];
639 } 638 }
640 639
641 - (BOOL)canBecomeKeyWindow { 640 - (BOOL)canBecomeKeyWindow {
642 // Panel can only gain focus if it is expanded. Minimized panels do not 641 // Panel can only gain focus if it is expanded. Minimized panels do not
643 // participate in Cmd-~ rotation. 642 // participate in Cmd-~ rotation.
644 // TODO(dimich): If it will be ever desired to expand/focus the Panel on 643 // TODO(dimich): If it will be ever desired to expand/focus the Panel on
645 // keyboard navigation or via main menu, the care should be taken to avoid 644 // keyboard navigation or via main menu, the care should be taken to avoid
646 // cases when minimized Panel is getting keyboard input, invisibly. 645 // cases when minimized Panel is getting keyboard input, invisibly.
647 return windowShim_->panel()->expansion_state() == Panel::EXPANDED; 646 return windowShim_->panel()->expansion_state() == Panel::EXPANDED;
648 } 647 }
648
649 - (void)setAlwaysOnTop:(bool)onTop {
650 if (alwaysOnTop_ == onTop)
651 return;
652 alwaysOnTop_ = onTop;
653 [self updateWindowLevel];
654 }
655
656 - (void)updateWindowLevel {
657 if (![self isWindowLoaded])
658 return;
659 BOOL onTop = alwaysOnTop_ &&
660 !windowShim_->panel()->manager()->is_full_screen();
661 [[self window] setLevel:(onTop ? NSStatusWindowLevel : NSNormalWindowLevel)];
662 }
649 @end 663 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_window_controller_cocoa.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698