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/instant/search.h" | 5 #include "chrome/browser/instant/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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 } | 331 } |
| 332 | 332 |
| 333 bool IsInstantPrefEnabled(Profile* profile) { | 333 bool IsInstantPrefEnabled(Profile* profile) { |
| 334 if (!profile || profile->IsOffTheRecord()) | 334 if (!profile || profile->IsOffTheRecord()) |
| 335 return false; | 335 return false; |
| 336 | 336 |
| 337 const PrefService* prefs = profile->GetPrefs(); | 337 const PrefService* prefs = profile->GetPrefs(); |
| 338 if (!prefs) | 338 if (!prefs) |
| 339 return false; | 339 return false; |
| 340 | 340 |
| 341 return prefs->GetBoolean(GetInstantPrefName()); | 341 const char* pref_name = GetInstantPrefName(); |
| 342 const bool pref_value = prefs->GetBoolean(pref_name); | |
| 343 | |
| 344 if (pref_name == prefs::kInstantExtendedEnabled) { | |
| 345 static bool recorded = false; | |
|
sreeram
2013/03/14 18:22:44
Nit: Please add a comment about 'recorded' not bei
Alexei Svitkine (slow)
2013/03/14 18:33:12
Done.
| |
| 346 if (!recorded) { | |
| 347 UMA_HISTOGRAM_BOOLEAN("InstantExtended.PrefValue", pref_value); | |
| 348 recorded = true; | |
| 349 } | |
| 350 } | |
| 351 | |
| 352 return pref_value; | |
| 342 } | 353 } |
| 343 | 354 |
| 344 void SetInstantExtendedPrefDefault(Profile* profile) { | 355 void SetInstantExtendedPrefDefault(Profile* profile) { |
| 345 PrefService* prefs = profile ? profile->GetPrefs() : NULL; | 356 PrefService* prefs = profile ? profile->GetPrefs() : NULL; |
| 346 if (!prefs) | 357 if (!prefs) |
| 347 return; | 358 return; |
| 348 | 359 |
| 349 bool pref_default = false; | 360 bool pref_default = false; |
| 350 | 361 |
| 351 // Check the command-line/about:flags setting first, which should have | 362 // Check the command-line/about:flags setting first, which should have |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 517 GURL::Replacements replacements; | 528 GURL::Replacements replacements; |
| 518 replacements.SetSchemeStr(search_scheme); | 529 replacements.SetSchemeStr(search_scheme); |
| 519 replacements.SetHostStr(search_host); | 530 replacements.SetHostStr(search_host); |
| 520 replacements.SetPortStr(search_port); | 531 replacements.SetPortStr(search_port); |
| 521 replacements.SetPathStr(search_path); | 532 replacements.SetPathStr(search_path); |
| 522 return instant_url.ReplaceComponents(replacements); | 533 return instant_url.ReplaceComponents(replacements); |
| 523 } | 534 } |
| 524 | 535 |
| 525 } // namespace search | 536 } // namespace search |
| 526 } // namespace chrome | 537 } // namespace chrome |
| OLD | NEW |