| 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 if (do_coalesced_range_update_) | 317 if (do_coalesced_range_update_) |
| 318 SetSelectedRange(coalesced_range_update_); | 318 SetSelectedRange(coalesced_range_update_); |
| 319 do_coalesced_range_update_ = false; | 319 do_coalesced_range_update_ = false; |
| 320 } | 320 } |
| 321 | 321 |
| 322 base::string16 OmniboxViewMac::GetText() const { | 322 base::string16 OmniboxViewMac::GetText() const { |
| 323 return base::SysNSStringToUTF16([field_ stringValue]); | 323 return base::SysNSStringToUTF16([field_ stringValue]); |
| 324 } | 324 } |
| 325 | 325 |
| 326 NSRange OmniboxViewMac::GetSelectedRange() const { | 326 NSRange OmniboxViewMac::GetSelectedRange() const { |
| 327 AutocompleteTextFieldEditor* editor = | 327 return [[field_ currentEditor] selectedRange]; |
| 328 base::mac::ObjCCastStrict<AutocompleteTextFieldEditor>( | |
| 329 [field_ currentEditor]); | |
| 330 return editor.actualSelectedRange; | |
| 331 } | 328 } |
| 332 | 329 |
| 333 NSRange OmniboxViewMac::GetMarkedRange() const { | 330 NSRange OmniboxViewMac::GetMarkedRange() const { |
| 334 DCHECK([field_ currentEditor]); | 331 DCHECK([field_ currentEditor]); |
| 335 return [(NSTextView*)[field_ currentEditor] markedRange]; | 332 return [(NSTextView*)[field_ currentEditor] markedRange]; |
| 336 } | 333 } |
| 337 | 334 |
| 338 void OmniboxViewMac::SetSelectedRange(const NSRange range) { | 335 void OmniboxViewMac::SetSelectedRange(const NSRange range) { |
| 339 if (in_coalesced_update_block_) { | 336 if (in_coalesced_update_block_) { |
| 340 do_coalesced_range_update_ = true; | 337 do_coalesced_range_update_ = true; |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 display_text); | 1114 display_text); |
| 1118 NSDictionary* notification_info = @{ | 1115 NSDictionary* notification_info = @{ |
| 1119 NSAccessibilityAnnouncementKey : announcement, | 1116 NSAccessibilityAnnouncementKey : announcement, |
| 1120 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) | 1117 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) |
| 1121 }; | 1118 }; |
| 1122 NSAccessibilityPostNotificationWithUserInfo( | 1119 NSAccessibilityPostNotificationWithUserInfo( |
| 1123 [field_ window], | 1120 [field_ window], |
| 1124 NSAccessibilityAnnouncementRequestedNotification, | 1121 NSAccessibilityAnnouncementRequestedNotification, |
| 1125 notification_info); | 1122 notification_info); |
| 1126 } | 1123 } |
| OLD | NEW |