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

Side by Side Diff: Source/web/ContextMenuClientImpl.cpp

Issue 23570006: Refactoring: Add convenience method toPluginContainerImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rework with comments Created 7 years, 3 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 | « Source/web/ChromeClientImpl.cpp ('k') | Source/web/WebFrameImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 data.mediaFlags |= WebContextMenuData::MediaHasVideo; 243 data.mediaFlags |= WebContextMenuData::MediaHasVideo;
244 if (mediaElement->controls()) 244 if (mediaElement->controls())
245 data.mediaFlags |= WebContextMenuData::MediaControls; 245 data.mediaFlags |= WebContextMenuData::MediaControls;
246 } else if (r.innerNonSharedNode()->hasTagName(HTMLNames::objectTag) 246 } else if (r.innerNonSharedNode()->hasTagName(HTMLNames::objectTag)
247 || r.innerNonSharedNode()->hasTagName(HTMLNames::embedTag)) { 247 || r.innerNonSharedNode()->hasTagName(HTMLNames::embedTag)) {
248 RenderObject* object = r.innerNonSharedNode()->renderer(); 248 RenderObject* object = r.innerNonSharedNode()->renderer();
249 if (object && object->isWidget()) { 249 if (object && object->isWidget()) {
250 Widget* widget = toRenderWidget(object)->widget(); 250 Widget* widget = toRenderWidget(object)->widget();
251 if (widget && widget->isPluginContainer()) { 251 if (widget && widget->isPluginContainer()) {
252 data.mediaType = WebContextMenuData::MediaTypePlugin; 252 data.mediaType = WebContextMenuData::MediaTypePlugin;
253 WebPluginContainerImpl* plugin = static_cast<WebPluginContainerI mpl*>(widget); 253 WebPluginContainerImpl* plugin = toPluginContainerImpl(widget);
254 WebString text = plugin->plugin()->selectionAsText(); 254 WebString text = plugin->plugin()->selectionAsText();
255 if (!text.isEmpty()) { 255 if (!text.isEmpty()) {
256 data.selectedText = text; 256 data.selectedText = text;
257 data.editFlags |= WebContextMenuData::CanCopy; 257 data.editFlags |= WebContextMenuData::CanCopy;
258 } 258 }
259 data.editFlags &= ~WebContextMenuData::CanTranslate; 259 data.editFlags &= ~WebContextMenuData::CanTranslate;
260 data.linkURL = plugin->plugin()->linkAtPosition(data.mousePositi on); 260 data.linkURL = plugin->plugin()->linkAtPosition(data.mousePositi on);
261 if (plugin->plugin()->supportsPaginatedPrint()) 261 if (plugin->plugin()->supportsPaginatedPrint())
262 data.mediaFlags |= WebContextMenuData::MediaCanPrint; 262 data.mediaFlags |= WebContextMenuData::MediaCanPrint;
263 263
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 outputItems[i] = subItems[i]; 412 outputItems[i] = subItems[i];
413 subMenuItems.swap(outputItems); 413 subMenuItems.swap(outputItems);
414 } 414 }
415 415
416 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu* defaultMenu, WebContextMenuData* data) 416 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu* defaultMenu, WebContextMenuData* data)
417 { 417 {
418 populateSubMenuItems(defaultMenu->items(), data->customItems); 418 populateSubMenuItems(defaultMenu->items(), data->customItems);
419 } 419 }
420 420
421 } // namespace WebKit 421 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/web/ChromeClientImpl.cpp ('k') | Source/web/WebFrameImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698