| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/search/search_tab_helper.h" | 5 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 // Remove focus only if the popup is closed. This will prevent someone | 443 // Remove focus only if the popup is closed. This will prevent someone |
| 444 // from changing the omnibox value and closing the popup without user | 444 // from changing the omnibox value and closing the popup without user |
| 445 // interaction. | 445 // interaction. |
| 446 if (!omnibox->model()->popup_model()->IsOpen()) | 446 if (!omnibox->model()->popup_model()->IsOpen()) |
| 447 web_contents()->Focus(); | 447 web_contents()->Focus(); |
| 448 break; | 448 break; |
| 449 } | 449 } |
| 450 #endif | 450 #endif |
| 451 } | 451 } |
| 452 | 452 |
| 453 void SearchTabHelper::NavigateToURL(const GURL& url, | |
| 454 WindowOpenDisposition disposition) { | |
| 455 // Make sure the specified URL is actually on the most visited or suggested | |
| 456 // items list. | |
| 457 if (!instant_service_ || !instant_service_->IsValidURLForNavigation(url)) | |
| 458 return; | |
| 459 | |
| 460 if (delegate_) | |
| 461 delegate_->NavigateOnThumbnailClick(url, disposition, web_contents_); | |
| 462 } | |
| 463 | |
| 464 void SearchTabHelper::OnDeleteMostVisitedItem(const GURL& url) { | 453 void SearchTabHelper::OnDeleteMostVisitedItem(const GURL& url) { |
| 465 DCHECK(!url.is_empty()); | 454 DCHECK(!url.is_empty()); |
| 466 if (instant_service_) | 455 if (instant_service_) |
| 467 instant_service_->DeleteMostVisitedItem(url); | 456 instant_service_->DeleteMostVisitedItem(url); |
| 468 } | 457 } |
| 469 | 458 |
| 470 void SearchTabHelper::OnUndoMostVisitedDeletion(const GURL& url) { | 459 void SearchTabHelper::OnUndoMostVisitedDeletion(const GURL& url) { |
| 471 DCHECK(!url.is_empty()); | 460 DCHECK(!url.is_empty()); |
| 472 if (instant_service_) | 461 if (instant_service_) |
| 473 instant_service_->UndoMostVisitedDeletion(url); | 462 instant_service_->UndoMostVisitedDeletion(url); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 | 581 |
| 593 bool SearchTabHelper::IsInputInProgress() const { | 582 bool SearchTabHelper::IsInputInProgress() const { |
| 594 OmniboxView* omnibox = GetOmniboxView(); | 583 OmniboxView* omnibox = GetOmniboxView(); |
| 595 return !model_.mode().is_ntp() && omnibox && | 584 return !model_.mode().is_ntp() && omnibox && |
| 596 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; | 585 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; |
| 597 } | 586 } |
| 598 | 587 |
| 599 OmniboxView* SearchTabHelper::GetOmniboxView() const { | 588 OmniboxView* SearchTabHelper::GetOmniboxView() const { |
| 600 return delegate_ ? delegate_->GetOmniboxView() : NULL; | 589 return delegate_ ? delegate_->GetOmniboxView() : NULL; |
| 601 } | 590 } |
| OLD | NEW |