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

Side by Side Diff: chrome/renderer/plugins/chrome_plugin_placeholder.cc

Issue 2716053002: [HBD] Add an Enable Flash context menu item for HBD placeholders. (Closed)
Patch Set: add comment Created 3 years, 9 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
« no previous file with comments | « chrome/renderer/custom_menu_commands.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer/plugins/chrome_plugin_placeholder.h" 5 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 MarkPluginEssential( 306 MarkPluginEssential(
307 content::PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_CLICK); 307 content::PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_CLICK);
308 LoadPlugin(); 308 LoadPlugin();
309 break; 309 break;
310 } 310 }
311 case chrome::MENU_COMMAND_PLUGIN_HIDE: { 311 case chrome::MENU_COMMAND_PLUGIN_HIDE: {
312 RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Hide_Menu")); 312 RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Hide_Menu"));
313 HidePlugin(); 313 HidePlugin();
314 break; 314 break;
315 } 315 }
316 case chrome::MENU_COMMAND_ENABLE_FLASH: {
317 ShowPermissionBubbleCallback();
318 break;
319 }
316 default: 320 default:
317 NOTREACHED(); 321 NOTREACHED();
318 } 322 }
319 } 323 }
320 324
321 void ChromePluginPlaceholder::OnMenuClosed(int request_id) { 325 void ChromePluginPlaceholder::OnMenuClosed(int request_id) {
322 DCHECK_EQ(context_menu_request_id_, request_id); 326 DCHECK_EQ(context_menu_request_id_, request_id);
323 context_menu_request_id_ = 0; 327 context_menu_request_id_ = 0;
324 } 328 }
325 329
(...skipping 12 matching lines...) Expand all
338 if (!title_.empty()) { 342 if (!title_.empty()) {
339 content::MenuItem name_item; 343 content::MenuItem name_item;
340 name_item.label = title_; 344 name_item.label = title_;
341 params.custom_items.push_back(name_item); 345 params.custom_items.push_back(name_item);
342 346
343 content::MenuItem separator_item; 347 content::MenuItem separator_item;
344 separator_item.type = content::MenuItem::SEPARATOR; 348 separator_item.type = content::MenuItem::SEPARATOR;
345 params.custom_items.push_back(separator_item); 349 params.custom_items.push_back(separator_item);
346 } 350 }
347 351
348 if (!GetPluginInfo().path.value().empty()) { 352 bool flash_hidden =
353 status_ == ChromeViewHostMsg_GetPluginInfo_Status::kFlashHiddenPreferHtml;
354 if (!GetPluginInfo().path.value().empty() && !flash_hidden) {
349 content::MenuItem run_item; 355 content::MenuItem run_item;
350 run_item.action = chrome::MENU_COMMAND_PLUGIN_RUN; 356 run_item.action = chrome::MENU_COMMAND_PLUGIN_RUN;
351 // Disable this menu item if the plugin is blocked by policy. 357 // Disable this menu item if the plugin is blocked by policy.
352 run_item.enabled = LoadingAllowed(); 358 run_item.enabled = LoadingAllowed();
353 run_item.label = l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLUGIN_RUN); 359 run_item.label = l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLUGIN_RUN);
354 params.custom_items.push_back(run_item); 360 params.custom_items.push_back(run_item);
355 } 361 }
356 362
363 if (flash_hidden) {
364 content::MenuItem enable_flash_item;
365 enable_flash_item.action = chrome::MENU_COMMAND_ENABLE_FLASH;
366 enable_flash_item.enabled = true;
367 enable_flash_item.label =
368 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_ENABLE_FLASH);
369 params.custom_items.push_back(enable_flash_item);
370 }
371
357 content::MenuItem hide_item; 372 content::MenuItem hide_item;
358 hide_item.action = chrome::MENU_COMMAND_PLUGIN_HIDE; 373 hide_item.action = chrome::MENU_COMMAND_PLUGIN_HIDE;
359 bool is_main_frame_plugin_document = 374 bool is_main_frame_plugin_document =
360 GetFrame()->view()->mainFrame()->isWebLocalFrame() && 375 GetFrame()->view()->mainFrame()->isWebLocalFrame() &&
361 GetFrame()->view()->mainFrame()->document().isPluginDocument(); 376 GetFrame()->view()->mainFrame()->document().isPluginDocument();
362 hide_item.enabled = !is_main_frame_plugin_document; 377 hide_item.enabled = !is_main_frame_plugin_document;
363 hide_item.label = l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLUGIN_HIDE); 378 hide_item.label = l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLUGIN_HIDE);
364 params.custom_items.push_back(hide_item); 379 params.custom_items.push_back(hide_item);
365 380
366 params.x = event.windowX; 381 params.x = event.windowX;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 428
414 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 429 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
415 switches::kEnablePluginPlaceholderTesting)) { 430 switches::kEnablePluginPlaceholderTesting)) {
416 builder.SetMethod<void (ChromePluginPlaceholder::*)()>( 431 builder.SetMethod<void (ChromePluginPlaceholder::*)()>(
417 "didFinishIconRepositionForTesting", 432 "didFinishIconRepositionForTesting",
418 &ChromePluginPlaceholder::DidFinishIconRepositionForTestingCallback); 433 &ChromePluginPlaceholder::DidFinishIconRepositionForTestingCallback);
419 } 434 }
420 435
421 return builder; 436 return builder;
422 } 437 }
OLDNEW
« no previous file with comments | « chrome/renderer/custom_menu_commands.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698