| 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/mac/sdk_forward_declarations.h" | 7 #include "base/mac/sdk_forward_declarations.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" // IDC_* | 10 #include "chrome/app/chrome_command_ids.h" // IDC_* |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 // (Overridden from NSResponder) | 317 // (Overridden from NSResponder) |
| 318 - (BOOL)becomeFirstResponder { | 318 - (BOOL)becomeFirstResponder { |
| 319 BOOL doAccept = [super becomeFirstResponder]; | 319 BOOL doAccept = [super becomeFirstResponder]; |
| 320 AutocompleteTextField* field = [self delegate]; | 320 AutocompleteTextField* field = [self delegate]; |
| 321 // Only lock visibility if we've been set up with a delegate (the text field). | 321 // Only lock visibility if we've been set up with a delegate (the text field). |
| 322 if (doAccept && field) { | 322 if (doAccept && field) { |
| 323 // Give the text field ownership of the visibility lock. (The first | 323 // Give the text field ownership of the visibility lock. (The first |
| 324 // responder dance between the field and the field editor is a little | 324 // responder dance between the field and the field editor is a little |
| 325 // weird.) | 325 // weird.) |
| 326 [[BrowserWindowController browserWindowControllerForView:field] | 326 [[BrowserWindowController browserWindowControllerForView:field] |
| 327 lockBarVisibilityForOwner:field | 327 lockToolbarVisibilityForOwner:field |
| 328 withAnimation:YES]; | 328 withAnimation:YES]; |
| 329 } | 329 } |
| 330 return doAccept; | 330 return doAccept; |
| 331 } | 331 } |
| 332 | 332 |
| 333 // (Overridden from NSResponder) | 333 // (Overridden from NSResponder) |
| 334 - (BOOL)resignFirstResponder { | 334 - (BOOL)resignFirstResponder { |
| 335 BOOL doResign = [super resignFirstResponder]; | 335 BOOL doResign = [super resignFirstResponder]; |
| 336 AutocompleteTextField* field = [self delegate]; | 336 AutocompleteTextField* field = [self delegate]; |
| 337 // Only lock visibility if we've been set up with a delegate (the text field). | 337 // Only lock visibility if we've been set up with a delegate (the text field). |
| 338 if (doResign && field) { | 338 if (doResign && field) { |
| 339 // Give the text field ownership of the visibility lock. | 339 // Give the text field ownership of the visibility lock. |
| 340 [[BrowserWindowController browserWindowControllerForView:field] | 340 [[BrowserWindowController browserWindowControllerForView:field] |
| 341 releaseBarVisibilityForOwner:field | 341 releaseToolbarVisibilityForOwner:field |
| 342 withAnimation:YES]; | 342 withAnimation:YES]; |
| 343 | 343 |
| 344 AutocompleteTextFieldObserver* observer = [self observer]; | 344 AutocompleteTextFieldObserver* observer = [self observer]; |
| 345 if (observer) | 345 if (observer) |
| 346 observer->OnKillFocus(); | 346 observer->OnKillFocus(); |
| 347 } | 347 } |
| 348 return doResign; | 348 return doResign; |
| 349 } | 349 } |
| 350 | 350 |
| 351 - (void)mouseDown:(NSEvent*)event { | 351 - (void)mouseDown:(NSEvent*)event { |
| 352 AutocompleteTextFieldObserver* observer = [self observer]; | 352 AutocompleteTextFieldObserver* observer = [self observer]; |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 // ThemedWindowDrawing implementation. | 604 // ThemedWindowDrawing implementation. |
| 605 | 605 |
| 606 - (void)windowDidChangeTheme { | 606 - (void)windowDidChangeTheme { |
| 607 [self updateColorsToMatchTheme]; | 607 [self updateColorsToMatchTheme]; |
| 608 } | 608 } |
| 609 | 609 |
| 610 - (void)windowDidChangeActive { | 610 - (void)windowDidChangeActive { |
| 611 } | 611 } |
| 612 | 612 |
| 613 @end | 613 @end |
| OLD | NEW |