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 <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1160 if (embedder_web_contents_->GetController().GetVisibleEntry() == NULL) | 1160 if (embedder_web_contents_->GetController().GetVisibleEntry() == NULL) |
| 1161 return false; | 1161 return false; |
| 1162 // Disabled if no browser is associated (e.g. desktop notifications). | 1162 // Disabled if no browser is associated (e.g. desktop notifications). |
| 1163 if (chrome::FindBrowserWithWebContents(embedder_web_contents_) == NULL) | 1163 if (chrome::FindBrowserWithWebContents(embedder_web_contents_) == NULL) |
| 1164 return false; | 1164 return false; |
| 1165 return true; | 1165 return true; |
| 1166 | 1166 |
| 1167 case IDC_CONTENT_CONTEXT_TRANSLATE: { | 1167 case IDC_CONTENT_CONTEXT_TRANSLATE: { |
| 1168 ChromeTranslateClient* chrome_translate_client = | 1168 ChromeTranslateClient* chrome_translate_client = |
| 1169 ChromeTranslateClient::FromWebContents(embedder_web_contents_); | 1169 ChromeTranslateClient::FromWebContents(embedder_web_contents_); |
| 1170 if (!chrome_translate_client) | 1170 // If no |chrome_translate_client| attached with this webcontent or we're |
|
lazyboy
2015/09/29 04:41:58
s/webcontent/WebContents
Deepak
2015/09/29 07:57:23
Done.
| |
| 1171 // viewing in a MimeHandlerViewGuest translate will be disabled. | |
| 1172 if (!chrome_translate_client || | |
| 1173 guest_view::GuestViewBase::IsGuest(source_web_contents_)) { | |
|
lazyboy
2015/09/29 04:41:58
GuestViewBase seems too broad, to narrow it to mim
Deepak
2015/09/29 07:57:23
Done.
| |
| 1171 return false; | 1174 return false; |
| 1175 } | |
| 1172 std::string original_lang = | 1176 std::string original_lang = |
| 1173 chrome_translate_client->GetLanguageState().original_language(); | 1177 chrome_translate_client->GetLanguageState().original_language(); |
| 1174 std::string target_lang = g_browser_process->GetApplicationLocale(); | 1178 std::string target_lang = g_browser_process->GetApplicationLocale(); |
| 1175 target_lang = | 1179 target_lang = |
| 1176 translate::TranslateDownloadManager::GetLanguageCode(target_lang); | 1180 translate::TranslateDownloadManager::GetLanguageCode(target_lang); |
| 1177 // Note that we intentionally enable the menu even if the original and | 1181 // Note that we intentionally enable the menu even if the original and |
| 1178 // target languages are identical. This is to give a way to user to | 1182 // target languages are identical. This is to give a way to user to |
| 1179 // translate a page that might contains text fragments in a different | 1183 // translate a page that might contains text fragments in a different |
| 1180 // language. | 1184 // language. |
| 1181 return ((params_.edit_flags & WebContextMenuData::CanTranslate) != 0) && | 1185 return ((params_.edit_flags & WebContextMenuData::CanTranslate) != 0) && |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1959 source_web_contents_->GetRenderViewHost()-> | 1963 source_web_contents_->GetRenderViewHost()-> |
| 1960 ExecuteMediaPlayerActionAtLocation(location, action); | 1964 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1961 } | 1965 } |
| 1962 | 1966 |
| 1963 void RenderViewContextMenu::PluginActionAt( | 1967 void RenderViewContextMenu::PluginActionAt( |
| 1964 const gfx::Point& location, | 1968 const gfx::Point& location, |
| 1965 const WebPluginAction& action) { | 1969 const WebPluginAction& action) { |
| 1966 source_web_contents_->GetRenderViewHost()-> | 1970 source_web_contents_->GetRenderViewHost()-> |
| 1967 ExecutePluginActionAtLocation(location, action); | 1971 ExecutePluginActionAtLocation(location, action); |
| 1968 } | 1972 } |
| OLD | NEW |