OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/renderer/context_menu_params_builder.h" | 5 #include "content/renderer/context_menu_params_builder.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/common/ssl_status_serialization.h" | 8 #include "content/common/ssl_status_serialization.h" |
9 #include "content/public/common/context_menu_params.h" | 9 #include "content/public/common/context_menu_params.h" |
10 #include "content/renderer/history_serialization.h" | 10 #include "content/renderer/history_serialization.h" |
11 #include "content/renderer/menu_item_builder.h" | 11 #include "content/renderer/menu_item_builder.h" |
12 #include "third_party/WebKit/public/web/WebElement.h" | 12 #include "third_party/WebKit/public/web/WebElement.h" |
13 #include "third_party/WebKit/public/web/WebNode.h" | 13 #include "third_party/WebKit/public/web/WebNode.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 // static | 17 // static |
18 ContextMenuParams ContextMenuParamsBuilder::Build( | 18 ContextMenuParams ContextMenuParamsBuilder::Build( |
19 const blink::WebContextMenuData& data) { | 19 const blink::WebContextMenuData& data, const PageState& state) { |
20 ContextMenuParams params; | 20 ContextMenuParams params; |
21 params.media_type = data.mediaType; | 21 params.media_type = data.mediaType; |
22 params.x = data.mousePosition.x; | 22 params.x = data.mousePosition.x; |
23 params.y = data.mousePosition.y; | 23 params.y = data.mousePosition.y; |
24 params.link_url = data.linkURL; | 24 params.link_url = data.linkURL; |
25 params.unfiltered_link_url = data.linkURL; | 25 params.unfiltered_link_url = data.linkURL; |
26 params.src_url = data.srcURL; | 26 params.src_url = data.srcURL; |
27 params.has_image_contents = data.hasImageContents; | 27 params.has_image_contents = data.hasImageContents; |
28 params.page_url = data.pageURL; | 28 params.page_url = data.pageURL; |
29 params.keyword_url = data.keywordURL; | 29 params.keyword_url = data.keywordURL; |
(...skipping 12 matching lines...) Expand all Loading... | |
42 params.frame_charset = data.frameEncoding.utf8(); | 42 params.frame_charset = data.frameEncoding.utf8(); |
43 params.referrer_policy = data.referrerPolicy; | 43 params.referrer_policy = data.referrerPolicy; |
44 | 44 |
45 for (size_t i = 0; i < data.dictionarySuggestions.size(); ++i) | 45 for (size_t i = 0; i < data.dictionarySuggestions.size(); ++i) |
46 params.dictionary_suggestions.push_back(data.dictionarySuggestions[i]); | 46 params.dictionary_suggestions.push_back(data.dictionarySuggestions[i]); |
47 | 47 |
48 params.custom_context.is_pepper_menu = false; | 48 params.custom_context.is_pepper_menu = false; |
49 for (size_t i = 0; i < data.customItems.size(); ++i) | 49 for (size_t i = 0; i < data.customItems.size(); ++i) |
50 params.custom_items.push_back(MenuItemBuilder::Build(data.customItems[i])); | 50 params.custom_items.push_back(MenuItemBuilder::Build(data.customItems[i])); |
51 | 51 |
52 if (!data.frameHistoryItem.isNull()) | 52 params.frame_page_state = state; |
Nate Chapin
2014/04/25 21:49:21
I'm not 100% this is safe, since this was serializ
Charlie Reis
2014/04/28 16:29:00
I'm not sure what it's used for, so it's hard to s
Nate Chapin
2014/04/28 17:31:54
Yep, right-click in iframe - > "View Page Source"
| |
53 params.frame_page_state = HistoryItemToPageState(data.frameHistoryItem); | |
54 | 53 |
55 if (!params.link_url.is_empty()) { | 54 if (!params.link_url.is_empty()) { |
56 blink::WebNode selectedNode = data.node; | 55 blink::WebNode selectedNode = data.node; |
57 | 56 |
58 // If there are other embedded tags (like <a ..>Some <b>text</b></a>) | 57 // If there are other embedded tags (like <a ..>Some <b>text</b></a>) |
59 // we need to extract the parent <a/> node. | 58 // we need to extract the parent <a/> node. |
60 while (!selectedNode.isLink() && !selectedNode.parentNode().isNull()) { | 59 while (!selectedNode.isLink() && !selectedNode.parentNode().isNull()) { |
61 selectedNode = selectedNode.parentNode(); | 60 selectedNode = selectedNode.parentNode(); |
62 } | 61 } |
63 | 62 |
(...skipping 13 matching lines...) Expand all Loading... | |
77 ¶ms.security_info.cert_id, ¶ms.security_info.cert_status, | 76 ¶ms.security_info.cert_id, ¶ms.security_info.cert_status, |
78 ¶ms.security_info.security_bits, | 77 ¶ms.security_info.security_bits, |
79 ¶ms.security_info.connection_status, | 78 ¶ms.security_info.connection_status, |
80 ¶ms.security_info.signed_certificate_timestamp_ids); | 79 ¶ms.security_info.signed_certificate_timestamp_ids); |
81 } | 80 } |
82 | 81 |
83 return params; | 82 return params; |
84 } | 83 } |
85 | 84 |
86 } // namespace content | 85 } // namespace content |
OLD | NEW |