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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 #include "public/web/WebPlugin.h" | 73 #include "public/web/WebPlugin.h" |
74 #include "public/web/WebSearchableFormData.h" | 74 #include "public/web/WebSearchableFormData.h" |
75 #include "public/web/WebSpellCheckClient.h" | 75 #include "public/web/WebSpellCheckClient.h" |
76 #include "public/web/WebViewClient.h" | 76 #include "public/web/WebViewClient.h" |
77 #include "web/WebDataSourceImpl.h" | 77 #include "web/WebDataSourceImpl.h" |
78 #include "web/WebLocalFrameImpl.h" | 78 #include "web/WebLocalFrameImpl.h" |
79 #include "web/WebPluginContainerImpl.h" | 79 #include "web/WebPluginContainerImpl.h" |
80 #include "web/WebViewImpl.h" | 80 #include "web/WebViewImpl.h" |
81 #include "wtf/text/WTFString.h" | 81 #include "wtf/text/WTFString.h" |
82 | 82 |
83 using namespace WebCore; | 83 using namespace blink; |
84 | 84 |
85 namespace blink { | 85 namespace blink { |
86 | 86 |
87 // Figure out the URL of a page or subframe. Returns |page_type| as the type, | 87 // Figure out the URL of a page or subframe. Returns |page_type| as the type, |
88 // which indicates page or subframe, or ContextNodeType::NONE if the URL could n
ot | 88 // which indicates page or subframe, or ContextNodeType::NONE if the URL could n
ot |
89 // be determined for some reason. | 89 // be determined for some reason. |
90 static WebURL urlFromFrame(LocalFrame* frame) | 90 static WebURL urlFromFrame(LocalFrame* frame) |
91 { | 91 { |
92 if (frame) { | 92 if (frame) { |
93 DocumentLoader* dl = frame->loader().documentLoader(); | 93 DocumentLoader* dl = frame->loader().documentLoader(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 RefPtrWillBeRawPtr<Range> markerRange = selectionRange->cloneRange(); | 172 RefPtrWillBeRawPtr<Range> markerRange = selectionRange->cloneRange(); |
173 markerRange->setStart(markerRange->startContainer(), markers[0]->startOffset
()); | 173 markerRange->setStart(markerRange->startContainer(), markers[0]->startOffset
()); |
174 markerRange->setEnd(markerRange->endContainer(), markers[0]->endOffset()); | 174 markerRange->setEnd(markerRange->endContainer(), markers[0]->endOffset()); |
175 | 175 |
176 if (markerRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation) != selec
tionRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation)) | 176 if (markerRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation) != selec
tionRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation)) |
177 return String(); | 177 return String(); |
178 | 178 |
179 return markerRange->text(); | 179 return markerRange->text(); |
180 } | 180 } |
181 | 181 |
182 void ContextMenuClientImpl::showContextMenu(const WebCore::ContextMenu* defaultM
enu) | 182 void ContextMenuClientImpl::showContextMenu(const blink::ContextMenu* defaultMen
u) |
183 { | 183 { |
184 // Displaying the context menu in this function is a big hack as we don't | 184 // Displaying the context menu in this function is a big hack as we don't |
185 // have context, i.e. whether this is being invoked via a script or in | 185 // have context, i.e. whether this is being invoked via a script or in |
186 // response to user input (Mouse event WM_RBUTTONDOWN, | 186 // response to user input (Mouse event WM_RBUTTONDOWN, |
187 // Keyboard events KeyVK_APPS, Shift+F10). Check if this is being invoked | 187 // Keyboard events KeyVK_APPS, Shift+F10). Check if this is being invoked |
188 // in response to the above input events before popping up the context menu. | 188 // in response to the above input events before popping up the context menu. |
189 if (!m_webView->contextMenuAllowed()) | 189 if (!m_webView->contextMenuAllowed()) |
190 return; | 190 return; |
191 | 191 |
192 HitTestResult r = m_webView->page()->contextMenuController().hitTestResult()
; | 192 HitTestResult r = m_webView->page()->contextMenuController().hitTestResult()
; |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 } | 431 } |
432 subItems.append(outputItem); | 432 subItems.append(outputItem); |
433 } | 433 } |
434 | 434 |
435 WebVector<WebMenuItemInfo> outputItems(subItems.size()); | 435 WebVector<WebMenuItemInfo> outputItems(subItems.size()); |
436 for (size_t i = 0; i < subItems.size(); ++i) | 436 for (size_t i = 0; i < subItems.size(); ++i) |
437 outputItems[i] = subItems[i]; | 437 outputItems[i] = subItems[i]; |
438 subMenuItems.swap(outputItems); | 438 subMenuItems.swap(outputItems); |
439 } | 439 } |
440 | 440 |
441 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) | 441 void ContextMenuClientImpl::populateCustomMenuItems(const blink::ContextMenu* de
faultMenu, WebContextMenuData* data) |
442 { | 442 { |
443 populateSubMenuItems(defaultMenu->items(), data->customItems); | 443 populateSubMenuItems(defaultMenu->items(), data->customItems); |
444 } | 444 } |
445 | 445 |
446 } // namespace blink | 446 } // namespace blink |
OLD | NEW |