| 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/inline_omnibox_popup_view.h" | 5 #include "chrome/browser/ui/views/omnibox/inline_omnibox_popup_view.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 10 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 void InlineOmniboxPopupView::OnMouseEntered( | 288 void InlineOmniboxPopupView::OnMouseEntered( |
| 289 const ui::MouseEvent& event) { | 289 const ui::MouseEvent& event) { |
| 290 model_->SetHoveredLine(GetIndexForPoint(event.location())); | 290 model_->SetHoveredLine(GetIndexForPoint(event.location())); |
| 291 } | 291 } |
| 292 | 292 |
| 293 void InlineOmniboxPopupView::OnMouseExited( | 293 void InlineOmniboxPopupView::OnMouseExited( |
| 294 const ui::MouseEvent& event) { | 294 const ui::MouseEvent& event) { |
| 295 model_->SetHoveredLine(OmniboxPopupModel::kNoMatch); | 295 model_->SetHoveredLine(OmniboxPopupModel::kNoMatch); |
| 296 } | 296 } |
| 297 | 297 |
| 298 ui::GestureStatus InlineOmniboxPopupView::OnGestureEvent( | 298 ui::EventResult InlineOmniboxPopupView::OnGestureEvent( |
| 299 const ui::GestureEvent& event) { | 299 const ui::GestureEvent& event) { |
| 300 switch (event.type()) { | 300 switch (event.type()) { |
| 301 case ui::ET_GESTURE_TAP_DOWN: | 301 case ui::ET_GESTURE_TAP_DOWN: |
| 302 case ui::ET_GESTURE_SCROLL_BEGIN: | 302 case ui::ET_GESTURE_SCROLL_BEGIN: |
| 303 case ui::ET_GESTURE_SCROLL_UPDATE: | 303 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 304 UpdateLineEvent(event, true); | 304 UpdateLineEvent(event, true); |
| 305 break; | 305 break; |
| 306 case ui::ET_GESTURE_TAP: | 306 case ui::ET_GESTURE_TAP: |
| 307 case ui::ET_GESTURE_SCROLL_END: | 307 case ui::ET_GESTURE_SCROLL_END: |
| 308 OpenSelectedLine(event, CURRENT_TAB); | 308 OpenSelectedLine(event, CURRENT_TAB); |
| 309 break; | 309 break; |
| 310 default: | 310 default: |
| 311 return ui::GESTURE_STATUS_UNKNOWN; | 311 return ui::ER_UNHANDLED; |
| 312 } | 312 } |
| 313 return ui::GESTURE_STATUS_CONSUMED; | 313 return ui::ER_CONSUMED; |
| 314 } | 314 } |
| 315 | 315 |
| 316 //////////////////////////////////////////////////////////////////////////////// | 316 //////////////////////////////////////////////////////////////////////////////// |
| 317 // InlineOmniboxPopupView, protected: | 317 // InlineOmniboxPopupView, protected: |
| 318 | 318 |
| 319 int InlineOmniboxPopupView::CalculatePopupHeight() { | 319 int InlineOmniboxPopupView::CalculatePopupHeight() { |
| 320 DCHECK_GE(static_cast<size_t>(child_count()), model_->result().size()); | 320 DCHECK_GE(static_cast<size_t>(child_count()), model_->result().size()); |
| 321 int popup_height = 0; | 321 int popup_height = 0; |
| 322 for (size_t i = 0; i < model_->result().size(); ++i) | 322 for (size_t i = 0; i < model_->result().size(); ++i) |
| 323 popup_height += child_at(i)->GetPreferredSize().height(); | 323 popup_height += child_at(i)->GetPreferredSize().height(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 if (HasMatchAt(index) && should_set_selected_line) | 397 if (HasMatchAt(index) && should_set_selected_line) |
| 398 model_->SetSelectedLine(index, false, false); | 398 model_->SetSelectedLine(index, false, false); |
| 399 } | 399 } |
| 400 | 400 |
| 401 void InlineOmniboxPopupView::OpenSelectedLine( | 401 void InlineOmniboxPopupView::OpenSelectedLine( |
| 402 const ui::LocatedEvent& event, | 402 const ui::LocatedEvent& event, |
| 403 WindowOpenDisposition disposition) { | 403 WindowOpenDisposition disposition) { |
| 404 size_t index = GetIndexForPoint(event.location()); | 404 size_t index = GetIndexForPoint(event.location()); |
| 405 OpenIndex(index, disposition); | 405 OpenIndex(index, disposition); |
| 406 } | 406 } |
| OLD | NEW |