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

Side by Side Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 159883002: Move TranslatePrefs to the Translate component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@acceptLanguages
Patch Set: Fix ChromeOS browsertests Created 6 years, 10 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/tab_contents/render_view_context_menu.h" 5 #include "chrome/browser/tab_contents/render_view_context_menu.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "chrome/browser/search_engines/search_terms_data.h" 44 #include "chrome/browser/search_engines/search_terms_data.h"
45 #include "chrome/browser/search_engines/template_url.h" 45 #include "chrome/browser/search_engines/template_url.h"
46 #include "chrome/browser/search_engines/template_url_service.h" 46 #include "chrome/browser/search_engines/template_url_service.h"
47 #include "chrome/browser/search_engines/template_url_service_factory.h" 47 #include "chrome/browser/search_engines/template_url_service_factory.h"
48 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" 48 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h"
49 #include "chrome/browser/spellchecker/spellcheck_service.h" 49 #include "chrome/browser/spellchecker/spellcheck_service.h"
50 #include "chrome/browser/tab_contents/retargeting_details.h" 50 #include "chrome/browser/tab_contents/retargeting_details.h"
51 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" 51 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h"
52 #include "chrome/browser/tab_contents/spelling_menu_observer.h" 52 #include "chrome/browser/tab_contents/spelling_menu_observer.h"
53 #include "chrome/browser/translate/translate_manager.h" 53 #include "chrome/browser/translate/translate_manager.h"
54 #include "chrome/browser/translate/translate_prefs.h"
55 #include "chrome/browser/translate/translate_tab_helper.h" 54 #include "chrome/browser/translate/translate_tab_helper.h"
56 #include "chrome/browser/ui/browser.h" 55 #include "chrome/browser/ui/browser.h"
57 #include "chrome/browser/ui/browser_commands.h" 56 #include "chrome/browser/ui/browser_commands.h"
58 #include "chrome/browser/ui/browser_finder.h" 57 #include "chrome/browser/ui/browser_finder.h"
59 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" 58 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
60 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 59 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
61 #include "chrome/common/chrome_constants.h" 60 #include "chrome/common/chrome_constants.h"
62 #include "chrome/common/chrome_switches.h" 61 #include "chrome/common/chrome_switches.h"
63 #include "chrome/common/content_restriction.h" 62 #include "chrome/common/content_restriction.h"
64 #include "chrome/common/net/url_util.h" 63 #include "chrome/common/net/url_util.h"
65 #include "chrome/common/pref_names.h" 64 #include "chrome/common/pref_names.h"
66 #include "chrome/common/render_messages.h" 65 #include "chrome/common/render_messages.h"
67 #include "chrome/common/spellcheck_messages.h" 66 #include "chrome/common/spellcheck_messages.h"
68 #include "chrome/common/url_constants.h" 67 #include "chrome/common/url_constants.h"
69 #include "components/translate/core/browser/translate_download_manager.h" 68 #include "components/translate/core/browser/translate_download_manager.h"
69 #include "components/translate/core/browser/translate_prefs.h"
70 #include "content/public/browser/child_process_security_policy.h" 70 #include "content/public/browser/child_process_security_policy.h"
71 #include "content/public/browser/download_manager.h" 71 #include "content/public/browser/download_manager.h"
72 #include "content/public/browser/download_save_info.h" 72 #include "content/public/browser/download_save_info.h"
73 #include "content/public/browser/download_url_parameters.h" 73 #include "content/public/browser/download_url_parameters.h"
74 #include "content/public/browser/navigation_details.h" 74 #include "content/public/browser/navigation_details.h"
75 #include "content/public/browser/navigation_entry.h" 75 #include "content/public/browser/navigation_entry.h"
76 #include "content/public/browser/notification_service.h" 76 #include "content/public/browser/notification_service.h"
77 #include "content/public/browser/render_frame_host.h" 77 #include "content/public/browser/render_frame_host.h"
78 #include "content/public/browser/render_process_host.h" 78 #include "content/public/browser/render_process_host.h"
79 #include "content/public/browser/render_view_host.h" 79 #include "content/public/browser/render_view_host.h"
(...skipping 1740 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 translate_tab_helper->GetLanguageState().IsPageTranslated() || 1820 translate_tab_helper->GetLanguageState().IsPageTranslated() ||
1821 translate_tab_helper->GetLanguageState().translation_pending()) { 1821 translate_tab_helper->GetLanguageState().translation_pending()) {
1822 return; 1822 return;
1823 } 1823 }
1824 std::string original_lang = 1824 std::string original_lang =
1825 translate_tab_helper->GetLanguageState().original_language(); 1825 translate_tab_helper->GetLanguageState().original_language();
1826 std::string target_lang = g_browser_process->GetApplicationLocale(); 1826 std::string target_lang = g_browser_process->GetApplicationLocale();
1827 target_lang = TranslateDownloadManager::GetLanguageCode(target_lang); 1827 target_lang = TranslateDownloadManager::GetLanguageCode(target_lang);
1828 // Since the user decided to translate for that language and site, clears 1828 // Since the user decided to translate for that language and site, clears
1829 // any preferences for not translating them. 1829 // any preferences for not translating them.
1830 TranslatePrefs prefs(profile_->GetPrefs()); 1830 scoped_ptr<TranslatePrefs> prefs(
1831 prefs.UnblockLanguage(original_lang); 1831 TranslateTabHelper::CreateTranslatePrefs(profile_->GetPrefs()));
1832 prefs.RemoveSiteFromBlacklist(params_.page_url.HostNoBrackets()); 1832 prefs->UnblockLanguage(original_lang);
1833 prefs->RemoveSiteFromBlacklist(params_.page_url.HostNoBrackets());
1833 TranslateManager::GetInstance()->TranslatePage( 1834 TranslateManager::GetInstance()->TranslatePage(
1834 source_web_contents_, original_lang, target_lang); 1835 source_web_contents_, original_lang, target_lang);
1835 break; 1836 break;
1836 } 1837 }
1837 1838
1838 case IDC_CONTENT_CONTEXT_RELOADFRAME: 1839 case IDC_CONTENT_CONTEXT_RELOADFRAME:
1839 rvh->ReloadFrame(); 1840 rvh->ReloadFrame();
1840 break; 1841 break;
1841 1842
1842 case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE: 1843 case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE:
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 source_web_contents_->GetRenderViewHost()-> 2110 source_web_contents_->GetRenderViewHost()->
2110 ExecuteMediaPlayerActionAtLocation(location, action); 2111 ExecuteMediaPlayerActionAtLocation(location, action);
2111 } 2112 }
2112 2113
2113 void RenderViewContextMenu::PluginActionAt( 2114 void RenderViewContextMenu::PluginActionAt(
2114 const gfx::Point& location, 2115 const gfx::Point& location,
2115 const WebPluginAction& action) { 2116 const WebPluginAction& action) {
2116 source_web_contents_->GetRenderViewHost()-> 2117 source_web_contents_->GetRenderViewHost()->
2117 ExecutePluginActionAtLocation(location, action); 2118 ExecutePluginActionAtLocation(location, action);
2118 } 2119 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698