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

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

Issue 8393014: Hack to fix Panel focus issues on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « no previous file | no next file » | 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) 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 NSView* contentView = [window contentView]; 181 NSView* contentView = [window contentView];
182 [contentView setAutoresizesSubviews:NO]; 182 [contentView setAutoresizesSubviews:NO];
183 183
184 // We grow the window from the bottom up to produce a 'reveal' animation. 184 // We grow the window from the bottom up to produce a 'reveal' animation.
185 NSRect startFrame = NSMakeRect(NSMinX(frame), NSMinY(frame), 185 NSRect startFrame = NSMakeRect(NSMinX(frame), NSMinY(frame),
186 NSWidth(frame), kMinimumWindowSize); 186 NSWidth(frame), kMinimumWindowSize);
187 [window setFrame:startFrame display:NO animate:NO]; 187 [window setFrame:startFrame display:NO animate:NO];
188 // Shows the window without making it key, on top of its layer, even if 188 // Shows the window without making it key, on top of its layer, even if
189 // Chromium is not an active app. 189 // Chromium is not an active app.
190 [window orderFrontRegardless]; 190 [window orderFrontRegardless];
191 TabContents* tab_contents =
jennb 2011/10/26 17:48:09 Could you also add a comment explaining why we nee
192 windowShim_->panel()->browser()->GetSelectedTabContents();
193 DCHECK(tab_contents);
Dmitry Titov 2011/10/26 01:47:15 I would replace this DCHECK with if(). It can happ
jennb 2011/10/26 17:48:09 Yes, please replace with if() before committing. T
194 tab_contents->GetRenderWidgetHostView()->SetActive(false);
191 [window setFrame:frame display:YES animate:YES]; 195 [window setFrame:frame display:YES animate:YES];
192 196
193 [contentView setAutoresizesSubviews:YES]; 197 [contentView setAutoresizesSubviews:YES];
194 } 198 }
195 199
196 - (void)updateTitleBar { 200 - (void)updateTitleBar {
197 NSString* newTitle = base::SysUTF16ToNSString( 201 NSString* newTitle = base::SysUTF16ToNSString(
198 windowShim_->browser()->GetWindowTitleForCurrentTab()); 202 windowShim_->browser()->GetWindowTitleForCurrentTab());
199 pendingWindowTitle_.reset( 203 pendingWindowTitle_.reset(
200 [BrowserWindowUtils scheduleReplaceOldTitle:pendingWindowTitle_.get() 204 [BrowserWindowUtils scheduleReplaceOldTitle:pendingWindowTitle_.get()
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 - (BOOL)canBecomeKeyWindow { 556 - (BOOL)canBecomeKeyWindow {
553 // Panel can only gain focus if it is expanded. Minimized panels do not 557 // Panel can only gain focus if it is expanded. Minimized panels do not
554 // participate in Cmd-~ rotation. 558 // participate in Cmd-~ rotation.
555 // TODO(dimich): If it will be ever desired to expand/focus the Panel on 559 // TODO(dimich): If it will be ever desired to expand/focus the Panel on
556 // keyboard navigation or via main menu, the care should be taken to avoid 560 // keyboard navigation or via main menu, the care should be taken to avoid
557 // cases when minimized Panel is getting keyboard input, invisibly. 561 // cases when minimized Panel is getting keyboard input, invisibly.
558 return windowShim_->panel()->expansion_state() == Panel::EXPANDED; 562 return windowShim_->panel()->expansion_state() == Panel::EXPANDED;
559 } 563 }
560 564
561 @end 565 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698