Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 10832282: Replace views::MouseEvent with ui::MouseEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/ui/views/omnibox/omnibox_view_views.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/property_bag.h" 8 #include "base/property_bag.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE { 92 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE {
93 bool handled = views::Textfield::OnKeyPressed(event); 93 bool handled = views::Textfield::OnKeyPressed(event);
94 return omnibox_view_->HandleAfterKeyEvent(event, handled) || handled; 94 return omnibox_view_->HandleAfterKeyEvent(event, handled) || handled;
95 } 95 }
96 96
97 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE { 97 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE {
98 return omnibox_view_->HandleKeyReleaseEvent(event); 98 return omnibox_view_->HandleKeyReleaseEvent(event);
99 } 99 }
100 100
101 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE { 101 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE {
102 // Pass through the views::Textfield's return value; we don't need to 102 // Pass through the views::Textfield's return value; we don't need to
103 // override its behavior. 103 // override its behavior.
104 bool result = views::Textfield::OnMousePressed(event); 104 bool result = views::Textfield::OnMousePressed(event);
105 omnibox_view_->HandleMousePressEvent(event); 105 omnibox_view_->HandleMousePressEvent(event);
106 return result; 106 return result;
107 } 107 }
108 108
109 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE { 109 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE {
110 bool result = views::Textfield::OnMouseDragged(event); 110 bool result = views::Textfield::OnMouseDragged(event);
111 omnibox_view_->HandleMouseDragEvent(event); 111 omnibox_view_->HandleMouseDragEvent(event);
112 return result; 112 return result;
113 } 113 }
114 114
115 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE { 115 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE {
116 views::Textfield::OnMouseReleased(event); 116 views::Textfield::OnMouseReleased(event);
117 omnibox_view_->HandleMouseReleaseEvent(event); 117 omnibox_view_->HandleMouseReleaseEvent(event);
118 } 118 }
119 119
120 protected: 120 protected:
121 // views::View implementation. 121 // views::View implementation.
122 virtual void PaintChildren(gfx::Canvas* canvas) { 122 virtual void PaintChildren(gfx::Canvas* canvas) {
123 views::Textfield::PaintChildren(canvas); 123 views::Textfield::PaintChildren(canvas);
124 MaybeDrawPlaceholderText(canvas); 124 MaybeDrawPlaceholderText(canvas);
125 } 125 }
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 // control-key state is changed. 375 // control-key state is changed.
376 if (event.key_code() == ui::VKEY_CONTROL) { 376 if (event.key_code() == ui::VKEY_CONTROL) {
377 // TODO(oshima): investigate if we need to support keyboard with two 377 // TODO(oshima): investigate if we need to support keyboard with two
378 // controls. 378 // controls.
379 model()->OnControlKeyChanged(false); 379 model()->OnControlKeyChanged(false);
380 return true; 380 return true;
381 } 381 }
382 return false; 382 return false;
383 } 383 }
384 384
385 void OmniboxViewViews::HandleMousePressEvent(const views::MouseEvent& event) { 385 void OmniboxViewViews::HandleMousePressEvent(const ui::MouseEvent& event) {
386 select_all_on_mouse_release_ = 386 select_all_on_mouse_release_ =
387 (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) && 387 (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) &&
388 !textfield_->HasFocus(); 388 !textfield_->HasFocus();
389 } 389 }
390 390
391 void OmniboxViewViews::HandleMouseDragEvent(const views::MouseEvent& event) { 391 void OmniboxViewViews::HandleMouseDragEvent(const ui::MouseEvent& event) {
392 select_all_on_mouse_release_ = false; 392 select_all_on_mouse_release_ = false;
393 } 393 }
394 394
395 void OmniboxViewViews::HandleMouseReleaseEvent(const views::MouseEvent& event) { 395 void OmniboxViewViews::HandleMouseReleaseEvent(const ui::MouseEvent& event) {
396 if ((event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) && 396 if ((event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) &&
397 select_all_on_mouse_release_) { 397 select_all_on_mouse_release_) {
398 // Select all in the reverse direction so as not to scroll the caret 398 // Select all in the reverse direction so as not to scroll the caret
399 // into view and shift the contents jarringly. 399 // into view and shift the contents jarringly.
400 SelectAll(true); 400 SelectAll(true);
401 } 401 }
402 select_all_on_mouse_release_ = false; 402 select_all_on_mouse_release_ = false;
403 } 403 }
404 404
405 void OmniboxViewViews::HandleFocusIn() { 405 void OmniboxViewViews::HandleFocusIn() {
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 const ui::Range& range) { 899 const ui::Range& range) {
900 if (text != GetText()) 900 if (text != GetText())
901 textfield_->SetText(text); 901 textfield_->SetText(text);
902 textfield_->SelectRange(range); 902 textfield_->SelectRange(range);
903 } 903 }
904 904
905 string16 OmniboxViewViews::GetSelectedText() const { 905 string16 OmniboxViewViews::GetSelectedText() const {
906 // TODO(oshima): Support instant, IME. 906 // TODO(oshima): Support instant, IME.
907 return textfield_->GetSelectedText(); 907 return textfield_->GetSelectedText();
908 } 908 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_views.h ('k') | chrome/browser/ui/views/reload_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698