Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/search_engines/keyword_editor_controller.h" | 5 #include "chrome/browser/search_engines/keyword_editor_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/metrics/user_metrics.h" | 7 #include "chrome/browser/metrics/user_metrics.h" |
| 8 #include "chrome/browser/profile.h" | 8 #include "chrome/browser/profile.h" |
| 9 #include "chrome/browser/search_engines/template_url.h" | 9 #include "chrome/browser/search_engines/template_url.h" |
| 10 #include "chrome/browser/search_engines/template_url_model.h" | 10 #include "chrome/browser/search_engines/template_url_model.h" |
| 11 #include "chrome/browser/search_engines/template_url_table_model.h" | 11 #include "chrome/browser/search_engines/template_url_table_model.h" |
| 12 #include "chrome/common/pref_names.h" | |
| 13 #include "chrome/common/pref_service.h" | |
| 12 | 14 |
| 13 KeywordEditorController::KeywordEditorController(Profile* profile) | 15 KeywordEditorController::KeywordEditorController(Profile* profile) |
| 14 : profile_(profile) { | 16 : profile_(profile) { |
| 15 table_model_.reset(new TemplateURLTableModel(profile->GetTemplateURLModel())); | 17 table_model_.reset(new TemplateURLTableModel(profile->GetTemplateURLModel())); |
| 16 } | 18 } |
| 17 | 19 |
| 18 KeywordEditorController::~KeywordEditorController() { | 20 KeywordEditorController::~KeywordEditorController() { |
| 19 } | 21 } |
| 20 | 22 |
| 23 // static | |
| 24 // TODO(22269): Other platforms besides Mac should remember window placement. | |
|
pink (ping after 24hrs)
2009/09/18 19:12:50
usually the format for this is:
// TODO(yourNameHe
| |
| 25 void KeywordEditorController::RegisterPrefs(PrefService* prefs) { | |
| 26 prefs->RegisterDictionaryPref(prefs::kKeywordEditorWindowPlacement); | |
| 27 } | |
| 28 | |
| 21 int KeywordEditorController::AddTemplateURL(const std::wstring& title, | 29 int KeywordEditorController::AddTemplateURL(const std::wstring& title, |
| 22 const std::wstring& keyword, | 30 const std::wstring& keyword, |
| 23 const std::wstring& url) { | 31 const std::wstring& url) { |
| 24 DCHECK(!url.empty()); | 32 DCHECK(!url.empty()); |
| 25 | 33 |
| 26 UserMetrics::RecordAction(L"KeywordEditor_AddKeyword", profile_); | 34 UserMetrics::RecordAction(L"KeywordEditor_AddKeyword", profile_); |
| 27 | 35 |
| 28 TemplateURL* template_url = new TemplateURL(); | 36 TemplateURL* template_url = new TemplateURL(); |
| 29 template_url->set_short_name(title); | 37 template_url->set_short_name(title); |
| 30 template_url->set_keyword(keyword); | 38 template_url->set_keyword(keyword); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 return url_model()->loaded(); | 97 return url_model()->loaded(); |
| 90 } | 98 } |
| 91 | 99 |
| 92 const TemplateURL* KeywordEditorController::GetTemplateURL(int index) const { | 100 const TemplateURL* KeywordEditorController::GetTemplateURL(int index) const { |
| 93 return &table_model_->GetTemplateURL(index); | 101 return &table_model_->GetTemplateURL(index); |
| 94 } | 102 } |
| 95 | 103 |
| 96 TemplateURLModel* KeywordEditorController::url_model() const { | 104 TemplateURLModel* KeywordEditorController::url_model() const { |
| 97 return table_model_->template_url_model(); | 105 return table_model_->template_url_model(); |
| 98 } | 106 } |
| OLD | NEW |