OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 #include "bindings/core/v8/ExceptionState.h" | 33 #include "bindings/core/v8/ExceptionState.h" |
34 #include "core/CSSPropertyNames.h" | 34 #include "core/CSSPropertyNames.h" |
35 #include "core/HTMLNames.h" | 35 #include "core/HTMLNames.h" |
36 #include "core/InputTypeNames.h" | 36 #include "core/InputTypeNames.h" |
37 #include "core/css/CSSStyleDeclaration.h" | 37 #include "core/css/CSSStyleDeclaration.h" |
38 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
39 #include "core/editing/Editor.h" | 39 #include "core/editing/Editor.h" |
40 #include "core/editing/markers/DocumentMarkerController.h" | 40 #include "core/editing/markers/DocumentMarkerController.h" |
41 #include "core/editing/spellcheck/SpellChecker.h" | 41 #include "core/editing/spellcheck/SpellChecker.h" |
42 #include "core/exported/WebDataSourceImpl.h" | 42 #include "core/exported/WebDataSourceImpl.h" |
43 #include "core/exported/WebPluginContainerBase.h" | |
44 #include "core/exported/WebViewBase.h" | 43 #include "core/exported/WebViewBase.h" |
45 #include "core/frame/FrameView.h" | 44 #include "core/frame/FrameView.h" |
46 #include "core/frame/Settings.h" | 45 #include "core/frame/Settings.h" |
47 #include "core/frame/VisualViewport.h" | 46 #include "core/frame/VisualViewport.h" |
48 #include "core/frame/WebLocalFrameBase.h" | 47 #include "core/frame/WebLocalFrameBase.h" |
49 #include "core/html/HTMLAnchorElement.h" | 48 #include "core/html/HTMLAnchorElement.h" |
50 #include "core/html/HTMLFormElement.h" | 49 #include "core/html/HTMLFormElement.h" |
51 #include "core/html/HTMLImageElement.h" | 50 #include "core/html/HTMLImageElement.h" |
52 #include "core/html/HTMLInputElement.h" | 51 #include "core/html/HTMLInputElement.h" |
53 #include "core/html/HTMLMediaElement.h" | 52 #include "core/html/HTMLMediaElement.h" |
(...skipping 18 matching lines...) Expand all Loading... |
72 #include "public/platform/WebVector.h" | 71 #include "public/platform/WebVector.h" |
73 #include "public/web/WebContextMenuData.h" | 72 #include "public/web/WebContextMenuData.h" |
74 #include "public/web/WebFormElement.h" | 73 #include "public/web/WebFormElement.h" |
75 #include "public/web/WebFrameClient.h" | 74 #include "public/web/WebFrameClient.h" |
76 #include "public/web/WebMenuItemInfo.h" | 75 #include "public/web/WebMenuItemInfo.h" |
77 #include "public/web/WebPlugin.h" | 76 #include "public/web/WebPlugin.h" |
78 #include "public/web/WebSearchableFormData.h" | 77 #include "public/web/WebSearchableFormData.h" |
79 #include "public/web/WebTextCheckClient.h" | 78 #include "public/web/WebTextCheckClient.h" |
80 #include "public/web/WebViewClient.h" | 79 #include "public/web/WebViewClient.h" |
81 #include "web/ContextMenuAllowedScope.h" | 80 #include "web/ContextMenuAllowedScope.h" |
| 81 #include "web/WebPluginContainerImpl.h" |
82 | 82 |
83 namespace blink { | 83 namespace blink { |
84 | 84 |
85 // Figure out the URL of a page or subframe. Returns |page_type| as the type, | 85 // Figure out the URL of a page or subframe. Returns |page_type| as the type, |
86 // which indicates page or subframe, or ContextNodeType::kNone if the URL could | 86 // which indicates page or subframe, or ContextNodeType::kNone if the URL could |
87 // not be determined for some reason. | 87 // not be determined for some reason. |
88 static WebURL UrlFromFrame(LocalFrame* frame) { | 88 static WebURL UrlFromFrame(LocalFrame* frame) { |
89 if (frame) { | 89 if (frame) { |
90 DocumentLoader* dl = frame->Loader().GetDocumentLoader(); | 90 DocumentLoader* dl = frame->Loader().GetDocumentLoader(); |
91 if (dl) { | 91 if (dl) { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 data.media_flags |= WebContextMenuData::kMediaCanToggleControls; | 289 data.media_flags |= WebContextMenuData::kMediaCanToggleControls; |
290 if (media_element->ShouldShowControls()) | 290 if (media_element->ShouldShowControls()) |
291 data.media_flags |= WebContextMenuData::kMediaControls; | 291 data.media_flags |= WebContextMenuData::kMediaControls; |
292 } else if (isHTMLObjectElement(*r.InnerNode()) || | 292 } else if (isHTMLObjectElement(*r.InnerNode()) || |
293 isHTMLEmbedElement(*r.InnerNode())) { | 293 isHTMLEmbedElement(*r.InnerNode())) { |
294 LayoutObject* object = r.InnerNode()->GetLayoutObject(); | 294 LayoutObject* object = r.InnerNode()->GetLayoutObject(); |
295 if (object && object->IsLayoutPart()) { | 295 if (object && object->IsLayoutPart()) { |
296 PluginView* plugin_view = ToLayoutPart(object)->Plugin(); | 296 PluginView* plugin_view = ToLayoutPart(object)->Plugin(); |
297 if (plugin_view && plugin_view->IsPluginContainer()) { | 297 if (plugin_view && plugin_view->IsPluginContainer()) { |
298 data.media_type = WebContextMenuData::kMediaTypePlugin; | 298 data.media_type = WebContextMenuData::kMediaTypePlugin; |
299 WebPluginContainerBase* plugin = ToWebPluginContainerBase(plugin_view); | 299 WebPluginContainerImpl* plugin = ToWebPluginContainerImpl(plugin_view); |
300 WebString text = plugin->Plugin()->SelectionAsText(); | 300 WebString text = plugin->Plugin()->SelectionAsText(); |
301 if (!text.IsEmpty()) { | 301 if (!text.IsEmpty()) { |
302 data.selected_text = text; | 302 data.selected_text = text; |
303 data.edit_flags |= WebContextMenuData::kCanCopy; | 303 data.edit_flags |= WebContextMenuData::kCanCopy; |
304 } | 304 } |
305 data.edit_flags &= ~WebContextMenuData::kCanTranslate; | 305 data.edit_flags &= ~WebContextMenuData::kCanTranslate; |
306 data.link_url = plugin->Plugin()->LinkAtPosition(data.mouse_position); | 306 data.link_url = plugin->Plugin()->LinkAtPosition(data.mouse_position); |
307 if (plugin->Plugin()->SupportsPaginatedPrint()) | 307 if (plugin->Plugin()->SupportsPaginatedPrint()) |
308 data.media_flags |= WebContextMenuData::kMediaCanPrint; | 308 data.media_flags |= WebContextMenuData::kMediaCanPrint; |
309 | 309 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 sub_menu_items.Swap(output_items); | 504 sub_menu_items.Swap(output_items); |
505 } | 505 } |
506 | 506 |
507 void ContextMenuClientImpl::PopulateCustomMenuItems( | 507 void ContextMenuClientImpl::PopulateCustomMenuItems( |
508 const ContextMenu* default_menu, | 508 const ContextMenu* default_menu, |
509 WebContextMenuData* data) { | 509 WebContextMenuData* data) { |
510 PopulateSubMenuItems(default_menu->Items(), data->custom_items); | 510 PopulateSubMenuItems(default_menu->Items(), data->custom_items); |
511 } | 511 } |
512 | 512 |
513 } // namespace blink | 513 } // namespace blink |
OLD | NEW |