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