| 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 "ui/views/controls/textfield/native_textfield_views.h" | 5 #include "ui/views/controls/textfield/native_textfield_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "ui/views/controls/textfield/textfield.h" | 32 #include "ui/views/controls/textfield/textfield.h" |
| 33 #include "ui/views/controls/textfield/textfield_controller.h" | 33 #include "ui/views/controls/textfield/textfield_controller.h" |
| 34 #include "ui/views/controls/textfield/textfield_views_model.h" | 34 #include "ui/views/controls/textfield/textfield_views_model.h" |
| 35 #include "ui/views/events/event.h" | 35 #include "ui/views/events/event.h" |
| 36 #include "ui/views/ime/input_method.h" | 36 #include "ui/views/ime/input_method.h" |
| 37 #include "ui/views/metrics.h" | 37 #include "ui/views/metrics.h" |
| 38 #include "ui/views/views_delegate.h" | 38 #include "ui/views/views_delegate.h" |
| 39 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
| 40 | 40 |
| 41 #if defined(USE_AURA) | 41 #if defined(USE_AURA) |
| 42 #include "ui/aura/cursor.h" | 42 #include "ui/base/cursor/cursor.h" |
| 43 #endif | 43 #endif |
| 44 | 44 |
| 45 namespace { | 45 namespace { |
| 46 | 46 |
| 47 // Text color for read only. | 47 // Text color for read only. |
| 48 const SkColor kReadonlyTextColor = SK_ColorDKGRAY; | 48 const SkColor kReadonlyTextColor = SK_ColorDKGRAY; |
| 49 | 49 |
| 50 // Default "system" color for text cursor. | 50 // Default "system" color for text cursor. |
| 51 const SkColor kDefaultCursorColor = SK_ColorBLACK; | 51 const SkColor kDefaultCursorColor = SK_ColorBLACK; |
| 52 | 52 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 OnCaretBoundsChanged(); | 258 OnCaretBoundsChanged(); |
| 259 SchedulePaint(); | 259 SchedulePaint(); |
| 260 OnAfterUserAction(); | 260 OnAfterUserAction(); |
| 261 } | 261 } |
| 262 | 262 |
| 263 gfx::NativeCursor NativeTextfieldViews::GetCursor(const MouseEvent& event) { | 263 gfx::NativeCursor NativeTextfieldViews::GetCursor(const MouseEvent& event) { |
| 264 bool in_selection = GetRenderText()->IsPointInSelection(event.location()); | 264 bool in_selection = GetRenderText()->IsPointInSelection(event.location()); |
| 265 bool drag_event = event.type() == ui::ET_MOUSE_DRAGGED; | 265 bool drag_event = event.type() == ui::ET_MOUSE_DRAGGED; |
| 266 bool text_cursor = !initiating_drag_ && (drag_event || !in_selection); | 266 bool text_cursor = !initiating_drag_ && (drag_event || !in_selection); |
| 267 #if defined(USE_AURA) | 267 #if defined(USE_AURA) |
| 268 return text_cursor ? aura::kCursorIBeam : aura::kCursorNull; | 268 return text_cursor ? ui::kCursorIBeam : ui::kCursorNull; |
| 269 #elif defined(OS_WIN) | 269 #elif defined(OS_WIN) |
| 270 static HCURSOR ibeam = LoadCursor(NULL, IDC_IBEAM); | 270 static HCURSOR ibeam = LoadCursor(NULL, IDC_IBEAM); |
| 271 static HCURSOR arrow = LoadCursor(NULL, IDC_ARROW); | 271 static HCURSOR arrow = LoadCursor(NULL, IDC_ARROW); |
| 272 return text_cursor ? ibeam : arrow; | 272 return text_cursor ? ibeam : arrow; |
| 273 #endif | 273 #endif |
| 274 } | 274 } |
| 275 | 275 |
| 276 ///////////////////////////////////////////////////////////////// | 276 ///////////////////////////////////////////////////////////////// |
| 277 // NativeTextfieldViews, ContextMenuController overrides: | 277 // NativeTextfieldViews, ContextMenuController overrides: |
| 278 void NativeTextfieldViews::ShowContextMenuForView(View* source, | 278 void NativeTextfieldViews::ShowContextMenuForView(View* source, |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 | 1115 |
| 1116 #if defined(USE_AURA) | 1116 #if defined(USE_AURA) |
| 1117 // static | 1117 // static |
| 1118 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 1118 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
| 1119 Textfield* field) { | 1119 Textfield* field) { |
| 1120 return new NativeTextfieldViews(field); | 1120 return new NativeTextfieldViews(field); |
| 1121 } | 1121 } |
| 1122 #endif | 1122 #endif |
| 1123 | 1123 |
| 1124 } // namespace views | 1124 } // namespace views |
| OLD | NEW |