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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 return false; | 339 return false; |
340 | 340 |
341 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 341 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
342 return IsInstantExtendedAPIEnabled() && | 342 return IsInstantExtendedAPIEnabled() && |
343 IsRenderedInInstantProcess(contents, profile) && | 343 IsRenderedInInstantProcess(contents, profile) && |
344 (IsInstantURL(entry->GetVirtualURL(), profile) || | 344 (IsInstantURL(entry->GetVirtualURL(), profile) || |
345 entry->GetVirtualURL() == GetLocalInstantURL(profile)) && | 345 entry->GetVirtualURL() == GetLocalInstantURL(profile)) && |
346 GetSearchTermsImpl(contents, entry).empty(); | 346 GetSearchTermsImpl(contents, entry).empty(); |
347 } | 347 } |
348 | 348 |
349 void RegisterInstantUserPrefs(PrefRegistrySyncable* registry) { | 349 void RegisterInstantUserPrefs(user_prefs::PrefRegistrySyncable* registry) { |
350 registry->RegisterBooleanPref(prefs::kInstantEnabled, false, | 350 registry->RegisterBooleanPref( |
351 PrefRegistrySyncable::SYNCABLE_PREF); | 351 prefs::kInstantEnabled, |
| 352 false, |
| 353 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
352 // This default is overridden by SetInstantExtendedPrefDefault(). | 354 // This default is overridden by SetInstantExtendedPrefDefault(). |
353 registry->RegisterBooleanPref(prefs::kInstantExtendedEnabled, false, | 355 registry->RegisterBooleanPref( |
354 PrefRegistrySyncable::SYNCABLE_PREF); | 356 prefs::kInstantExtendedEnabled, |
| 357 false, |
| 358 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
355 } | 359 } |
356 | 360 |
357 const char* GetInstantPrefName() { | 361 const char* GetInstantPrefName() { |
358 return IsInstantExtendedAPIEnabled() ? prefs::kInstantExtendedEnabled : | 362 return IsInstantExtendedAPIEnabled() ? prefs::kInstantExtendedEnabled : |
359 prefs::kInstantEnabled; | 363 prefs::kInstantEnabled; |
360 } | 364 } |
361 | 365 |
362 void SetInstantExtendedPrefDefault(Profile* profile) { | 366 void SetInstantExtendedPrefDefault(Profile* profile) { |
363 PrefService* prefs = profile ? profile->GetPrefs() : NULL; | 367 PrefService* prefs = profile ? profile->GetPrefs() : NULL; |
364 if (!prefs) | 368 if (!prefs) |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 | 628 |
625 GURL instant_url = TemplateURLRefToGURL(template_url->instant_url_ref(), | 629 GURL instant_url = TemplateURLRefToGURL(template_url->instant_url_ref(), |
626 kDisableStartMargin); | 630 kDisableStartMargin); |
627 // Extended mode instant requires a search terms replacement key. | 631 // Extended mode instant requires a search terms replacement key. |
628 return instant_url.is_valid() && | 632 return instant_url.is_valid() && |
629 (!IsInstantExtendedAPIEnabled() || | 633 (!IsInstantExtendedAPIEnabled() || |
630 template_url->HasSearchTermsReplacementKey(instant_url)); | 634 template_url->HasSearchTermsReplacementKey(instant_url)); |
631 } | 635 } |
632 | 636 |
633 } // namespace chrome | 637 } // namespace chrome |
OLD | NEW |