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 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 void InstantController::ClearDebugEvents() { | 1115 void InstantController::ClearDebugEvents() { |
1116 debug_events_.clear(); | 1116 debug_events_.clear(); |
1117 } | 1117 } |
1118 | 1118 |
1119 void InstantController::UpdateMostVisitedItems() { | 1119 void InstantController::UpdateMostVisitedItems() { |
1120 InstantService* instant_service = | 1120 InstantService* instant_service = |
1121 InstantServiceFactory::GetForProfile(profile()); | 1121 InstantServiceFactory::GetForProfile(profile()); |
1122 if (!instant_service) | 1122 if (!instant_service) |
1123 return; | 1123 return; |
1124 | 1124 |
1125 std::vector<InstantMostVisitedItemIDPair> items; | 1125 std::vector<InstantMostVisitedItem> items; |
1126 instant_service->GetCurrentMostVisitedItems(&items); | 1126 instant_service->GetCurrentMostVisitedItems(&items); |
1127 | 1127 |
1128 if (overlay_) | 1128 if (overlay_ && GetOverlayContents() && |
| 1129 SearchTabHelper::FromWebContents(overlay_->contents())-> |
| 1130 UpdateLastKnownMostVisitedItems(items)) { |
1129 overlay_->SendMostVisitedItems(items); | 1131 overlay_->SendMostVisitedItems(items); |
1130 if (ntp_) | 1132 } |
| 1133 |
| 1134 if (ntp_ && ntp_->contents() && |
| 1135 SearchTabHelper::FromWebContents(ntp_->contents())-> |
| 1136 UpdateLastKnownMostVisitedItems(items)) { |
1131 ntp_->SendMostVisitedItems(items); | 1137 ntp_->SendMostVisitedItems(items); |
1132 if (instant_tab_) | 1138 } |
| 1139 |
| 1140 if (instant_tab_ && instant_tab_->contents() && |
| 1141 SearchTabHelper::FromWebContents(instant_tab_->contents())-> |
| 1142 UpdateLastKnownMostVisitedItems(items)) { |
1133 instant_tab_->SendMostVisitedItems(items); | 1143 instant_tab_->SendMostVisitedItems(items); |
| 1144 } |
1134 | 1145 |
1135 content::NotificationService::current()->Notify( | 1146 content::NotificationService::current()->Notify( |
1136 chrome::NOTIFICATION_INSTANT_SENT_MOST_VISITED_ITEMS, | 1147 chrome::NOTIFICATION_INSTANT_SENT_MOST_VISITED_ITEMS, |
1137 content::Source<InstantController>(this), | 1148 content::Source<InstantController>(this), |
1138 content::NotificationService::NoDetails()); | 1149 content::NotificationService::NoDetails()); |
1139 } | 1150 } |
1140 | 1151 |
1141 void InstantController::DeleteMostVisitedItem(const GURL& url) { | 1152 void InstantController::DeleteMostVisitedItem(const GURL& url) { |
1142 DCHECK(!url.is_empty()); | 1153 DCHECK(!url.is_empty()); |
1143 InstantService* instant_service = | 1154 InstantService* instant_service = |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 result->transition = match.transition; | 1833 result->transition = match.transition; |
1823 result->relevance = match.relevance; | 1834 result->relevance = match.relevance; |
1824 result->autocomplete_match_index = autocomplete_match_index; | 1835 result->autocomplete_match_index = autocomplete_match_index; |
1825 | 1836 |
1826 DVLOG(1) << " " << result->relevance << " " | 1837 DVLOG(1) << " " << result->relevance << " " |
1827 << UTF8ToUTF16(AutocompleteMatchType::ToString(result->type)) << " " | 1838 << UTF8ToUTF16(AutocompleteMatchType::ToString(result->type)) << " " |
1828 << result->provider << " " << result->destination_url << " '" | 1839 << result->provider << " " << result->destination_url << " '" |
1829 << result->description << "' '" << result->search_query << "' " | 1840 << result->description << "' '" << result->search_query << "' " |
1830 << result->transition << " " << result->autocomplete_match_index; | 1841 << result->transition << " " << result->autocomplete_match_index; |
1831 } | 1842 } |
OLD | NEW |