OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | |
12 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
13 #include "base/i18n/case_conversion.h" | 12 #include "base/i18n/case_conversion.h" |
14 #include "base/logging.h" | 13 #include "base/logging.h" |
15 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
16 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
17 #include "grit/app_locale_settings.h" | 16 #include "grit/app_locale_settings.h" |
18 #include "grit/ui_strings.h" | 17 #include "grit/ui_strings.h" |
19 #include "third_party/icu/public/common/unicode/uchar.h" | 18 #include "third_party/icu/public/common/unicode/uchar.h" |
20 #include "third_party/skia/include/core/SkColor.h" | 19 #include "third_party/skia/include/core/SkColor.h" |
21 #include "ui/base/clipboard/clipboard.h" | 20 #include "ui/base/clipboard/clipboard.h" |
22 #include "ui/base/dragdrop/drag_drop_types.h" | 21 #include "ui/base/dragdrop/drag_drop_types.h" |
23 #include "ui/base/dragdrop/drag_utils.h" | 22 #include "ui/base/dragdrop/drag_utils.h" |
24 #include "ui/base/events/event.h" | 23 #include "ui/base/events/event.h" |
25 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
26 #include "ui/base/range/range.h" | 25 #include "ui/base/range/range.h" |
27 #include "ui/base/ui_base_switches.h" | 26 #include "ui/base/ui_base_switches_util.h" |
28 #include "ui/compositor/layer.h" | 27 #include "ui/compositor/layer.h" |
29 #include "ui/gfx/canvas.h" | 28 #include "ui/gfx/canvas.h" |
30 #include "ui/gfx/insets.h" | 29 #include "ui/gfx/insets.h" |
31 #include "ui/gfx/render_text.h" | 30 #include "ui/gfx/render_text.h" |
32 #include "ui/gfx/text_constants.h" | 31 #include "ui/gfx/text_constants.h" |
33 #include "ui/native_theme/native_theme.h" | 32 #include "ui/native_theme/native_theme.h" |
34 #include "ui/views/background.h" | 33 #include "ui/views/background.h" |
35 #include "ui/views/border.h" | 34 #include "ui/views/border.h" |
36 #include "ui/views/controls/focusable_border.h" | 35 #include "ui/views/controls/focusable_border.h" |
37 #include "ui/views/controls/menu/menu_item_view.h" | 36 #include "ui/views/controls/menu/menu_item_view.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 if (!GetRenderText()->IsPointInSelection(event->location())) { | 193 if (!GetRenderText()->IsPointInSelection(event->location())) { |
195 OnBeforeUserAction(); | 194 OnBeforeUserAction(); |
196 model_->SelectWord(); | 195 model_->SelectWord(); |
197 touch_selection_controller_.reset( | 196 touch_selection_controller_.reset( |
198 ui::TouchSelectionController::create(this)); | 197 ui::TouchSelectionController::create(this)); |
199 OnCaretBoundsChanged(); | 198 OnCaretBoundsChanged(); |
200 SchedulePaint(); | 199 SchedulePaint(); |
201 OnAfterUserAction(); | 200 OnAfterUserAction(); |
202 if (touch_selection_controller_.get()) | 201 if (touch_selection_controller_.get()) |
203 event->SetHandled(); | 202 event->SetHandled(); |
204 } else if (CommandLine::ForCurrentProcess()->HasSwitch( | 203 } else if (switches::IsTouchDragDropEnabled()) { |
205 switches::kEnableTouchDragDrop)) { | |
206 touch_selection_controller_.reset(); | 204 touch_selection_controller_.reset(); |
207 } else { | 205 } else { |
208 if (!touch_selection_controller_.get()) | 206 if (!touch_selection_controller_.get()) |
209 CreateTouchSelectionControllerAndNotifyIt(); | 207 CreateTouchSelectionControllerAndNotifyIt(); |
210 if (touch_selection_controller_.get()) | 208 if (touch_selection_controller_.get()) |
211 event->SetHandled(); | 209 event->SetHandled(); |
212 } | 210 } |
213 return; | 211 return; |
214 case ui::ET_GESTURE_LONG_TAP: | 212 case ui::ET_GESTURE_LONG_TAP: |
215 if (!touch_selection_controller_.get()) | 213 if (!touch_selection_controller_.get()) |
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 | 1429 |
1432 void NativeTextfieldViews::PlatformGestureEventHandling( | 1430 void NativeTextfieldViews::PlatformGestureEventHandling( |
1433 const ui::GestureEvent* event) { | 1431 const ui::GestureEvent* event) { |
1434 #if defined(OS_WIN) && defined(USE_AURA) | 1432 #if defined(OS_WIN) && defined(USE_AURA) |
1435 if (event->type() == ui::ET_GESTURE_TAP_DOWN && !textfield_->read_only()) | 1433 if (event->type() == ui::ET_GESTURE_TAP_DOWN && !textfield_->read_only()) |
1436 base::win::DisplayVirtualKeyboard(); | 1434 base::win::DisplayVirtualKeyboard(); |
1437 #endif | 1435 #endif |
1438 } | 1436 } |
1439 | 1437 |
1440 } // namespace views | 1438 } // namespace views |
OLD | NEW |