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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 *url = item.url; | 226 *url = item.url; |
227 return true; | 227 return true; |
228 } | 228 } |
229 | 229 |
230 template <typename T> | 230 template <typename T> |
231 void DeletePageSoon(scoped_ptr<T> page) { | 231 void DeletePageSoon(scoped_ptr<T> page) { |
232 if (page->contents()) | 232 if (page->contents()) |
233 page->ReleaseContents(); | 233 page->ReleaseContents(); |
234 | 234 |
235 MessageLoop::current()->DeleteSoon(FROM_HERE, page.release()); | 235 base::MessageLoop::current()->DeleteSoon(FROM_HERE, page.release()); |
236 } | 236 } |
237 | 237 |
238 } // namespace | 238 } // namespace |
239 | 239 |
240 InstantController::InstantController(BrowserInstantController* browser, | 240 InstantController::InstantController(BrowserInstantController* browser, |
241 bool extended_enabled) | 241 bool extended_enabled) |
242 : browser_(browser), | 242 : browser_(browser), |
243 extended_enabled_(extended_enabled), | 243 extended_enabled_(extended_enabled), |
244 instant_enabled_(false), | 244 instant_enabled_(false), |
245 use_local_page_only_(true), | 245 use_local_page_only_(true), |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 NOTREACHED(); | 1173 NOTREACHED(); |
1174 } | 1174 } |
1175 StartListeningToMostVisitedChanges(); | 1175 StartListeningToMostVisitedChanges(); |
1176 } | 1176 } |
1177 | 1177 |
1178 void InstantController::InstantSupportDetermined( | 1178 void InstantController::InstantSupportDetermined( |
1179 const content::WebContents* contents, | 1179 const content::WebContents* contents, |
1180 bool supports_instant) { | 1180 bool supports_instant) { |
1181 if (IsContentsFrom(instant_tab(), contents)) { | 1181 if (IsContentsFrom(instant_tab(), contents)) { |
1182 if (!supports_instant) | 1182 if (!supports_instant) |
1183 MessageLoop::current()->DeleteSoon(FROM_HERE, instant_tab_.release()); | 1183 base::MessageLoop::current()->DeleteSoon(FROM_HERE, |
| 1184 instant_tab_.release()); |
1184 | 1185 |
1185 content::NotificationService::current()->Notify( | 1186 content::NotificationService::current()->Notify( |
1186 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, | 1187 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, |
1187 content::Source<InstantController>(this), | 1188 content::Source<InstantController>(this), |
1188 content::NotificationService::NoDetails()); | 1189 content::NotificationService::NoDetails()); |
1189 } else if (IsContentsFrom(ntp(), contents)) { | 1190 } else if (IsContentsFrom(ntp(), contents)) { |
1190 if (!supports_instant) { | 1191 if (!supports_instant) { |
1191 bool is_local = ntp_->IsLocal(); | 1192 bool is_local = ntp_->IsLocal(); |
1192 DeletePageSoon(ntp_.Pass()); | 1193 DeletePageSoon(ntp_.Pass()); |
1193 // Preload a local NTP in place of the broken online one. | 1194 // Preload a local NTP in place of the broken online one. |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1806 | 1807 |
1807 result->transition = match.transition; | 1808 result->transition = match.transition; |
1808 result->relevance = match.relevance; | 1809 result->relevance = match.relevance; |
1809 result->autocomplete_match_index = autocomplete_match_index; | 1810 result->autocomplete_match_index = autocomplete_match_index; |
1810 | 1811 |
1811 DVLOG(1) << " " << result->relevance << " " << result->type << " " | 1812 DVLOG(1) << " " << result->relevance << " " << result->type << " " |
1812 << result->provider << " " << result->destination_url << " '" | 1813 << result->provider << " " << result->destination_url << " '" |
1813 << result->description << "' '" << result->search_query << "' " | 1814 << result->description << "' '" << result->search_query << "' " |
1814 << result->transition << " " << result->autocomplete_match_index; | 1815 << result->transition << " " << result->autocomplete_match_index; |
1815 } | 1816 } |
OLD | NEW |