Chromium Code Reviews| Index: chrome/renderer/plugins/chrome_plugin_placeholder.cc |
| diff --git a/chrome/renderer/plugins/chrome_plugin_placeholder.cc b/chrome/renderer/plugins/chrome_plugin_placeholder.cc |
| index c40e8e47dea5cee9aa67f0a231ab56c286af30b8..2097dd10f63fa2ecf0607dbfc0793980b40cbcda 100644 |
| --- a/chrome/renderer/plugins/chrome_plugin_placeholder.cc |
| +++ b/chrome/renderer/plugins/chrome_plugin_placeholder.cc |
| @@ -24,6 +24,7 @@ |
| #include "chrome/renderer/plugins/plugin_preroller.h" |
| #include "chrome/renderer/plugins/plugin_uma.h" |
| #include "components/strings/grit/components_strings.h" |
| +#include "components/url_formatter/elide_url.h" |
| #include "content/public/common/content_switches.h" |
| #include "content/public/common/context_menu_params.h" |
| #include "content/public/renderer/render_frame.h" |
| @@ -32,6 +33,7 @@ |
| #include "third_party/WebKit/public/platform/URLConversion.h" |
| #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| #include "third_party/WebKit/public/platform/WebMouseEvent.h" |
| +#include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| #include "third_party/WebKit/public/web/WebDocument.h" |
| #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| #include "third_party/WebKit/public/web/WebScriptSource.h" |
| @@ -313,6 +315,10 @@ void ChromePluginPlaceholder::OnMenuAction(int request_id, unsigned action) { |
| HidePlugin(); |
| break; |
| } |
| + case chrome::MENU_COMMAND_ENABLE_FLASH: { |
| + ShowPermissionBubbleCallback(); |
| + break; |
| + } |
| default: |
| NOTREACHED(); |
| } |
| @@ -345,7 +351,9 @@ void ChromePluginPlaceholder::ShowContextMenu( |
| params.custom_items.push_back(separator_item); |
| } |
| - if (!GetPluginInfo().path.value().empty()) { |
| + bool flash_hidden = |
| + status_ == ChromeViewHostMsg_GetPluginInfo_Status::kFlashHiddenPreferHtml; |
| + if (!GetPluginInfo().path.value().empty() && !flash_hidden) { |
| content::MenuItem run_item; |
| run_item.action = chrome::MENU_COMMAND_PLUGIN_RUN; |
| // Disable this menu item if the plugin is blocked by policy. |
| @@ -354,6 +362,18 @@ void ChromePluginPlaceholder::ShowContextMenu( |
| params.custom_items.push_back(run_item); |
| } |
| + if (flash_hidden) { |
| + content::MenuItem enable_flash_item; |
| + enable_flash_item.action = chrome::MENU_COMMAND_ENABLE_FLASH; |
| + enable_flash_item.enabled = true; |
| + base::string16 display_origin = url_formatter::FormatUrlForSecurityDisplay( |
|
tommycli
2017/02/24 20:09:02
Same technique as https://cs.chromium.org/chromium
|
| + url::Origin(GetFrame()->top()->getSecurityOrigin()).GetURL(), |
| + url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC); |
|
raymes
2017/02/27 03:51:45
What's the motivation for displaying the origin he
tommycli
2017/02/27 19:15:33
Hey see https://bugs.chromium.org/p/chromium/issue
raymes
2017/02/27 22:55:57
Ahh thanks for explaining.
I actually think it's
|
| + enable_flash_item.label = l10n_util::GetStringFUTF16( |
| + IDS_CONTENT_CONTEXT_ENABLE_FLASH, display_origin); |
| + params.custom_items.push_back(enable_flash_item); |
| + } |
| + |
| content::MenuItem hide_item; |
| hide_item.action = chrome::MENU_COMMAND_PLUGIN_HIDE; |
| bool is_main_frame_plugin_document = |