| 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/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 } else if (IsContentsFrom(ntp(), contents)) { | 1238 } else if (IsContentsFrom(ntp(), contents)) { |
| 1239 ntp_->SetDisplayInstantResults(instant_enabled_); | 1239 ntp_->SetDisplayInstantResults(instant_enabled_); |
| 1240 ntp_->SetOmniboxBounds(omnibox_bounds_); | 1240 ntp_->SetOmniboxBounds(omnibox_bounds_); |
| 1241 ntp_->InitializeFonts(); | 1241 ntp_->InitializeFonts(); |
| 1242 } else { | 1242 } else { |
| 1243 NOTREACHED(); | 1243 NOTREACHED(); |
| 1244 } | 1244 } |
| 1245 UpdateMostVisitedItems(); | 1245 UpdateMostVisitedItems(); |
| 1246 } | 1246 } |
| 1247 | 1247 |
| 1248 void InstantController::InstantSupportChanged( |
| 1249 const content::WebContents* contents, |
| 1250 InstantSupportState instant_support) { |
| 1251 if (instant_support == INSTANT_SUPPORT_UNKNOWN) |
| 1252 return; |
| 1253 |
| 1254 bool supports_instant = instant_support == INSTANT_SUPPORT_YES; |
| 1255 if (!instant_tab_ && supports_instant) |
| 1256 ResetInstantTab(); |
| 1257 |
| 1258 InstantSupportDetermined(contents, supports_instant); |
| 1259 } |
| 1260 |
| 1248 void InstantController::InstantSupportDetermined( | 1261 void InstantController::InstantSupportDetermined( |
| 1249 const content::WebContents* contents, | 1262 const content::WebContents* contents, |
| 1250 bool supports_instant) { | 1263 bool supports_instant) { |
| 1251 if (IsContentsFrom(instant_tab(), contents)) { | 1264 if (IsContentsFrom(instant_tab(), contents)) { |
| 1252 if (!supports_instant) | 1265 if (!supports_instant) |
| 1253 base::MessageLoop::current()->DeleteSoon(FROM_HERE, | 1266 base::MessageLoop::current()->DeleteSoon(FROM_HERE, |
| 1254 instant_tab_.release()); | 1267 instant_tab_.release()); |
| 1255 | 1268 |
| 1256 content::NotificationService::current()->Notify( | 1269 content::NotificationService::current()->Notify( |
| 1257 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, | 1270 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1864 result->transition = match.transition; | 1877 result->transition = match.transition; |
| 1865 result->relevance = match.relevance; | 1878 result->relevance = match.relevance; |
| 1866 result->autocomplete_match_index = autocomplete_match_index; | 1879 result->autocomplete_match_index = autocomplete_match_index; |
| 1867 | 1880 |
| 1868 DVLOG(1) << " " << result->relevance << " " | 1881 DVLOG(1) << " " << result->relevance << " " |
| 1869 << UTF8ToUTF16(AutocompleteMatchType::ToString(result->type)) << " " | 1882 << UTF8ToUTF16(AutocompleteMatchType::ToString(result->type)) << " " |
| 1870 << result->provider << " " << result->destination_url << " '" | 1883 << result->provider << " " << result->destination_url << " '" |
| 1871 << result->description << "' '" << result->search_query << "' " | 1884 << result->description << "' '" << result->search_query << "' " |
| 1872 << result->transition << " " << result->autocomplete_match_index; | 1885 << result->transition << " " << result->autocomplete_match_index; |
| 1873 } | 1886 } |
| OLD | NEW |