OLD | NEW |
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/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" // IDC_* | 9 #include "chrome/app/chrome_command_ids.h" // IDC_* |
10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 // method from being called unnecessarily. | 395 // method from being called unnecessarily. |
396 textChangedByKeyEvents_ = NO; | 396 textChangedByKeyEvents_ = NO; |
397 return; | 397 return; |
398 } | 398 } |
399 | 399 |
400 // If the escape key was pressed and no revert happened and we're in | 400 // If the escape key was pressed and no revert happened and we're in |
401 // fullscreen mode, make it resign key. | 401 // fullscreen mode, make it resign key. |
402 if (cmd == @selector(cancelOperation:)) { | 402 if (cmd == @selector(cancelOperation:)) { |
403 BrowserWindowController* windowController = | 403 BrowserWindowController* windowController = |
404 [BrowserWindowController browserWindowControllerForView:self]; | 404 [BrowserWindowController browserWindowControllerForView:self]; |
405 if ([windowController isFullscreen]) { | 405 if ([windowController inPresentationMode]) { |
406 [windowController focusTabContents]; | 406 [windowController focusTabContents]; |
407 return; | 407 return; |
408 } | 408 } |
409 } | 409 } |
410 | 410 |
411 [super doCommandBySelector:cmd]; | 411 [super doCommandBySelector:cmd]; |
412 } | 412 } |
413 | 413 |
414 - (void)setAttributedString:(NSAttributedString*)aString { | 414 - (void)setAttributedString:(NSAttributedString*)aString { |
415 NSTextStorage* textStorage = [self textStorage]; | 415 NSTextStorage* textStorage = [self textStorage]; |
416 DCHECK(textStorage); | 416 DCHECK(textStorage); |
417 [textStorage setAttributedString:aString]; | 417 [textStorage setAttributedString:aString]; |
418 | 418 |
419 // The text has been changed programmatically. The observer should know | 419 // The text has been changed programmatically. The observer should know |
420 // this change, so setting |textChangedByKeyEvents_| to NO to | 420 // this change, so setting |textChangedByKeyEvents_| to NO to |
421 // prevent its OnDidChange() method from being called unnecessarily. | 421 // prevent its OnDidChange() method from being called unnecessarily. |
422 textChangedByKeyEvents_ = NO; | 422 textChangedByKeyEvents_ = NO; |
423 } | 423 } |
424 | 424 |
425 - (void)mouseDown:(NSEvent*)theEvent { | 425 - (void)mouseDown:(NSEvent*)theEvent { |
426 // Close the popup before processing the event. | 426 // Close the popup before processing the event. |
427 AutocompleteTextFieldObserver* observer = [self observer]; | 427 AutocompleteTextFieldObserver* observer = [self observer]; |
428 if (observer) | 428 if (observer) |
429 observer->ClosePopup(); | 429 observer->ClosePopup(); |
430 | 430 |
431 [super mouseDown:theEvent]; | 431 [super mouseDown:theEvent]; |
432 } | 432 } |
433 | 433 |
434 @end | 434 @end |
OLD | NEW |