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

Unified Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 9982018: Move most TemplateURL data members to a new struct, TemplateURLData. This allows us to eliminate t… (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/tab_contents/render_view_context_menu.cc
===================================================================
--- chrome/browser/tab_contents/render_view_context_menu.cc (revision 130759)
+++ chrome/browser/tab_contents/render_view_context_menu.cc (working copy)
@@ -1828,24 +1828,23 @@
return;
model->Load();
- scoped_ptr<TemplateURL> template_url(new TemplateURL);
- string16 keyword =
- net::StripWWW(UTF8ToUTF16((params_.page_url.host())));
- template_url->set_short_name(keyword);
- template_url->set_keyword(keyword);
- template_url->SetURL(params_.keyword_url.spec());
- template_url->set_favicon_url(TemplateURL::GenerateFaviconURL(
- params_.page_url.GetOrigin()));
-
TabContentsWrapper* tab_contents_wrapper =
TabContentsWrapper::GetCurrentWrapperForContents(
source_web_contents_);
if (tab_contents_wrapper &&
tab_contents_wrapper->search_engine_tab_helper() &&
tab_contents_wrapper->search_engine_tab_helper()->delegate()) {
- // Takes ownership of |template_url|.
+ string16 keyword(TemplateURLService::GenerateKeyword(params_.page_url,
+ false));
+ TemplateURLData data;
+ data.short_name = keyword;
+ data.SetKeyword(keyword);
+ data.SetURL(params_.keyword_url.spec());
+ data.favicon_url =
+ TemplateURL::GenerateFaviconURL(params_.page_url.GetOrigin());
+ // Takes ownership of the TemplateURL.
tab_contents_wrapper->search_engine_tab_helper()->delegate()->
- ConfirmAddSearchProvider(template_url.release(), profile_);
+ ConfirmAddSearchProvider(new TemplateURL(data), profile_);
}
break;
}

Powered by Google App Engine
This is Rietveld 408576698