Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer_context_menu/render_view_context_menu.h" | 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1196 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); | 1196 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); |
| 1197 menu_model_.AddItemWithStringId(IDC_SAVE_PAGE, | 1197 menu_model_.AddItemWithStringId(IDC_SAVE_PAGE, |
| 1198 IDS_CONTENT_CONTEXT_SAVEPAGEAS); | 1198 IDS_CONTENT_CONTEXT_SAVEPAGEAS); |
| 1199 menu_model_.AddItemWithStringId(IDC_PRINT, IDS_CONTENT_CONTEXT_PRINT); | 1199 menu_model_.AddItemWithStringId(IDC_PRINT, IDS_CONTENT_CONTEXT_PRINT); |
| 1200 AppendMediaRouterItem(); | 1200 AppendMediaRouterItem(); |
| 1201 | 1201 |
| 1202 if (TranslateService::IsTranslatableURL(params_.page_url)) { | 1202 if (TranslateService::IsTranslatableURL(params_.page_url)) { |
| 1203 std::unique_ptr<translate::TranslatePrefs> prefs( | 1203 std::unique_ptr<translate::TranslatePrefs> prefs( |
| 1204 ChromeTranslateClient::CreateTranslatePrefs( | 1204 ChromeTranslateClient::CreateTranslatePrefs( |
| 1205 GetPrefs(browser_context_))); | 1205 GetPrefs(browser_context_))); |
| 1206 if (prefs->IsEnabled()) { | 1206 // TODO(crbug.com/711217): We should not allow to use the translate when the |
| 1207 std::string locale = | 1207 // feature is disabled by the PolicyList. |
|
lazyboy
2017/05/09 16:35:39
Are you referring to kTranslateEnabled policy?
Giv
| |
| 1208 translate::TranslateManager::GetTargetLanguage(prefs.get()); | 1208 std::string locale = |
| 1209 base::string16 language = | 1209 translate::TranslateManager::GetTargetLanguage(prefs.get()); |
| 1210 l10n_util::GetDisplayNameForLocale(locale, locale, true); | 1210 base::string16 language = |
| 1211 menu_model_.AddItem( | 1211 l10n_util::GetDisplayNameForLocale(locale, locale, true); |
| 1212 IDC_CONTENT_CONTEXT_TRANSLATE, | 1212 menu_model_.AddItem( |
| 1213 l10n_util::GetStringFUTF16(IDS_CONTENT_CONTEXT_TRANSLATE, language)); | 1213 IDC_CONTENT_CONTEXT_TRANSLATE, |
| 1214 AddGoogleIconToLastMenuItem(&menu_model_); | 1214 l10n_util::GetStringFUTF16(IDS_CONTENT_CONTEXT_TRANSLATE, language)); |
| 1215 } | 1215 AddGoogleIconToLastMenuItem(&menu_model_); |
| 1216 } | 1216 } |
| 1217 } | 1217 } |
| 1218 | 1218 |
| 1219 void RenderViewContextMenu::AppendExitFullscreenItem() { | 1219 void RenderViewContextMenu::AppendExitFullscreenItem() { |
| 1220 Browser* browser = GetBrowser(); | 1220 Browser* browser = GetBrowser(); |
| 1221 if (!browser) | 1221 if (!browser) |
| 1222 return; | 1222 return; |
| 1223 | 1223 |
| 1224 // Only show item if in fullscreen mode. | 1224 // Only show item if in fullscreen mode. |
| 1225 if (!browser->exclusive_access_manager() | 1225 if (!browser->exclusive_access_manager() |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2454 void RenderViewContextMenu::PluginActionAt( | 2454 void RenderViewContextMenu::PluginActionAt( |
| 2455 const gfx::Point& location, | 2455 const gfx::Point& location, |
| 2456 const WebPluginAction& action) { | 2456 const WebPluginAction& action) { |
| 2457 source_web_contents_->GetRenderViewHost()-> | 2457 source_web_contents_->GetRenderViewHost()-> |
| 2458 ExecutePluginActionAtLocation(location, action); | 2458 ExecutePluginActionAtLocation(location, action); |
| 2459 } | 2459 } |
| 2460 | 2460 |
| 2461 Browser* RenderViewContextMenu::GetBrowser() const { | 2461 Browser* RenderViewContextMenu::GetBrowser() const { |
| 2462 return chrome::FindBrowserWithWebContents(embedder_web_contents_); | 2462 return chrome::FindBrowserWithWebContents(embedder_web_contents_); |
| 2463 } | 2463 } |
| OLD | NEW |