Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: chrome/browser/instant/search.cc

Issue 12378025: Record InstantExtended pref setting on startup with an UMA histogram. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Note that this is only recorded for the first profile that calls this
346 // code (which happens on startup).
347 static bool recorded = false;
348 if (!recorded) {
349 UMA_HISTOGRAM_BOOLEAN("InstantExtended.PrefValue", pref_value);
350 recorded = true;
351 }
352 }
353
354 return pref_value;
342 } 355 }
343 356
344 void SetInstantExtendedPrefDefault(Profile* profile) { 357 void SetInstantExtendedPrefDefault(Profile* profile) {
345 PrefService* prefs = profile ? profile->GetPrefs() : NULL; 358 PrefService* prefs = profile ? profile->GetPrefs() : NULL;
346 if (!prefs) 359 if (!prefs)
347 return; 360 return;
348 361
349 bool pref_default = false; 362 bool pref_default = false;
350 363
351 // Check the command-line/about:flags setting first, which should have 364 // Check the command-line/about:flags setting first, which should have
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 GURL::Replacements replacements; 530 GURL::Replacements replacements;
518 replacements.SetSchemeStr(search_scheme); 531 replacements.SetSchemeStr(search_scheme);
519 replacements.SetHostStr(search_host); 532 replacements.SetHostStr(search_host);
520 replacements.SetPortStr(search_port); 533 replacements.SetPortStr(search_port);
521 replacements.SetPathStr(search_path); 534 replacements.SetPathStr(search_path);
522 return instant_url.ReplaceComponents(replacements); 535 return instant_url.ReplaceComponents(replacements);
523 } 536 }
524 537
525 } // namespace search 538 } // namespace search
526 } // namespace chrome 539 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698