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/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 362 |
363 // Transition the user into keyword mode using their default search provider. | 363 // Transition the user into keyword mode using their default search provider. |
364 model()->EnterKeywordModeForDefaultSearchProvider( | 364 model()->EnterKeywordModeForDefaultSearchProvider( |
365 KeywordModeEntryMethod::KEYBOARD_SHORTCUT); | 365 KeywordModeEntryMethod::KEYBOARD_SHORTCUT); |
366 } | 366 } |
367 | 367 |
368 bool OmniboxViewMac::IsSelectAll() const { | 368 bool OmniboxViewMac::IsSelectAll() const { |
369 if (![field_ currentEditor]) | 369 if (![field_ currentEditor]) |
370 return true; | 370 return true; |
371 const NSRange all_range = NSMakeRange(0, GetTextLength()); | 371 const NSRange all_range = NSMakeRange(0, GetTextLength()); |
| 372 if (all_range.length == 0) |
| 373 return false; |
372 return NSEqualRanges(all_range, GetSelectedRange()); | 374 return NSEqualRanges(all_range, GetSelectedRange()); |
373 } | 375 } |
374 | 376 |
375 bool OmniboxViewMac::DeleteAtEndPressed() { | 377 bool OmniboxViewMac::DeleteAtEndPressed() { |
376 return delete_at_end_pressed_; | 378 return delete_at_end_pressed_; |
377 } | 379 } |
378 | 380 |
379 void OmniboxViewMac::GetSelectionBounds(base::string16::size_type* start, | 381 void OmniboxViewMac::GetSelectionBounds(base::string16::size_type* start, |
380 base::string16::size_type* end) const { | 382 base::string16::size_type* end) const { |
381 if (![field_ currentEditor]) { | 383 if (![field_ currentEditor]) { |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 display_text); | 1089 display_text); |
1088 NSDictionary* notification_info = @{ | 1090 NSDictionary* notification_info = @{ |
1089 NSAccessibilityAnnouncementKey : announcement, | 1091 NSAccessibilityAnnouncementKey : announcement, |
1090 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) | 1092 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) |
1091 }; | 1093 }; |
1092 NSAccessibilityPostNotificationWithUserInfo( | 1094 NSAccessibilityPostNotificationWithUserInfo( |
1093 [field_ window], | 1095 [field_ window], |
1094 NSAccessibilityAnnouncementRequestedNotification, | 1096 NSAccessibilityAnnouncementRequestedNotification, |
1095 notification_info); | 1097 notification_info); |
1096 } | 1098 } |
OLD | NEW |