| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autocomplete/autocomplete_popup_contents_view.
h" | 5 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_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/autocomplete/autocomplete_edit_view.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 if (event.IsLeftMouseButton() || event.IsMiddleMouseButton()) { | 426 if (event.IsLeftMouseButton() || event.IsMiddleMouseButton()) { |
| 427 size_t index = GetIndexForPoint(event.location()); | 427 size_t index = GetIndexForPoint(event.location()); |
| 428 model_->SetHoveredLine(index); | 428 model_->SetHoveredLine(index); |
| 429 if (!ignore_mouse_drag_ && HasMatchAt(index) && event.IsLeftMouseButton()) | 429 if (!ignore_mouse_drag_ && HasMatchAt(index) && event.IsLeftMouseButton()) |
| 430 model_->SetSelectedLine(index, false, false); | 430 model_->SetSelectedLine(index, false, false); |
| 431 } | 431 } |
| 432 return true; | 432 return true; |
| 433 } | 433 } |
| 434 | 434 |
| 435 void AutocompletePopupContentsView::OnMouseReleased( | 435 void AutocompletePopupContentsView::OnMouseReleased( |
| 436 const views::MouseEvent& event, | 436 const views::MouseEvent& event) { |
| 437 bool canceled) { | 437 if (ignore_mouse_drag_) { |
| 438 if (canceled || ignore_mouse_drag_) { | |
| 439 ignore_mouse_drag_ = false; | 438 ignore_mouse_drag_ = false; |
| 440 return; | 439 return; |
| 441 } | 440 } |
| 442 | 441 |
| 443 size_t index = GetIndexForPoint(event.location()); | 442 size_t index = GetIndexForPoint(event.location()); |
| 444 if (event.IsOnlyMiddleMouseButton()) | 443 if (event.IsOnlyMiddleMouseButton()) |
| 445 OpenIndex(index, NEW_BACKGROUND_TAB); | 444 OpenIndex(index, NEW_BACKGROUND_TAB); |
| 446 else if (event.IsOnlyLeftMouseButton()) | 445 else if (event.IsOnlyLeftMouseButton()) |
| 447 OpenIndex(index, CURRENT_TAB); | 446 OpenIndex(index, CURRENT_TAB); |
| 448 } | 447 } |
| 449 | 448 |
| 449 void AutocompletePopupContentsView::OnMouseCaptureLost() { |
| 450 ignore_mouse_drag_ = false; |
| 451 } |
| 452 |
| 450 void AutocompletePopupContentsView::OnMouseMoved( | 453 void AutocompletePopupContentsView::OnMouseMoved( |
| 451 const views::MouseEvent& event) { | 454 const views::MouseEvent& event) { |
| 452 model_->SetHoveredLine(GetIndexForPoint(event.location())); | 455 model_->SetHoveredLine(GetIndexForPoint(event.location())); |
| 453 } | 456 } |
| 454 | 457 |
| 455 void AutocompletePopupContentsView::OnMouseEntered( | 458 void AutocompletePopupContentsView::OnMouseEntered( |
| 456 const views::MouseEvent& event) { | 459 const views::MouseEvent& event) { |
| 457 model_->SetHoveredLine(GetIndexForPoint(event.location())); | 460 model_->SetHoveredLine(GetIndexForPoint(event.location())); |
| 458 } | 461 } |
| 459 | 462 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 opt_in_view_ = NULL; | 664 opt_in_view_ = NULL; |
| 662 PromoCounter* counter = model_->profile()->GetInstantPromoCounter(); | 665 PromoCounter* counter = model_->profile()->GetInstantPromoCounter(); |
| 663 DCHECK(counter); | 666 DCHECK(counter); |
| 664 counter->Hide(); | 667 counter->Hide(); |
| 665 if (opt_in) { | 668 if (opt_in) { |
| 666 browser::ShowInstantConfirmDialogIfNecessary( | 669 browser::ShowInstantConfirmDialogIfNecessary( |
| 667 location_bar_->GetWindow()->GetNativeWindow(), model_->profile()); | 670 location_bar_->GetWindow()->GetNativeWindow(), model_->profile()); |
| 668 } | 671 } |
| 669 UpdatePopupAppearance(); | 672 UpdatePopupAppearance(); |
| 670 } | 673 } |
| OLD | NEW |