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" |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 const string16 original_text = GetText(); | 1390 const string16 original_text = GetText(); |
1391 const bool success = model_->Paste(); | 1391 const bool success = model_->Paste(); |
1392 | 1392 |
1393 if (success) { | 1393 if (success) { |
1394 // As Paste is handled in model_->Paste(), the RenderText may contain | 1394 // As Paste is handled in model_->Paste(), the RenderText may contain |
1395 // upper case characters. This is not consistent with other places | 1395 // upper case characters. This is not consistent with other places |
1396 // which keeps RenderText only containing lower case characters. | 1396 // which keeps RenderText only containing lower case characters. |
1397 string16 new_text = GetTextForDisplay(GetText()); | 1397 string16 new_text = GetTextForDisplay(GetText()); |
1398 model_->SetText(new_text); | 1398 model_->SetText(new_text); |
1399 | 1399 |
1400 // Calls TextfieldController::ContentsChanged() explicitly if the paste | 1400 TextfieldController* controller = textfield_->GetController(); |
1401 // action did not change the content at all. See http://crbug.com/79002 | 1401 if (controller) |
1402 if (new_text == original_text) { | 1402 controller->OnAfterPaste(); |
1403 TextfieldController* controller = textfield_->GetController(); | |
1404 if (controller) | |
1405 controller->ContentsChanged(textfield_, textfield_->text()); | |
1406 } | |
1407 } | 1403 } |
1408 return success; | 1404 return success; |
1409 } | 1405 } |
1410 | 1406 |
1411 void NativeTextfieldViews::TrackMouseClicks(const ui::MouseEvent& event) { | 1407 void NativeTextfieldViews::TrackMouseClicks(const ui::MouseEvent& event) { |
1412 if (event.IsOnlyLeftMouseButton()) { | 1408 if (event.IsOnlyLeftMouseButton()) { |
1413 base::TimeDelta time_delta = event.time_stamp() - last_click_time_; | 1409 base::TimeDelta time_delta = event.time_stamp() - last_click_time_; |
1414 if (time_delta.InMilliseconds() <= GetDoubleClickInterval() && | 1410 if (time_delta.InMilliseconds() <= GetDoubleClickInterval() && |
1415 !ExceededDragThresholdFromLastClickLocation(event)) { | 1411 !ExceededDragThresholdFromLastClickLocation(event)) { |
1416 aggregated_clicks_ = (aggregated_clicks_ + 1) % 3; | 1412 aggregated_clicks_ = (aggregated_clicks_ + 1) % 3; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 | 1478 |
1483 void NativeTextfieldViews::PlatformGestureEventHandling( | 1479 void NativeTextfieldViews::PlatformGestureEventHandling( |
1484 const ui::GestureEvent* event) { | 1480 const ui::GestureEvent* event) { |
1485 #if defined(OS_WIN) && defined(USE_AURA) | 1481 #if defined(OS_WIN) && defined(USE_AURA) |
1486 if (event->type() == ui::ET_GESTURE_TAP_DOWN && !textfield_->read_only()) | 1482 if (event->type() == ui::ET_GESTURE_TAP_DOWN && !textfield_->read_only()) |
1487 base::win::DisplayVirtualKeyboard(); | 1483 base::win::DisplayVirtualKeyboard(); |
1488 #endif | 1484 #endif |
1489 } | 1485 } |
1490 | 1486 |
1491 } // namespace views | 1487 } // namespace views |
OLD | NEW |