summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/search_engines
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-27 20:27:37 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-27 20:27:37 +0000
commit3613347db32e0112c044854949072cd3e7d6e213 (patch)
tree1e9bc2aa368a217d4ffd5d30d85f50cd262af07d /chrome/browser/ui/search_engines
parentf39ed01df297378dc80b670cec60456e5e25cc35 (diff)
downloadchromium_src-3613347db32e0112c044854949072cd3e7d6e213.zip
chromium_src-3613347db32e0112c044854949072cd3e7d6e213.tar.gz
chromium_src-3613347db32e0112c044854949072cd3e7d6e213.tar.bz2
Remove const qualifiers on "TemplateURL*" in many TemplateURLService APIs. This has followon effects in many other places, most noticeably ConfirmAddSearchProvider(), which seems to be declared in like 20 files :P
This removes most const_cast<>()s and makes the TemplateURLService APIs a lot more accurate about when the URLs they take or return can be modified. Note that because most of TemplateURL is now immutable except to friends, this doesn't actually give callers dangerous latitude in mucking with TemplateURLs. This does add a few const_cast<>()s related to keyword autogeneration. Keyword autogeneration will die soon so I didn't care about finding ways around these. BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/10209018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134337 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/search_engines')
-rw-r--r--chrome/browser/ui/search_engines/edit_search_engine_controller.cc4
-rw-r--r--chrome/browser/ui/search_engines/edit_search_engine_controller.h8
-rw-r--r--chrome/browser/ui/search_engines/keyword_editor_controller.cc4
-rw-r--r--chrome/browser/ui/search_engines/keyword_editor_controller.h6
-rw-r--r--chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc2
-rw-r--r--chrome/browser/ui/search_engines/search_engine_tab_helper.cc2
-rw-r--r--chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h2
-rw-r--r--chrome/browser/ui/search_engines/template_url_table_model.cc18
-rw-r--r--chrome/browser/ui/search_engines/template_url_table_model.h2
9 files changed, 24 insertions, 24 deletions
diff --git a/chrome/browser/ui/search_engines/edit_search_engine_controller.cc b/chrome/browser/ui/search_engines/edit_search_engine_controller.cc
index ad9ec91..58562a3 100644
--- a/chrome/browser/ui/search_engines/edit_search_engine_controller.cc
+++ b/chrome/browser/ui/search_engines/edit_search_engine_controller.cc
@@ -17,7 +17,7 @@
using content::UserMetricsAction;
EditSearchEngineController::EditSearchEngineController(
- const TemplateURL* template_url,
+ TemplateURL* template_url,
EditSearchEngineControllerDelegate* edit_keyword_delegate,
Profile* profile)
: template_url_(template_url),
@@ -82,7 +82,7 @@ void EditSearchEngineController::AcceptAddOrEdit(
TemplateURLService* template_url_service =
TemplateURLServiceFactory::GetForProfile(profile_);
- const TemplateURL* existing =
+ TemplateURL* existing =
template_url_service->GetTemplateURLForKeyword(keyword_input);
if (existing && (!edit_keyword_delegate_ || existing != template_url_)) {
// An entry may have been added with the same keyword string while the
diff --git a/chrome/browser/ui/search_engines/edit_search_engine_controller.h b/chrome/browser/ui/search_engines/edit_search_engine_controller.h
index c6cf069..f5aff7f 100644
--- a/chrome/browser/ui/search_engines/edit_search_engine_controller.h
+++ b/chrome/browser/ui/search_engines/edit_search_engine_controller.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -21,7 +21,7 @@ class EditSearchEngineControllerDelegate {
// EditSearchEngineController's constructor, and may be NULL. A NULL value
// indicates a new TemplateURL should be created rather than modifying an
// existing TemplateURL.
- virtual void OnEditedKeyword(const TemplateURL* template_url,
+ virtual void OnEditedKeyword(TemplateURL* template_url,
const string16& title,
const string16& keyword,
const std::string& url) = 0;
@@ -36,7 +36,7 @@ class EditSearchEngineController {
public:
// The |template_url| and/or |edit_keyword_delegate| may be NULL.
EditSearchEngineController(
- const TemplateURL* template_url,
+ TemplateURL* template_url,
EditSearchEngineControllerDelegate* edit_keyword_delegate,
Profile* profile);
~EditSearchEngineController() {}
@@ -76,7 +76,7 @@ class EditSearchEngineController {
// The TemplateURL we're displaying information for. It may be NULL. If we
// have a keyword_editor_view, we assume that this TemplateURL is already in
// the TemplateURLService; if not, we assume it isn't.
- const TemplateURL* template_url_;
+ TemplateURL* template_url_;
// We may have been created by this, in which case we will call back to it on
// success to add/modify the entry. May be NULL.
diff --git a/chrome/browser/ui/search_engines/keyword_editor_controller.cc b/chrome/browser/ui/search_engines/keyword_editor_controller.cc
index 18899c8..6118b76 100644
--- a/chrome/browser/ui/search_engines/keyword_editor_controller.cc
+++ b/chrome/browser/ui/search_engines/keyword_editor_controller.cc
@@ -50,7 +50,7 @@ int KeywordEditorController::AddTemplateURL(const string16& title,
return new_index;
}
-void KeywordEditorController::ModifyTemplateURL(const TemplateURL* template_url,
+void KeywordEditorController::ModifyTemplateURL(TemplateURL* template_url,
const string16& title,
const string16& keyword,
const std::string& url) {
@@ -98,7 +98,7 @@ bool KeywordEditorController::loaded() const {
return url_model()->loaded();
}
-const TemplateURL* KeywordEditorController::GetTemplateURL(int index) const {
+TemplateURL* KeywordEditorController::GetTemplateURL(int index) {
return table_model_->GetTemplateURL(index);
}
diff --git a/chrome/browser/ui/search_engines/keyword_editor_controller.h b/chrome/browser/ui/search_engines/keyword_editor_controller.h
index 8b4e0e9..565c1d8 100644
--- a/chrome/browser/ui/search_engines/keyword_editor_controller.h
+++ b/chrome/browser/ui/search_engines/keyword_editor_controller.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -34,7 +34,7 @@ class KeywordEditorController {
// Invoked when the user modifies a TemplateURL. Updates the
// TemplateURLService and table model appropriately.
- void ModifyTemplateURL(const TemplateURL* template_url,
+ void ModifyTemplateURL(TemplateURL* template_url,
const string16& title,
const string16& keyword,
const std::string& url);
@@ -59,7 +59,7 @@ class KeywordEditorController {
bool loaded() const;
// Return the TemplateURL corresponding to the |index| in the model.
- const TemplateURL* GetTemplateURL(int index) const;
+ TemplateURL* GetTemplateURL(int index);
TemplateURLTableModel* table_model() {
return table_model_.get();
diff --git a/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc b/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc
index 7373089..276f00d 100644
--- a/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc
+++ b/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc
@@ -146,7 +146,7 @@ TEST_F(KeywordEditorControllerTest, Modify) {
ClearChangeCount();
// Modify the entry.
- const TemplateURL* turl = model_->GetTemplateURLs()[0];
+ TemplateURL* turl = model_->GetTemplateURLs()[0];
controller_->ModifyTemplateURL(turl, kA1, kB1, "http://c1");
// Make sure it was updated appropriately.
diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
index b10bfac..0a93c5b 100644
--- a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
+++ b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
@@ -157,7 +157,7 @@ void SearchEngineTabHelper::GenerateKeywordIfNecessary(
return;
}
- const TemplateURL* current_url;
+ TemplateURL* current_url;
GURL url = params.searchable_form_url;
if (!url_service->CanReplaceKeyword(keyword, url, &current_url))
return;
diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h b/chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h
index b6eaf3b2..4ab194b 100644
--- a/chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h
+++ b/chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h
@@ -19,7 +19,7 @@ class SearchEngineTabHelperDelegate {
public:
// Shows a confirmation dialog box for adding a search engine described by
// |template_url|. Takes ownership of |template_url|.
- virtual void ConfirmAddSearchProvider(const TemplateURL* template_url,
+ virtual void ConfirmAddSearchProvider(TemplateURL* template_url,
Profile* profile) = 0;
protected:
diff --git a/chrome/browser/ui/search_engines/template_url_table_model.cc b/chrome/browser/ui/search_engines/template_url_table_model.cc
index 256a9c1..8ba1e88 100644
--- a/chrome/browser/ui/search_engines/template_url_table_model.cc
+++ b/chrome/browser/ui/search_engines/template_url_table_model.cc
@@ -35,7 +35,7 @@ static SkBitmap* default_icon = NULL;
class ModelEntry {
public:
- ModelEntry(TemplateURLTableModel* model, const TemplateURL* template_url)
+ ModelEntry(TemplateURLTableModel* model, TemplateURL* template_url)
: template_url_(template_url),
load_state_(NOT_LOADED),
model_(model) {
@@ -45,7 +45,7 @@ class ModelEntry {
}
}
- const TemplateURL* template_url() {
+ TemplateURL* template_url() {
return template_url_;
}
@@ -108,7 +108,7 @@ class ModelEntry {
}
}
- const TemplateURL* template_url_;
+ TemplateURL* template_url_;
SkBitmap favicon_;
LoadState load_state_;
TemplateURLTableModel* model_;
@@ -145,7 +145,7 @@ void TemplateURLTableModel::Reload() {
// Keywords that can be made the default first.
for (TemplateURLService::TemplateURLVector::iterator i = urls.begin();
i != urls.end(); ++i) {
- const TemplateURL* template_url = *i;
+ TemplateURL* template_url = *i;
// NOTE: we don't use ShowInDefaultList here to avoid items bouncing around
// the lists while editing.
if (template_url->show_in_default_list())
@@ -157,7 +157,7 @@ void TemplateURLTableModel::Reload() {
// Then the rest.
for (TemplateURLService::TemplateURLVector::iterator i = urls.begin();
i != urls.end(); ++i) {
- const TemplateURL* template_url = *i;
+ TemplateURL* template_url = *i;
// NOTE: we don't use ShowInDefaultList here to avoid things bouncing
// the lists while editing.
if (!template_url->show_in_default_list() &&
@@ -233,7 +233,7 @@ void TemplateURLTableModel::Remove(int index) {
// Remove the observer while we modify the model, that way we don't need to
// worry about the model calling us back when we mutate it.
template_url_service_->RemoveObserver(this);
- const TemplateURL* template_url = GetTemplateURL(index);
+ TemplateURL* template_url = GetTemplateURL(index);
scoped_ptr<ModelEntry> entry(entries_[index]);
entries_.erase(entries_.begin() + index);
@@ -274,7 +274,7 @@ void TemplateURLTableModel::ModifyTemplateURL(int index,
const std::string& url) {
DCHECK(index >= 0 && index <= RowCount());
DCHECK(!url.empty());
- const TemplateURL* template_url = GetTemplateURL(index);
+ TemplateURL* template_url = GetTemplateURL(index);
// The default search provider should support replacement.
DCHECK(template_url_service_->GetDefaultSearchProvider() != template_url ||
template_url->SupportsReplacement());
@@ -292,7 +292,7 @@ void TemplateURLTableModel::ReloadIcon(int index) {
NotifyChanged(index);
}
-const TemplateURL* TemplateURLTableModel::GetTemplateURL(int index) {
+TemplateURL* TemplateURLTableModel::GetTemplateURL(int index) {
return entries_[index]->template_url();
}
@@ -329,7 +329,7 @@ int TemplateURLTableModel::MakeDefaultTemplateURL(int index) {
return -1;
}
- const TemplateURL* keyword = GetTemplateURL(index);
+ TemplateURL* keyword = GetTemplateURL(index);
const TemplateURL* current_default =
template_url_service_->GetDefaultSearchProvider();
if (current_default == keyword)
diff --git a/chrome/browser/ui/search_engines/template_url_table_model.h b/chrome/browser/ui/search_engines/template_url_table_model.h
index 702d7cb9..3ee549b 100644
--- a/chrome/browser/ui/search_engines/template_url_table_model.h
+++ b/chrome/browser/ui/search_engines/template_url_table_model.h
@@ -70,7 +70,7 @@ class TemplateURLTableModel : public ui::TableModel,
void ReloadIcon(int index);
// Returns the TemplateURL at the specified index.
- const TemplateURL* GetTemplateURL(int index);
+ TemplateURL* GetTemplateURL(int index);
// Returns the index of the TemplateURL, or -1 if it the TemplateURL is not
// found.