| 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/instant_controller.h" | 5 #include "chrome/browser/ui/search/instant_controller.h" |
| 6 | 6 |
| 7 #include <iterator> | 7 #include <iterator> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 void InstantController::ClearDebugEvents() { | 1106 void InstantController::ClearDebugEvents() { |
| 1107 debug_events_.clear(); | 1107 debug_events_.clear(); |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 void InstantController::UpdateMostVisitedItems() { | 1110 void InstantController::UpdateMostVisitedItems() { |
| 1111 InstantService* instant_service = | 1111 InstantService* instant_service = |
| 1112 InstantServiceFactory::GetForProfile(profile()); | 1112 InstantServiceFactory::GetForProfile(profile()); |
| 1113 if (!instant_service) | 1113 if (!instant_service) |
| 1114 return; | 1114 return; |
| 1115 | 1115 |
| 1116 std::vector<InstantMostVisitedItemIDPair> items; | 1116 std::vector<InstantMostVisitedItem> items; |
| 1117 instant_service->GetCurrentMostVisitedItems(&items); | 1117 instant_service->GetCurrentMostVisitedItems(&items); |
| 1118 | 1118 |
| 1119 if (overlay_) | 1119 if (overlay_ && GetOverlayContents() && |
| 1120 SearchTabHelper::FromWebContents(overlay_->contents())-> |
| 1121 UpdateLastKnownMostVisitedItems(items)) { |
| 1120 overlay_->SendMostVisitedItems(items); | 1122 overlay_->SendMostVisitedItems(items); |
| 1121 if (ntp_) | 1123 } |
| 1124 |
| 1125 if (ntp_ && ntp_->contents() && |
| 1126 SearchTabHelper::FromWebContents(ntp_->contents())-> |
| 1127 UpdateLastKnownMostVisitedItems(items)) { |
| 1122 ntp_->SendMostVisitedItems(items); | 1128 ntp_->SendMostVisitedItems(items); |
| 1123 if (instant_tab_) | 1129 } |
| 1130 |
| 1131 if (instant_tab_ && instant_tab_->contents() && |
| 1132 SearchTabHelper::FromWebContents(instant_tab_->contents())-> |
| 1133 UpdateLastKnownMostVisitedItems(items)) { |
| 1124 instant_tab_->SendMostVisitedItems(items); | 1134 instant_tab_->SendMostVisitedItems(items); |
| 1135 } |
| 1125 | 1136 |
| 1126 content::NotificationService::current()->Notify( | 1137 content::NotificationService::current()->Notify( |
| 1127 chrome::NOTIFICATION_INSTANT_SENT_MOST_VISITED_ITEMS, | 1138 chrome::NOTIFICATION_INSTANT_SENT_MOST_VISITED_ITEMS, |
| 1128 content::Source<InstantController>(this), | 1139 content::Source<InstantController>(this), |
| 1129 content::NotificationService::NoDetails()); | 1140 content::NotificationService::NoDetails()); |
| 1130 } | 1141 } |
| 1131 | 1142 |
| 1132 void InstantController::DeleteMostVisitedItem(const GURL& url) { | 1143 void InstantController::DeleteMostVisitedItem(const GURL& url) { |
| 1133 DCHECK(!url.is_empty()); | 1144 DCHECK(!url.is_empty()); |
| 1134 InstantService* instant_service = | 1145 InstantService* instant_service = |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1813 result->transition = match.transition; | 1824 result->transition = match.transition; |
| 1814 result->relevance = match.relevance; | 1825 result->relevance = match.relevance; |
| 1815 result->autocomplete_match_index = autocomplete_match_index; | 1826 result->autocomplete_match_index = autocomplete_match_index; |
| 1816 | 1827 |
| 1817 DVLOG(1) << " " << result->relevance << " " | 1828 DVLOG(1) << " " << result->relevance << " " |
| 1818 << UTF8ToUTF16(AutocompleteMatchType::ToString(result->type)) << " " | 1829 << UTF8ToUTF16(AutocompleteMatchType::ToString(result->type)) << " " |
| 1819 << result->provider << " " << result->destination_url << " '" | 1830 << result->provider << " " << result->destination_url << " '" |
| 1820 << result->description << "' '" << result->search_query << "' " | 1831 << result->description << "' '" << result->search_query << "' " |
| 1821 << result->transition << " " << result->autocomplete_match_index; | 1832 << result->transition << " " << result->autocomplete_match_index; |
| 1822 } | 1833 } |
| OLD | NEW |