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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 #include <utility> 7 #include <utility>
8 8
9 #include "chrome/browser/tab_contents/render_view_context_menu.h" 9 #include "chrome/browser/tab_contents/render_view_context_menu.h"
10 10
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 } 1821 }
1822 1822
1823 case IDC_CONTENT_CONTEXT_ADDSEARCHENGINE: { 1823 case IDC_CONTENT_CONTEXT_ADDSEARCHENGINE: {
1824 // Make sure the model is loaded. 1824 // Make sure the model is loaded.
1825 TemplateURLService* model = 1825 TemplateURLService* model =
1826 TemplateURLServiceFactory::GetForProfile(profile_); 1826 TemplateURLServiceFactory::GetForProfile(profile_);
1827 if (!model) 1827 if (!model)
1828 return; 1828 return;
1829 model->Load(); 1829 model->Load();
1830 1830
1831 scoped_ptr<TemplateURL> template_url(new TemplateURL);
1832 string16 keyword =
1833 net::StripWWW(UTF8ToUTF16((params_.page_url.host())));
1834 template_url->set_short_name(keyword);
1835 template_url->set_keyword(keyword);
1836 template_url->SetURL(params_.keyword_url.spec());
1837 template_url->set_favicon_url(TemplateURL::GenerateFaviconURL(
1838 params_.page_url.GetOrigin()));
1839
1840 TabContentsWrapper* tab_contents_wrapper = 1831 TabContentsWrapper* tab_contents_wrapper =
1841 TabContentsWrapper::GetCurrentWrapperForContents( 1832 TabContentsWrapper::GetCurrentWrapperForContents(
1842 source_web_contents_); 1833 source_web_contents_);
1843 if (tab_contents_wrapper && 1834 if (tab_contents_wrapper &&
1844 tab_contents_wrapper->search_engine_tab_helper() && 1835 tab_contents_wrapper->search_engine_tab_helper() &&
1845 tab_contents_wrapper->search_engine_tab_helper()->delegate()) { 1836 tab_contents_wrapper->search_engine_tab_helper()->delegate()) {
1846 // Takes ownership of |template_url|. 1837 string16 keyword(TemplateURLService::GenerateKeyword(params_.page_url,
1838 false));
1839 TemplateURLData data;
1840 data.short_name = keyword;
1841 data.SetKeyword(keyword);
1842 data.SetURL(params_.keyword_url.spec());
1843 data.favicon_url =
1844 TemplateURL::GenerateFaviconURL(params_.page_url.GetOrigin());
1845 // Takes ownership of the TemplateURL.
1847 tab_contents_wrapper->search_engine_tab_helper()->delegate()-> 1846 tab_contents_wrapper->search_engine_tab_helper()->delegate()->
1848 ConfirmAddSearchProvider(template_url.release(), profile_); 1847 ConfirmAddSearchProvider(new TemplateURL(data), profile_);
1849 } 1848 }
1850 break; 1849 break;
1851 } 1850 }
1852 1851
1853 case IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES: { 1852 case IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES: {
1854 PrefService* prefs = profile_->GetPrefs(); 1853 PrefService* prefs = profile_->GetPrefs();
1855 const bool filter = !prefs->GetBoolean( 1854 const bool filter = !prefs->GetBoolean(
1856 prefs::kSpeechRecognitionFilterProfanities); 1855 prefs::kSpeechRecognitionFilterProfanities);
1857 prefs->SetBoolean(prefs::kSpeechRecognitionFilterProfanities, filter); 1856 prefs->SetBoolean(prefs::kSpeechRecognitionFilterProfanities, filter);
1858 profile_->GetSpeechRecognitionPreferences()->SetFilterProfanities(filter); 1857 profile_->GetSpeechRecognitionPreferences()->SetFilterProfanities(filter);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 source_web_contents_->GetRenderViewHost()-> 1984 source_web_contents_->GetRenderViewHost()->
1986 ExecuteMediaPlayerActionAtLocation(location, action); 1985 ExecuteMediaPlayerActionAtLocation(location, action);
1987 } 1986 }
1988 1987
1989 void RenderViewContextMenu::PluginActionAt( 1988 void RenderViewContextMenu::PluginActionAt(
1990 const gfx::Point& location, 1989 const gfx::Point& location,
1991 const WebPluginAction& action) { 1990 const WebPluginAction& action) {
1992 source_web_contents_->GetRenderViewHost()-> 1991 source_web_contents_->GetRenderViewHost()->
1993 ExecutePluginActionAtLocation(location, action); 1992 ExecutePluginActionAtLocation(location, action);
1994 } 1993 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698