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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm

Issue 7599029: Grab bag of bugfixes for Lion fullscreen mode. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Remove unwanted code. Created 9 years, 4 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/cocoa/browser_window_controller_private.mm ('k') | 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 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h"
6 6
7 #include "base/mac/mac_util.h"
Mark Mentovai 2011/08/09 18:44:37 Unneeded.
7 #include "base/string_util.h" 8 #include "base/string_util.h"
8 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" // IDC_* 10 #include "chrome/app/chrome_command_ids.h" // IDC_*
10 #include "chrome/browser/ui/browser_list.h" 11 #include "chrome/browser/ui/browser_list.h"
11 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 12 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
12 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" 13 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
13 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" 14 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
14 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 15 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
15 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
16 #include "ui/base/l10n/l10n_util_mac.h" 17 #include "ui/base/l10n/l10n_util_mac.h"
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 392
392 if (observer && observer->OnDoCommandBySelector(cmd)) { 393 if (observer && observer->OnDoCommandBySelector(cmd)) {
393 // The observer should already be aware of any changes to the text, so 394 // The observer should already be aware of any changes to the text, so
394 // setting |textChangedByKeyEvents_| to NO to prevent its OnDidChange() 395 // setting |textChangedByKeyEvents_| to NO to prevent its OnDidChange()
395 // method from being called unnecessarily. 396 // method from being called unnecessarily.
396 textChangedByKeyEvents_ = NO; 397 textChangedByKeyEvents_ = NO;
397 return; 398 return;
398 } 399 }
399 400
400 // If the escape key was pressed and no revert happened and we're in 401 // If the escape key was pressed and no revert happened and we're in
401 // fullscreen mode, make it resign key. 402 // fullscreen mode, give focus to the web contents, which may dismiss the
403 // overlay.
402 if (cmd == @selector(cancelOperation:)) { 404 if (cmd == @selector(cancelOperation:)) {
403 BrowserWindowController* windowController = 405 BrowserWindowController* windowController =
404 [BrowserWindowController browserWindowControllerForView:self]; 406 [BrowserWindowController browserWindowControllerForView:self];
405 if ([windowController inPresentationMode]) { 407 if ([windowController isFullscreen]) {
406 [windowController focusTabContents]; 408 [windowController focusTabContents];
409 textChangedByKeyEvents_ = NO;
407 return; 410 return;
408 } 411 }
409 } 412 }
410 413
411 [super doCommandBySelector:cmd]; 414 [super doCommandBySelector:cmd];
412 } 415 }
413 416
414 - (void)setAttributedString:(NSAttributedString*)aString { 417 - (void)setAttributedString:(NSAttributedString*)aString {
415 NSTextStorage* textStorage = [self textStorage]; 418 NSTextStorage* textStorage = [self textStorage];
416 DCHECK(textStorage); 419 DCHECK(textStorage);
417 [textStorage setAttributedString:aString]; 420 [textStorage setAttributedString:aString];
418 421
419 // The text has been changed programmatically. The observer should know 422 // The text has been changed programmatically. The observer should know
420 // this change, so setting |textChangedByKeyEvents_| to NO to 423 // this change, so setting |textChangedByKeyEvents_| to NO to
421 // prevent its OnDidChange() method from being called unnecessarily. 424 // prevent its OnDidChange() method from being called unnecessarily.
422 textChangedByKeyEvents_ = NO; 425 textChangedByKeyEvents_ = NO;
423 } 426 }
424 427
425 - (void)mouseDown:(NSEvent*)theEvent { 428 - (void)mouseDown:(NSEvent*)theEvent {
426 // Close the popup before processing the event. 429 // Close the popup before processing the event.
427 AutocompleteTextFieldObserver* observer = [self observer]; 430 AutocompleteTextFieldObserver* observer = [self observer];
428 if (observer) 431 if (observer)
429 observer->ClosePopup(); 432 observer->ClosePopup();
430 433
431 [super mouseDown:theEvent]; 434 [super mouseDown:theEvent];
432 } 435 }
433 436
434 @end 437 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_private.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698