| 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 #include <QuartzCore/QuartzCore.h> | 5 #include <QuartzCore/QuartzCore.h> |
| 6 | 6 |
| 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 NSString* tooltip_nsstring = base::SysWideToNSString(display_text); | 637 NSString* tooltip_nsstring = base::SysWideToNSString(display_text); |
| 638 [cocoa_view_ setToolTipAtMousePoint:tooltip_nsstring]; | 638 [cocoa_view_ setToolTipAtMousePoint:tooltip_nsstring]; |
| 639 } | 639 } |
| 640 } | 640 } |
| 641 | 641 |
| 642 // | 642 // |
| 643 // RenderWidgetHostViewCocoa uses the stored selection text, | 643 // RenderWidgetHostViewCocoa uses the stored selection text, |
| 644 // which implements NSServicesRequests protocol. | 644 // which implements NSServicesRequests protocol. |
| 645 // | 645 // |
| 646 void RenderWidgetHostViewMac::SelectionChanged(const std::string& text, | 646 void RenderWidgetHostViewMac::SelectionChanged(const std::string& text, |
| 647 const ui::Range& range, | 647 const ui::Range& range) { |
| 648 const gfx::Point& start, | |
| 649 const gfx::Point& end) { | |
| 650 selected_text_ = text; | 648 selected_text_ = text; |
| 651 [cocoa_view_ setSelectedRange:range.ToNSRange()]; | 649 [cocoa_view_ setSelectedRange:range.ToNSRange()]; |
| 652 // Updaes markedRange when there is no marked text so that retrieving | 650 // Updaes markedRange when there is no marked text so that retrieving |
| 653 // markedRange immediately after calling setMarkdText: returns the current | 651 // markedRange immediately after calling setMarkdText: returns the current |
| 654 // caret position. | 652 // caret position. |
| 655 if (![cocoa_view_ hasMarkedText]) { | 653 if (![cocoa_view_ hasMarkedText]) { |
| 656 [cocoa_view_ setMarkedRange:range.ToNSRange()]; | 654 [cocoa_view_ setMarkedRange:range.ToNSRange()]; |
| 657 } | 655 } |
| 658 } | 656 } |
| 659 | 657 |
| (...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2627 if (!string) return NO; | 2625 if (!string) return NO; |
| 2628 | 2626 |
| 2629 // If the user is currently using an IME, confirm the IME input, | 2627 // If the user is currently using an IME, confirm the IME input, |
| 2630 // and then insert the text from the service, the same as TextEdit and Safari. | 2628 // and then insert the text from the service, the same as TextEdit and Safari. |
| 2631 [self confirmComposition]; | 2629 [self confirmComposition]; |
| 2632 [self insertText:string]; | 2630 [self insertText:string]; |
| 2633 return YES; | 2631 return YES; |
| 2634 } | 2632 } |
| 2635 | 2633 |
| 2636 @end | 2634 @end |
| OLD | NEW |