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

Side by Side Diff: chrome/browser/ui/search_engines/keyword_editor_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/ui/search_engines/keyword_editor_controller.h" 5 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/prefs/pref_service.h" 8 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/search_engines/template_url.h" 10 #include "chrome/browser/search_engines/template_url.h"
11 #include "chrome/browser/search_engines/template_url_model.h" 11 #include "chrome/browser/search_engines/template_url_model.h"
12 #include "chrome/browser/ui/search_engines/template_url_table_model.h" 12 #include "chrome/browser/ui/search_engines/template_url_table_model.h"
13 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
14 #include "content/browser/user_metrics.h" 14 #include "content/browser/user_metrics.h"
15 15
16 KeywordEditorController::KeywordEditorController(Profile* profile) 16 KeywordEditorController::KeywordEditorController(Profile* profile)
17 : profile_(profile) { 17 : profile_(profile) {
18 table_model_.reset(new TemplateURLTableModel(profile->GetTemplateURLModel())); 18 table_model_.reset(new TemplateURLTableModel(profile->GetTemplateURLModel()));
19 } 19 }
20 20
21 KeywordEditorController::~KeywordEditorController() { 21 KeywordEditorController::~KeywordEditorController() {
22 } 22 }
23 23
24 // static 24 // static
25 // TODO(rsesek): Other platforms besides Mac should remember window 25 // TODO(rsesek): Other platforms besides Mac should remember window
26 // placement. http://crbug.com/22269 26 // placement. http://crbug.com/22269
27 void KeywordEditorController::RegisterPrefs(PrefService* prefs) { 27 void KeywordEditorController::RegisterPrefs(PrefService* prefs) {
28 prefs->RegisterDictionaryPref(prefs::kKeywordEditorWindowPlacement); 28 prefs->RegisterDictionaryPref(prefs::kKeywordEditorWindowPlacement,
29 false /* don't sync pref */);
29 } 30 }
30 31
31 int KeywordEditorController::AddTemplateURL(const string16& title, 32 int KeywordEditorController::AddTemplateURL(const string16& title,
32 const string16& keyword, 33 const string16& keyword,
33 const std::string& url) { 34 const std::string& url) {
34 DCHECK(!url.empty()); 35 DCHECK(!url.empty());
35 36
36 UserMetrics::RecordAction(UserMetricsAction("KeywordEditor_AddKeyword")); 37 UserMetrics::RecordAction(UserMetricsAction("KeywordEditor_AddKeyword"));
37 38
38 TemplateURL* template_url = new TemplateURL(); 39 TemplateURL* template_url = new TemplateURL();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return url_model()->loaded(); 103 return url_model()->loaded();
103 } 104 }
104 105
105 const TemplateURL* KeywordEditorController::GetTemplateURL(int index) const { 106 const TemplateURL* KeywordEditorController::GetTemplateURL(int index) const {
106 return &table_model_->GetTemplateURL(index); 107 return &table_model_->GetTemplateURL(index);
107 } 108 }
108 109
109 TemplateURLModel* KeywordEditorController::url_model() const { 110 TemplateURLModel* KeywordEditorController::url_model() const {
110 return table_model_->template_url_model(); 111 return table_model_->template_url_model();
111 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698