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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.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_popup_contents_view.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h"
6 6
7 #include "chrome/browser/ui/omnibox/omnibox_view.h" 7 #include "chrome/browser/ui/omnibox/omnibox_view.h"
8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
9 #include "chrome/browser/ui/views/omnibox/inline_omnibox_popup_view.h" 9 #include "chrome/browser/ui/views/omnibox/inline_omnibox_popup_view.h"
10 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" 10 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // won't implicitly require painting until we ask for one. 305 // won't implicitly require painting until we ask for one.
306 SchedulePaint(); 306 SchedulePaint();
307 } 307 }
308 308
309 views::View* OmniboxPopupContentsView::GetEventHandlerForPoint( 309 views::View* OmniboxPopupContentsView::GetEventHandlerForPoint(
310 const gfx::Point& point) { 310 const gfx::Point& point) {
311 return this; 311 return this;
312 } 312 }
313 313
314 bool OmniboxPopupContentsView::OnMousePressed( 314 bool OmniboxPopupContentsView::OnMousePressed(
315 const views::MouseEvent& event) { 315 const ui::MouseEvent& event) {
316 ignore_mouse_drag_ = false; // See comment on |ignore_mouse_drag_| in header. 316 ignore_mouse_drag_ = false; // See comment on |ignore_mouse_drag_| in header.
317 if (event.IsLeftMouseButton() || event.IsMiddleMouseButton()) 317 if (event.IsLeftMouseButton() || event.IsMiddleMouseButton())
318 UpdateLineEvent(event, event.IsLeftMouseButton()); 318 UpdateLineEvent(event, event.IsLeftMouseButton());
319 return true; 319 return true;
320 } 320 }
321 321
322 bool OmniboxPopupContentsView::OnMouseDragged( 322 bool OmniboxPopupContentsView::OnMouseDragged(
323 const views::MouseEvent& event) { 323 const ui::MouseEvent& event) {
324 if (event.IsLeftMouseButton() || event.IsMiddleMouseButton()) 324 if (event.IsLeftMouseButton() || event.IsMiddleMouseButton())
325 UpdateLineEvent(event, !ignore_mouse_drag_ && event.IsLeftMouseButton()); 325 UpdateLineEvent(event, !ignore_mouse_drag_ && event.IsLeftMouseButton());
326 return true; 326 return true;
327 } 327 }
328 328
329 void OmniboxPopupContentsView::OnMouseReleased( 329 void OmniboxPopupContentsView::OnMouseReleased(
330 const views::MouseEvent& event) { 330 const ui::MouseEvent& event) {
331 if (ignore_mouse_drag_) { 331 if (ignore_mouse_drag_) {
332 OnMouseCaptureLost(); 332 OnMouseCaptureLost();
333 return; 333 return;
334 } 334 }
335 335
336 if (event.IsOnlyMiddleMouseButton() || event.IsOnlyLeftMouseButton()) { 336 if (event.IsOnlyMiddleMouseButton() || event.IsOnlyLeftMouseButton()) {
337 OpenSelectedLine(event, event.IsOnlyLeftMouseButton() ? CURRENT_TAB : 337 OpenSelectedLine(event, event.IsOnlyLeftMouseButton() ? CURRENT_TAB :
338 NEW_BACKGROUND_TAB); 338 NEW_BACKGROUND_TAB);
339 } 339 }
340 } 340 }
341 341
342 void OmniboxPopupContentsView::OnMouseCaptureLost() { 342 void OmniboxPopupContentsView::OnMouseCaptureLost() {
343 ignore_mouse_drag_ = false; 343 ignore_mouse_drag_ = false;
344 } 344 }
345 345
346 void OmniboxPopupContentsView::OnMouseMoved( 346 void OmniboxPopupContentsView::OnMouseMoved(
347 const views::MouseEvent& event) { 347 const ui::MouseEvent& event) {
348 model_->SetHoveredLine(GetIndexForPoint(event.location())); 348 model_->SetHoveredLine(GetIndexForPoint(event.location()));
349 } 349 }
350 350
351 void OmniboxPopupContentsView::OnMouseEntered( 351 void OmniboxPopupContentsView::OnMouseEntered(
352 const views::MouseEvent& event) { 352 const ui::MouseEvent& event) {
353 model_->SetHoveredLine(GetIndexForPoint(event.location())); 353 model_->SetHoveredLine(GetIndexForPoint(event.location()));
354 } 354 }
355 355
356 void OmniboxPopupContentsView::OnMouseExited( 356 void OmniboxPopupContentsView::OnMouseExited(
357 const views::MouseEvent& event) { 357 const ui::MouseEvent& event) {
358 model_->SetHoveredLine(OmniboxPopupModel::kNoMatch); 358 model_->SetHoveredLine(OmniboxPopupModel::kNoMatch);
359 } 359 }
360 360
361 ui::GestureStatus OmniboxPopupContentsView::OnGestureEvent( 361 ui::GestureStatus OmniboxPopupContentsView::OnGestureEvent(
362 const views::GestureEvent& event) { 362 const views::GestureEvent& event) {
363 switch (event.type()) { 363 switch (event.type()) {
364 case ui::ET_GESTURE_TAP_DOWN: 364 case ui::ET_GESTURE_TAP_DOWN:
365 case ui::ET_GESTURE_SCROLL_BEGIN: 365 case ui::ET_GESTURE_SCROLL_BEGIN:
366 case ui::ET_GESTURE_SCROLL_UPDATE: 366 case ui::ET_GESTURE_SCROLL_UPDATE:
367 UpdateLineEvent(event, true); 367 UpdateLineEvent(event, true);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 if (HasMatchAt(index) && should_set_selected_line) 548 if (HasMatchAt(index) && should_set_selected_line)
549 model_->SetSelectedLine(index, false, false); 549 model_->SetSelectedLine(index, false, false);
550 } 550 }
551 551
552 void OmniboxPopupContentsView::OpenSelectedLine( 552 void OmniboxPopupContentsView::OpenSelectedLine(
553 const ui::LocatedEvent& event, 553 const ui::LocatedEvent& event,
554 WindowOpenDisposition disposition) { 554 WindowOpenDisposition disposition) {
555 size_t index = GetIndexForPoint(event.location()); 555 size_t index = GetIndexForPoint(event.location());
556 OpenIndex(index, disposition); 556 OpenIndex(index, disposition);
557 } 557 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h ('k') | chrome/browser/ui/views/omnibox/omnibox_view_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698