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