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

Unified Diff: chrome/browser/ui/search_engines/search_engine_tab_helper.cc

Issue 10021008: Reland r131019: Move most TemplateURL data members to a new struct, TemplateURLData. This allows us… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/search_engines/search_engine_tab_helper.cc
===================================================================
--- chrome/browser/ui/search_engines/search_engine_tab_helper.cc (revision 131175)
+++ chrome/browser/ui/search_engines/search_engine_tab_helper.cc (working copy)
@@ -171,11 +171,10 @@
url_service->Remove(current_url);
}
- TemplateURL* new_url = new TemplateURL();
- new_url->set_short_name(keyword);
- new_url->set_keyword(keyword);
- new_url->set_safe_for_autoreplace(true);
- new_url->add_input_encoding(params.searchable_form_encoding);
+ TemplateURLData data;
+ data.short_name = keyword;
+ data.SetKeyword(keyword);
+ data.SetURL(url.spec());
DCHECK(controller.GetLastCommittedEntry());
const GURL& current_favicon =
controller.GetLastCommittedEntry()->GetFavicon().url;
@@ -184,9 +183,9 @@
// latter.
// TODO(sky): Need a way to set the favicon that doesn't involve generating
// its url.
- const GURL& favicon_url = current_favicon.is_valid() ?
+ data.favicon_url = current_favicon.is_valid() ?
current_favicon : TemplateURL::GenerateFaviconURL(params.referrer.url);
- new_url->SetURL(url.spec());
- new_url->set_favicon_url(favicon_url);
- url_service->Add(new_url);
+ data.safe_for_autoreplace = true;
+ data.input_encodings.push_back(params.searchable_form_encoding);
+ url_service->Add(new TemplateURL(data));
}

Powered by Google App Engine
This is Rietveld 408576698