| 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 "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/omnibox_popup_non_view.h" | 9 #include "chrome/browser/ui/views/omnibox/omnibox_popup_non_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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 void OmniboxPopupContentsView::OnMouseEntered( | 351 void OmniboxPopupContentsView::OnMouseEntered( |
| 352 const ui::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 ui::MouseEvent& event) { | 357 const ui::MouseEvent& event) { |
| 358 model_->SetHoveredLine(OmniboxPopupModel::kNoMatch); | 358 model_->SetHoveredLine(OmniboxPopupModel::kNoMatch); |
| 359 } | 359 } |
| 360 | 360 |
| 361 ui::EventResult OmniboxPopupContentsView::OnGestureEvent( | 361 void OmniboxPopupContentsView::OnGestureEvent(ui::GestureEvent* event) { |
| 362 ui::GestureEvent* event) { | |
| 363 switch (event->type()) { | 362 switch (event->type()) { |
| 364 case ui::ET_GESTURE_TAP_DOWN: | 363 case ui::ET_GESTURE_TAP_DOWN: |
| 365 case ui::ET_GESTURE_SCROLL_BEGIN: | 364 case ui::ET_GESTURE_SCROLL_BEGIN: |
| 366 case ui::ET_GESTURE_SCROLL_UPDATE: | 365 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 367 UpdateLineEvent(*event, true); | 366 UpdateLineEvent(*event, true); |
| 368 break; | 367 break; |
| 369 case ui::ET_GESTURE_TAP: | 368 case ui::ET_GESTURE_TAP: |
| 370 case ui::ET_GESTURE_SCROLL_END: | 369 case ui::ET_GESTURE_SCROLL_END: |
| 371 OpenSelectedLine(*event, CURRENT_TAB); | 370 OpenSelectedLine(*event, CURRENT_TAB); |
| 372 break; | 371 break; |
| 373 default: | 372 default: |
| 374 return ui::ER_UNHANDLED; | 373 return; |
| 375 } | 374 } |
| 376 return ui::ER_CONSUMED; | 375 event->SetHandled(); |
| 377 } | 376 } |
| 378 | 377 |
| 379 //////////////////////////////////////////////////////////////////////////////// | 378 //////////////////////////////////////////////////////////////////////////////// |
| 380 // OmniboxPopupContentsView, protected: | 379 // OmniboxPopupContentsView, protected: |
| 381 | 380 |
| 382 void OmniboxPopupContentsView::PaintResultViews(gfx::Canvas* canvas) { | 381 void OmniboxPopupContentsView::PaintResultViews(gfx::Canvas* canvas) { |
| 383 canvas->DrawColor(result_view_at(0)->GetColor( | 382 canvas->DrawColor(result_view_at(0)->GetColor( |
| 384 OmniboxResultView::NORMAL, OmniboxResultView::BACKGROUND)); | 383 OmniboxResultView::NORMAL, OmniboxResultView::BACKGROUND)); |
| 385 View::PaintChildren(canvas); | 384 View::PaintChildren(canvas); |
| 386 } | 385 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 void OmniboxPopupContentsView::OpenSelectedLine( | 550 void OmniboxPopupContentsView::OpenSelectedLine( |
| 552 const ui::LocatedEvent& event, | 551 const ui::LocatedEvent& event, |
| 553 WindowOpenDisposition disposition) { | 552 WindowOpenDisposition disposition) { |
| 554 size_t index = GetIndexForPoint(event.location()); | 553 size_t index = GetIndexForPoint(event.location()); |
| 555 OpenIndex(index, disposition); | 554 OpenIndex(index, disposition); |
| 556 } | 555 } |
| 557 | 556 |
| 558 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 557 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
| 559 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 558 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
| 560 } | 559 } |
| OLD | NEW |