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

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

Issue 2602003: Refactored the translate infobars. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Synced Created 10 years, 6 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <functional> 5 #include <functional>
6 6
7 #include "chrome/browser/tab_contents/render_view_context_menu.h" 7 #include "chrome/browser/tab_contents/render_view_context_menu.h"
8 8
9 #include "app/clipboard/clipboard.h" 9 #include "app/clipboard/clipboard.h"
10 #include "app/clipboard/scoped_clipboard_writer.h" 10 #include "app/clipboard/scoped_clipboard_writer.h"
(...skipping 17 matching lines...) Expand all
28 #include "chrome/browser/platform_util.h" 28 #include "chrome/browser/platform_util.h"
29 #include "chrome/browser/pref_service.h" 29 #include "chrome/browser/pref_service.h"
30 #include "chrome/browser/profile.h" 30 #include "chrome/browser/profile.h"
31 #include "chrome/browser/renderer_host/render_view_host.h" 31 #include "chrome/browser/renderer_host/render_view_host.h"
32 #include "chrome/browser/search_engines/template_url_model.h" 32 #include "chrome/browser/search_engines/template_url_model.h"
33 #include "chrome/browser/spellcheck_host.h" 33 #include "chrome/browser/spellcheck_host.h"
34 #include "chrome/browser/spellchecker_platform_engine.h" 34 #include "chrome/browser/spellchecker_platform_engine.h"
35 #include "chrome/browser/tab_contents/navigation_entry.h" 35 #include "chrome/browser/tab_contents/navigation_entry.h"
36 #include "chrome/browser/tab_contents/tab_contents.h" 36 #include "chrome/browser/tab_contents/tab_contents.h"
37 #include "chrome/browser/translate/translate_manager.h" 37 #include "chrome/browser/translate/translate_manager.h"
38 #if defined(OS_WIN)
39 #include "chrome/browser/translate/translate_manager2.h"
40 #endif
38 #include "chrome/common/chrome_switches.h" 41 #include "chrome/common/chrome_switches.h"
39 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
40 #include "chrome/common/url_constants.h" 43 #include "chrome/common/url_constants.h"
41 #include "grit/generated_resources.h" 44 #include "grit/generated_resources.h"
42 #include "net/base/escape.h" 45 #include "net/base/escape.h"
43 #include "net/url_request/url_request.h" 46 #include "net/url_request/url_request.h"
44 #include "webkit/glue/webmenuitem.h" 47 #include "webkit/glue/webmenuitem.h"
45 #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h" 48 #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h"
46 #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h" 49 #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h"
47 #include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h" 50 #include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h"
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 } 1131 }
1129 std::string original_lang = 1132 std::string original_lang =
1130 source_tab_contents_->language_state().original_language(); 1133 source_tab_contents_->language_state().original_language();
1131 std::string target_lang = g_browser_process->GetApplicationLocale(); 1134 std::string target_lang = g_browser_process->GetApplicationLocale();
1132 target_lang = TranslateManager::GetLanguageCode(target_lang); 1135 target_lang = TranslateManager::GetLanguageCode(target_lang);
1133 // Since the user decided to translate for that language and site, clears 1136 // Since the user decided to translate for that language and site, clears
1134 // any preferences for not translating them. 1137 // any preferences for not translating them.
1135 TranslatePrefs prefs(profile_->GetPrefs()); 1138 TranslatePrefs prefs(profile_->GetPrefs());
1136 prefs.RemoveLanguageFromBlacklist(original_lang); 1139 prefs.RemoveLanguageFromBlacklist(original_lang);
1137 prefs.RemoveSiteFromBlacklist(params_.page_url.HostNoBrackets()); 1140 prefs.RemoveSiteFromBlacklist(params_.page_url.HostNoBrackets());
1141 #if defined(OS_WIN)
1142 Singleton<TranslateManager2>::get()->TranslatePage(
1143 source_tab_contents_, original_lang, target_lang);
1144 #else
1138 Singleton<TranslateManager>::get()->TranslatePage( 1145 Singleton<TranslateManager>::get()->TranslatePage(
1139 source_tab_contents_, original_lang, target_lang); 1146 source_tab_contents_, original_lang, target_lang);
1147 #endif
1140 break; 1148 break;
1141 } 1149 }
1142 1150
1143 case IDC_CONTENT_CONTEXT_RELOADFRAME: 1151 case IDC_CONTENT_CONTEXT_RELOADFRAME:
1144 source_tab_contents_->render_view_host()->ReloadFrame(); 1152 source_tab_contents_->render_view_host()->ReloadFrame();
1145 break; 1153 break;
1146 1154
1147 case IDC_CONTENT_CONTEXT_OPENFRAMENEWTAB: 1155 case IDC_CONTENT_CONTEXT_OPENFRAMENEWTAB:
1148 OpenURL(params_.frame_url, NEW_BACKGROUND_TAB, PageTransition::LINK); 1156 OpenURL(params_.frame_url, NEW_BACKGROUND_TAB, PageTransition::LINK);
1149 break; 1157 break;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), 1359 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages),
1352 g_browser_process->clipboard()); 1360 g_browser_process->clipboard());
1353 } 1361 }
1354 1362
1355 void RenderViewContextMenu::MediaPlayerActionAt( 1363 void RenderViewContextMenu::MediaPlayerActionAt(
1356 const gfx::Point& location, 1364 const gfx::Point& location,
1357 const WebMediaPlayerAction& action) { 1365 const WebMediaPlayerAction& action) {
1358 source_tab_contents_->render_view_host()->MediaPlayerActionAt( 1366 source_tab_contents_->render_view_host()->MediaPlayerActionAt(
1359 location, action); 1367 location, action);
1360 } 1368 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/infobar_delegate.h ('k') | chrome/browser/translate/languages_menu_model2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698