Chromium Code Reviews| 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/search/search.h" | 5 #include "chrome/browser/search/search.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 } | 303 } |
| 304 | 304 |
| 305 bool NavEntryIsInstantNTP(const content::WebContents* contents, | 305 bool NavEntryIsInstantNTP(const content::WebContents* contents, |
| 306 const content::NavigationEntry* entry) { | 306 const content::NavigationEntry* entry) { |
| 307 if (!contents || !entry) | 307 if (!contents || !entry) |
| 308 return false; | 308 return false; |
| 309 | 309 |
| 310 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 310 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
| 311 return IsInstantExtendedAPIEnabled() && | 311 return IsInstantExtendedAPIEnabled() && |
| 312 IsRenderedInInstantProcess(contents, profile) && | 312 IsRenderedInInstantProcess(contents, profile) && |
| 313 IsInstantURL(entry->GetVirtualURL(), profile) && | 313 (IsInstantURL(entry->GetVirtualURL(), profile) || |
| 314 entry->GetVirtualURL() == GURL(chrome::kChromeSearchLocalNtpUrl)) && | |
| 314 GetSearchTermsImpl(contents, entry).empty(); | 315 GetSearchTermsImpl(contents, entry).empty(); |
| 315 } | 316 } |
| 316 | 317 |
| 317 bool ShouldAssignURLToInstantRenderer(const GURL& url, Profile* profile) { | 318 bool ShouldAssignURLToInstantRenderer(const GURL& url, Profile* profile) { |
| 318 return url.is_valid() && | 319 return url.is_valid() && |
| 319 profile && | 320 profile && |
| 320 (url.SchemeIs(chrome::kChromeSearchScheme) || | 321 (url.SchemeIs(chrome::kChromeSearchScheme) || |
| 321 IsInstantURL(url, profile) || | 322 IsInstantURL(url, profile)); |
|
Dan Beam
2013/03/25 21:37:39
nit: it'd be nice to eventually change this to IsI
jeremycho
2013/03/25 21:51:20
Acknowledged.
On 2013/03/25 21:37:39, Dan Beam wro
| |
| 322 (IsInstantExtendedAPIEnabled() && | |
| 323 url == GURL(chrome::kChromeSearchLocalOmniboxPopupURL))); | |
| 324 } | 323 } |
| 325 | 324 |
| 326 void RegisterUserPrefs(PrefRegistrySyncable* registry) { | 325 void RegisterUserPrefs(PrefRegistrySyncable* registry) { |
| 327 registry->RegisterBooleanPref(prefs::kInstantConfirmDialogShown, false, | 326 registry->RegisterBooleanPref(prefs::kInstantConfirmDialogShown, false, |
| 328 PrefRegistrySyncable::SYNCABLE_PREF); | 327 PrefRegistrySyncable::SYNCABLE_PREF); |
| 329 registry->RegisterBooleanPref(prefs::kInstantEnabled, false, | 328 registry->RegisterBooleanPref(prefs::kInstantEnabled, false, |
| 330 PrefRegistrySyncable::SYNCABLE_PREF); | 329 PrefRegistrySyncable::SYNCABLE_PREF); |
| 331 // This default is overridden by SetInstantExtendedPrefDefault(). | 330 // This default is overridden by SetInstantExtendedPrefDefault(). |
| 332 registry->RegisterBooleanPref(prefs::kInstantExtendedEnabled, false, | 331 registry->RegisterBooleanPref(prefs::kInstantExtendedEnabled, false, |
| 333 PrefRegistrySyncable::SYNCABLE_PREF); | 332 PrefRegistrySyncable::SYNCABLE_PREF); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 541 GURL::Replacements replacements; | 540 GURL::Replacements replacements; |
| 542 replacements.SetSchemeStr(search_scheme); | 541 replacements.SetSchemeStr(search_scheme); |
| 543 replacements.SetHostStr(search_host); | 542 replacements.SetHostStr(search_host); |
| 544 replacements.SetPortStr(search_port); | 543 replacements.SetPortStr(search_port); |
| 545 replacements.SetPathStr(search_path); | 544 replacements.SetPathStr(search_path); |
| 546 return instant_url.ReplaceComponents(replacements); | 545 return instant_url.ReplaceComponents(replacements); |
| 547 } | 546 } |
| 548 | 547 |
| 549 } // namespace search | 548 } // namespace search |
| 550 } // namespace chrome | 549 } // namespace chrome |
| OLD | NEW |