| OLD | NEW |
| 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/cocoa/omnibox/omnibox_view_mac.h" | 5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
| 6 | 6 |
| 7 #include <Carbon/Carbon.h> // kVK_Return | 7 #include <Carbon/Carbon.h> // kVK_Return |
| 8 | 8 |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 368 |
| 369 if (notify_text_changed) | 369 if (notify_text_changed) |
| 370 TextChanged(); | 370 TextChanged(); |
| 371 } | 371 } |
| 372 | 372 |
| 373 void OmniboxViewMac::EnterKeywordModeForDefaultSearchProvider() { | 373 void OmniboxViewMac::EnterKeywordModeForDefaultSearchProvider() { |
| 374 // We need to do this first, else |SetSelectedRange()| won't work. | 374 // We need to do this first, else |SetSelectedRange()| won't work. |
| 375 FocusLocation(true); | 375 FocusLocation(true); |
| 376 | 376 |
| 377 // Transition the user into keyword mode using their default search provider. | 377 // Transition the user into keyword mode using their default search provider. |
| 378 // Select their query if they typed one. | |
| 379 model()->EnterKeywordModeForDefaultSearchProvider( | 378 model()->EnterKeywordModeForDefaultSearchProvider( |
| 380 KeywordModeEntryMethod::KEYBOARD_SHORTCUT); | 379 KeywordModeEntryMethod::KEYBOARD_SHORTCUT); |
| 381 SelectAll(false); | |
| 382 } | 380 } |
| 383 | 381 |
| 384 bool OmniboxViewMac::IsSelectAll() const { | 382 bool OmniboxViewMac::IsSelectAll() const { |
| 385 if (![field_ currentEditor]) | 383 if (![field_ currentEditor]) |
| 386 return true; | 384 return true; |
| 387 const NSRange all_range = NSMakeRange(0, GetTextLength()); | 385 const NSRange all_range = NSMakeRange(0, GetTextLength()); |
| 388 return NSEqualRanges(all_range, GetSelectedRange()); | 386 return NSEqualRanges(all_range, GetSelectedRange()); |
| 389 } | 387 } |
| 390 | 388 |
| 391 bool OmniboxViewMac::DeleteAtEndPressed() { | 389 bool OmniboxViewMac::DeleteAtEndPressed() { |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 display_text); | 1112 display_text); |
| 1115 NSDictionary* notification_info = @{ | 1113 NSDictionary* notification_info = @{ |
| 1116 NSAccessibilityAnnouncementKey : announcement, | 1114 NSAccessibilityAnnouncementKey : announcement, |
| 1117 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) | 1115 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) |
| 1118 }; | 1116 }; |
| 1119 NSAccessibilityPostNotificationWithUserInfo( | 1117 NSAccessibilityPostNotificationWithUserInfo( |
| 1120 [field_ window], | 1118 [field_ window], |
| 1121 NSAccessibilityAnnouncementRequestedNotification, | 1119 NSAccessibilityAnnouncementRequestedNotification, |
| 1122 notification_info); | 1120 notification_info); |
| 1123 } | 1121 } |
| OLD | NEW |