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

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

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 9 years, 7 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/instant_controller.h" 5 #include "chrome/browser/instant/instant_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // it is correctly set. 51 // it is correctly set.
52 service->SetBoolean(prefs::kInstantEnabledOnce, true); 52 service->SetBoolean(prefs::kInstantEnabledOnce, true);
53 } 53 }
54 } 54 }
55 55
56 InstantController::~InstantController() { 56 InstantController::~InstantController() {
57 } 57 }
58 58
59 // static 59 // static
60 void InstantController::RegisterUserPrefs(PrefService* prefs) { 60 void InstantController::RegisterUserPrefs(PrefService* prefs) {
61 prefs->RegisterBooleanPref(prefs::kInstantConfirmDialogShown, false); 61 prefs->RegisterBooleanPref(prefs::kInstantConfirmDialogShown,
62 prefs->RegisterBooleanPref(prefs::kInstantEnabled, false); 62 false,
63 prefs->RegisterBooleanPref(prefs::kInstantEnabledOnce, false); 63 false /* don't sync pref */);
64 prefs->RegisterInt64Pref(prefs::kInstantEnabledTime, false); 64 prefs->RegisterBooleanPref(prefs::kInstantEnabled,
65 false,
66 false /* don't sync pref */);
67 prefs->RegisterBooleanPref(prefs::kInstantEnabledOnce,
68 false,
69 false /* don't sync pref */);
70 prefs->RegisterInt64Pref(prefs::kInstantEnabledTime,
71 false,
72 false /* don't sync pref */);
65 PromoCounter::RegisterUserPrefs(prefs, prefs::kInstantPromo); 73 PromoCounter::RegisterUserPrefs(prefs, prefs::kInstantPromo);
66 } 74 }
67 75
68 // static 76 // static
69 void InstantController::RecordMetrics(Profile* profile) { 77 void InstantController::RecordMetrics(Profile* profile) {
70 if (!IsEnabled(profile)) 78 if (!IsEnabled(profile))
71 return; 79 return;
72 80
73 PrefService* service = profile->GetPrefs(); 81 PrefService* service = profile->GetPrefs();
74 if (service) { 82 if (service) {
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 const AutocompleteMatch& match) { 685 const AutocompleteMatch& match) {
678 const TemplateURL* template_url = match.template_url; 686 const TemplateURL* template_url = match.template_url;
679 if (match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED || 687 if (match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED ||
680 match.type == AutocompleteMatch::SEARCH_HISTORY || 688 match.type == AutocompleteMatch::SEARCH_HISTORY ||
681 match.type == AutocompleteMatch::SEARCH_SUGGEST) { 689 match.type == AutocompleteMatch::SEARCH_SUGGEST) {
682 TemplateURLModel* model = tab_contents_->profile()->GetTemplateURLModel(); 690 TemplateURLModel* model = tab_contents_->profile()->GetTemplateURLModel();
683 template_url = model ? model->GetDefaultSearchProvider() : NULL; 691 template_url = model ? model->GetDefaultSearchProvider() : NULL;
684 } 692 }
685 return template_url; 693 return template_url;
686 } 694 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698