| 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/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 } else if (IsContentsFrom(ntp(), contents)) { | 1246 } else if (IsContentsFrom(ntp(), contents)) { |
| 1247 ntp_->SetDisplayInstantResults(instant_enabled_); | 1247 ntp_->SetDisplayInstantResults(instant_enabled_); |
| 1248 ntp_->SetOmniboxBounds(omnibox_bounds_); | 1248 ntp_->SetOmniboxBounds(omnibox_bounds_); |
| 1249 ntp_->InitializeFonts(); | 1249 ntp_->InitializeFonts(); |
| 1250 } else { | 1250 } else { |
| 1251 NOTREACHED(); | 1251 NOTREACHED(); |
| 1252 } | 1252 } |
| 1253 UpdateMostVisitedItems(); | 1253 UpdateMostVisitedItems(); |
| 1254 } | 1254 } |
| 1255 | 1255 |
| 1256 void InstantController::InstantSupportChanged( |
| 1257 InstantSupportState instant_support) { |
| 1258 // Handle INSTANT_SUPPORT_YES here because InstantPage is not hooked up to the |
| 1259 // active tab. Search model changed listener in InstantPage will handle other |
| 1260 // cases. |
| 1261 if (instant_support != INSTANT_SUPPORT_YES) |
| 1262 return; |
| 1263 |
| 1264 ResetInstantTab(); |
| 1265 } |
| 1266 |
| 1256 void InstantController::InstantSupportDetermined( | 1267 void InstantController::InstantSupportDetermined( |
| 1257 const content::WebContents* contents, | 1268 const content::WebContents* contents, |
| 1258 bool supports_instant) { | 1269 bool supports_instant) { |
| 1259 if (IsContentsFrom(instant_tab(), contents)) { | 1270 if (IsContentsFrom(instant_tab(), contents)) { |
| 1260 if (!supports_instant) | 1271 if (!supports_instant) |
| 1261 base::MessageLoop::current()->DeleteSoon(FROM_HERE, | 1272 base::MessageLoop::current()->DeleteSoon(FROM_HERE, |
| 1262 instant_tab_.release()); | 1273 instant_tab_.release()); |
| 1263 | 1274 |
| 1264 content::NotificationService::current()->Notify( | 1275 content::NotificationService::current()->Notify( |
| 1265 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, | 1276 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1900 bool js_webkit_enabled = profile()->GetPrefs()->GetBoolean( | 1911 bool js_webkit_enabled = profile()->GetPrefs()->GetBoolean( |
| 1901 prefs::kWebKitJavascriptEnabled); | 1912 prefs::kWebKitJavascriptEnabled); |
| 1902 return js_content_enabled && js_webkit_enabled; | 1913 return js_content_enabled && js_webkit_enabled; |
| 1903 } | 1914 } |
| 1904 | 1915 |
| 1905 bool InstantController::InStartup() const { | 1916 bool InstantController::InStartup() const { |
| 1906 // TODO(shishir): This is not completely reliable. Find a better way to detect | 1917 // TODO(shishir): This is not completely reliable. Find a better way to detect |
| 1907 // startup time. | 1918 // startup time. |
| 1908 return !browser_->GetActiveWebContents(); | 1919 return !browser_->GetActiveWebContents(); |
| 1909 } | 1920 } |
| OLD | NEW |