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/textfield.h" | 5 #include "ui/views/controls/textfield/textfield.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } | 400 } |
401 | 401 |
402 bool Textfield::OnKeyPressed(const ui::KeyEvent& e) { | 402 bool Textfield::OnKeyPressed(const ui::KeyEvent& e) { |
403 return native_wrapper_ && native_wrapper_->HandleKeyPressed(e); | 403 return native_wrapper_ && native_wrapper_->HandleKeyPressed(e); |
404 } | 404 } |
405 | 405 |
406 bool Textfield::OnKeyReleased(const ui::KeyEvent& e) { | 406 bool Textfield::OnKeyReleased(const ui::KeyEvent& e) { |
407 return native_wrapper_ && native_wrapper_->HandleKeyReleased(e); | 407 return native_wrapper_ && native_wrapper_->HandleKeyReleased(e); |
408 } | 408 } |
409 | 409 |
| 410 bool Textfield::OnMouseDragged(const ui::MouseEvent& e) { |
| 411 if (!e.IsOnlyRightMouseButton()) |
| 412 return View::OnMouseDragged(e); |
| 413 return true; |
| 414 } |
| 415 |
410 void Textfield::OnFocus() { | 416 void Textfield::OnFocus() { |
411 if (native_wrapper_) | 417 if (native_wrapper_) |
412 native_wrapper_->HandleFocus(); | 418 native_wrapper_->HandleFocus(); |
413 | 419 |
414 // Forward the focus to the wrapper if it exists. | 420 // Forward the focus to the wrapper if it exists. |
415 if (!native_wrapper_ || !native_wrapper_->SetFocus()) { | 421 if (!native_wrapper_ || !native_wrapper_->SetFocus()) { |
416 // If there is no wrapper or the wrapper didn't take focus, call | 422 // If there is no wrapper or the wrapper didn't take focus, call |
417 // View::Focus to clear the native focus so that we still get | 423 // View::Focus to clear the native focus so that we still get |
418 // keyboard messages. | 424 // keyboard messages. |
419 View::OnFocus(); | 425 View::OnFocus(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 492 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
487 Textfield* field) { | 493 Textfield* field) { |
488 #if defined(OS_WIN) && !defined(USE_AURA) | 494 #if defined(OS_WIN) && !defined(USE_AURA) |
489 if (!UseNativeTextfieldViews()) | 495 if (!UseNativeTextfieldViews()) |
490 return new NativeTextfieldWin(field); | 496 return new NativeTextfieldWin(field); |
491 #endif | 497 #endif |
492 return new NativeTextfieldViews(field); | 498 return new NativeTextfieldViews(field); |
493 } | 499 } |
494 | 500 |
495 } // namespace views | 501 } // namespace views |
OLD | NEW |