| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 if (!omnibox->model()->popup_model()->IsOpen()) | 443 if (!omnibox->model()->popup_model()->IsOpen()) |
| 444 web_contents()->Focus(); | 444 web_contents()->Focus(); |
| 445 break; | 445 break; |
| 446 } | 446 } |
| 447 #endif | 447 #endif |
| 448 } | 448 } |
| 449 | 449 |
| 450 void SearchTabHelper::NavigateToURL(const GURL& url, | 450 void SearchTabHelper::NavigateToURL(const GURL& url, |
| 451 WindowOpenDisposition disposition, | 451 WindowOpenDisposition disposition, |
| 452 bool is_most_visited_item_url) { | 452 bool is_most_visited_item_url) { |
| 453 // Make sure the specified URL is actually on the most visited or suggested |
| 454 // items list. |
| 455 // TODO(treib): The |is_most_visited_item_url| is meaningless: the way it's |
| 456 // currently set by the renderer means it can't be used to decide which list |
| 457 // of items (most visited or suggestions) to use for the validation check. Can |
| 458 // it be removed? |
| 459 if (!instant_service_ || !instant_service_->IsValidURLForNavigation(url)) |
| 460 return; |
| 461 |
| 453 if (is_most_visited_item_url) { | 462 if (is_most_visited_item_url) { |
| 454 content::RecordAction( | 463 content::RecordAction( |
| 455 base::UserMetricsAction("InstantExtended.MostVisitedClicked")); | 464 base::UserMetricsAction("InstantExtended.MostVisitedClicked")); |
| 456 } | 465 } |
| 457 | 466 |
| 458 if (delegate_) | 467 if (delegate_) |
| 459 delegate_->NavigateOnThumbnailClick(url, disposition, web_contents_); | 468 delegate_->NavigateOnThumbnailClick(url, disposition, web_contents_); |
| 460 } | 469 } |
| 461 | 470 |
| 462 void SearchTabHelper::OnDeleteMostVisitedItem(const GURL& url) { | 471 void SearchTabHelper::OnDeleteMostVisitedItem(const GURL& url) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 | 599 |
| 591 bool SearchTabHelper::IsInputInProgress() const { | 600 bool SearchTabHelper::IsInputInProgress() const { |
| 592 OmniboxView* omnibox = GetOmniboxView(); | 601 OmniboxView* omnibox = GetOmniboxView(); |
| 593 return !model_.mode().is_ntp() && omnibox && | 602 return !model_.mode().is_ntp() && omnibox && |
| 594 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; | 603 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; |
| 595 } | 604 } |
| 596 | 605 |
| 597 OmniboxView* SearchTabHelper::GetOmniboxView() const { | 606 OmniboxView* SearchTabHelper::GetOmniboxView() const { |
| 598 return delegate_ ? delegate_->GetOmniboxView() : NULL; | 607 return delegate_ ? delegate_->GetOmniboxView() : NULL; |
| 599 } | 608 } |
| OLD | NEW |