| 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 "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #import <Carbon/Carbon.h> | 7 #import <Carbon/Carbon.h> |
| 8 #import <objc/runtime.h> | 8 #import <objc/runtime.h> |
| 9 #include <OpenGL/gl.h> | 9 #include <OpenGL/gl.h> |
| 10 #include <QuartzCore/QuartzCore.h> | 10 #include <QuartzCore/QuartzCore.h> |
| (...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 DCHECK_EQ(GetTextInputManager(), text_input_manager); | 1004 DCHECK_EQ(GetTextInputManager(), text_input_manager); |
| 1005 | 1005 |
| 1006 RenderWidgetHostViewBase* focused_view = GetFocusedViewForTextSelection(); | 1006 RenderWidgetHostViewBase* focused_view = GetFocusedViewForTextSelection(); |
| 1007 if (!focused_view) | 1007 if (!focused_view) |
| 1008 return; | 1008 return; |
| 1009 | 1009 |
| 1010 const TextInputManager::TextSelection* selection = | 1010 const TextInputManager::TextSelection* selection = |
| 1011 GetTextInputManager()->GetTextSelection(focused_view); | 1011 GetTextInputManager()->GetTextSelection(focused_view); |
| 1012 | 1012 |
| 1013 base::string16 text; | 1013 base::string16 text; |
| 1014 if (selection->GetSelectedText(&text)) | 1014 if (!selection->GetSelectedText(&text)) |
| 1015 selected_text_ = base::UTF16ToUTF8(text); | 1015 return; |
| 1016 selected_text_ = base::UTF16ToUTF8(text); |
| 1016 | 1017 |
| 1017 [cocoa_view_ setSelectedRange:selection->range.ToNSRange()]; | 1018 [cocoa_view_ setSelectedRange:selection->range.ToNSRange()]; |
| 1018 // Updates markedRange when there is no marked text so that retrieving | 1019 // Updates markedRange when there is no marked text so that retrieving |
| 1019 // markedRange immediately after calling setMarkdText: returns the current | 1020 // markedRange immediately after calling setMarkdText: returns the current |
| 1020 // caret position. | 1021 // caret position. |
| 1021 if (![cocoa_view_ hasMarkedText]) { | 1022 if (![cocoa_view_ hasMarkedText]) { |
| 1022 [cocoa_view_ setMarkedRange:selection->range.ToNSRange()]; | 1023 [cocoa_view_ setMarkedRange:selection->range.ToNSRange()]; |
| 1023 } | 1024 } |
| 1024 | 1025 |
| 1025 // TODO(ekaramad): The following values are tracked by TextInputManager and | 1026 // TODO(ekaramad): The following values are tracked by TextInputManager and |
| (...skipping 2422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3448 | 3449 |
| 3449 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3450 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3450 // regions that are not draggable. (See ControlRegionView in | 3451 // regions that are not draggable. (See ControlRegionView in |
| 3451 // native_app_window_cocoa.mm). This requires the render host view to be | 3452 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3452 // draggable by default. | 3453 // draggable by default. |
| 3453 - (BOOL)mouseDownCanMoveWindow { | 3454 - (BOOL)mouseDownCanMoveWindow { |
| 3454 return YES; | 3455 return YES; |
| 3455 } | 3456 } |
| 3456 | 3457 |
| 3457 @end | 3458 @end |
| OLD | NEW |