| OLD | NEW |
| 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/metrics/user_metrics.h" | 8 #include "chrome/browser/metrics/user_metrics.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/search_engines/template_url.h" | 11 #include "chrome/browser/search_engines/template_url.h" |
| 12 #include "chrome/browser/search_engines/template_url_model.h" | 12 #include "chrome/browser/search_engines/template_url_model.h" |
| 13 #include "chrome/browser/ui/search_engines/template_url_table_model.h" | 13 #include "chrome/browser/ui/search_engines/template_url_table_model.h" |
| 14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.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 profile_); | 38 profile_); |
| 38 | 39 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 return url_model()->loaded(); | 106 return url_model()->loaded(); |
| 106 } | 107 } |
| 107 | 108 |
| 108 const TemplateURL* KeywordEditorController::GetTemplateURL(int index) const { | 109 const TemplateURL* KeywordEditorController::GetTemplateURL(int index) const { |
| 109 return &table_model_->GetTemplateURL(index); | 110 return &table_model_->GetTemplateURL(index); |
| 110 } | 111 } |
| 111 | 112 |
| 112 TemplateURLModel* KeywordEditorController::url_model() const { | 113 TemplateURLModel* KeywordEditorController::url_model() const { |
| 113 return table_model_->template_url_model(); | 114 return table_model_->template_url_model(); |
| 114 } | 115 } |
| OLD | NEW |