| 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 "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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 } | 360 } |
| 361 | 361 |
| 362 void OmniboxPopupContentsView::OnMouseReleased( | 362 void OmniboxPopupContentsView::OnMouseReleased( |
| 363 const ui::MouseEvent& event) { | 363 const ui::MouseEvent& event) { |
| 364 if (ignore_mouse_drag_) { | 364 if (ignore_mouse_drag_) { |
| 365 OnMouseCaptureLost(); | 365 OnMouseCaptureLost(); |
| 366 return; | 366 return; |
| 367 } | 367 } |
| 368 | 368 |
| 369 if (event.IsOnlyMiddleMouseButton() || event.IsOnlyLeftMouseButton()) { | 369 if (event.IsOnlyMiddleMouseButton() || event.IsOnlyLeftMouseButton()) { |
| 370 OpenSelectedLine(event, event.IsOnlyLeftMouseButton() ? CURRENT_TAB : | 370 OpenSelectedLine(event, event.IsOnlyLeftMouseButton() |
| 371 NEW_BACKGROUND_TAB); | 371 ? WindowOpenDisposition::CURRENT_TAB |
| 372 : WindowOpenDisposition::NEW_BACKGROUND_TAB); |
| 372 } | 373 } |
| 373 } | 374 } |
| 374 | 375 |
| 375 void OmniboxPopupContentsView::OnMouseCaptureLost() { | 376 void OmniboxPopupContentsView::OnMouseCaptureLost() { |
| 376 ignore_mouse_drag_ = false; | 377 ignore_mouse_drag_ = false; |
| 377 } | 378 } |
| 378 | 379 |
| 379 void OmniboxPopupContentsView::OnMouseMoved( | 380 void OmniboxPopupContentsView::OnMouseMoved( |
| 380 const ui::MouseEvent& event) { | 381 const ui::MouseEvent& event) { |
| 381 model_->SetHoveredLine(GetIndexForPoint(event.location())); | 382 model_->SetHoveredLine(GetIndexForPoint(event.location())); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 393 | 394 |
| 394 void OmniboxPopupContentsView::OnGestureEvent(ui::GestureEvent* event) { | 395 void OmniboxPopupContentsView::OnGestureEvent(ui::GestureEvent* event) { |
| 395 switch (event->type()) { | 396 switch (event->type()) { |
| 396 case ui::ET_GESTURE_TAP_DOWN: | 397 case ui::ET_GESTURE_TAP_DOWN: |
| 397 case ui::ET_GESTURE_SCROLL_BEGIN: | 398 case ui::ET_GESTURE_SCROLL_BEGIN: |
| 398 case ui::ET_GESTURE_SCROLL_UPDATE: | 399 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 399 UpdateLineEvent(*event, true); | 400 UpdateLineEvent(*event, true); |
| 400 break; | 401 break; |
| 401 case ui::ET_GESTURE_TAP: | 402 case ui::ET_GESTURE_TAP: |
| 402 case ui::ET_GESTURE_SCROLL_END: | 403 case ui::ET_GESTURE_SCROLL_END: |
| 403 OpenSelectedLine(*event, CURRENT_TAB); | 404 OpenSelectedLine(*event, WindowOpenDisposition::CURRENT_TAB); |
| 404 break; | 405 break; |
| 405 default: | 406 default: |
| 406 return; | 407 return; |
| 407 } | 408 } |
| 408 event->SetHandled(); | 409 event->SetHandled(); |
| 409 } | 410 } |
| 410 | 411 |
| 411 //////////////////////////////////////////////////////////////////////////////// | 412 //////////////////////////////////////////////////////////////////////////////// |
| 412 // OmniboxPopupContentsView, protected: | 413 // OmniboxPopupContentsView, protected: |
| 413 | 414 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 size_t index = GetIndexForPoint(event.location()); | 524 size_t index = GetIndexForPoint(event.location()); |
| 524 if (!HasMatchAt(index)) | 525 if (!HasMatchAt(index)) |
| 525 return; | 526 return; |
| 526 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, | 527 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, |
| 527 GURL(), base::string16(), index); | 528 GURL(), base::string16(), index); |
| 528 } | 529 } |
| 529 | 530 |
| 530 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 531 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
| 531 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 532 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
| 532 } | 533 } |
| OLD | NEW |