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/public/renderer/history_item_serialization.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" |
12 #include "webkit/glue/glue_serialize.h" | |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 // static | 16 // static |
17 ContextMenuParams ContextMenuParamsBuilder::Build( | 17 ContextMenuParams ContextMenuParamsBuilder::Build( |
18 const WebKit::WebContextMenuData& data) { | 18 const WebKit::WebContextMenuData& data) { |
19 ContextMenuParams params; | 19 ContextMenuParams params; |
20 params.media_type = data.mediaType; | 20 params.media_type = data.mediaType; |
21 params.x = data.mousePosition.x; | 21 params.x = data.mousePosition.x; |
22 params.y = data.mousePosition.y; | 22 params.y = data.mousePosition.y; |
(...skipping 20 matching lines...) Expand all Loading... |
43 params.frame_charset = data.frameEncoding.utf8(); | 43 params.frame_charset = data.frameEncoding.utf8(); |
44 params.referrer_policy = data.referrerPolicy; | 44 params.referrer_policy = data.referrerPolicy; |
45 | 45 |
46 for (size_t i = 0; i < data.dictionarySuggestions.size(); ++i) | 46 for (size_t i = 0; i < data.dictionarySuggestions.size(); ++i) |
47 params.dictionary_suggestions.push_back(data.dictionarySuggestions[i]); | 47 params.dictionary_suggestions.push_back(data.dictionarySuggestions[i]); |
48 | 48 |
49 params.custom_context.is_pepper_menu = false; | 49 params.custom_context.is_pepper_menu = false; |
50 for (size_t i = 0; i < data.customItems.size(); ++i) | 50 for (size_t i = 0; i < data.customItems.size(); ++i) |
51 params.custom_items.push_back(WebMenuItem(data.customItems[i])); | 51 params.custom_items.push_back(WebMenuItem(data.customItems[i])); |
52 | 52 |
53 if (!data.frameHistoryItem.isNull()) { | 53 if (!data.frameHistoryItem.isNull()) |
54 params.frame_content_state = | 54 params.frame_page_state = HistoryItemToPageState(data.frameHistoryItem); |
55 webkit_glue::HistoryItemToString(data.frameHistoryItem); | |
56 } | |
57 | 55 |
58 if (!params.link_url.is_empty()) { | 56 if (!params.link_url.is_empty()) { |
59 WebKit::WebNode selectedNode = data.node; | 57 WebKit::WebNode selectedNode = data.node; |
60 | 58 |
61 // If there are other embedded tags (like <a ..>Some <b>text</b></a>) | 59 // If there are other embedded tags (like <a ..>Some <b>text</b></a>) |
62 // we need to extract the parent <a/> node. | 60 // we need to extract the parent <a/> node. |
63 while (!selectedNode.isLink() && !selectedNode.parentNode().isNull()) { | 61 while (!selectedNode.isLink() && !selectedNode.parentNode().isNull()) { |
64 selectedNode = selectedNode.parentNode(); | 62 selectedNode = selectedNode.parentNode(); |
65 } | 63 } |
66 | 64 |
(...skipping 13 matching lines...) Expand all Loading... |
80 ¶ms.security_info.cert_id, | 78 ¶ms.security_info.cert_id, |
81 ¶ms.security_info.cert_status, | 79 ¶ms.security_info.cert_status, |
82 ¶ms.security_info.security_bits, | 80 ¶ms.security_info.security_bits, |
83 ¶ms.security_info.connection_status); | 81 ¶ms.security_info.connection_status); |
84 } | 82 } |
85 | 83 |
86 return params; | 84 return params; |
87 } | 85 } |
88 | 86 |
89 } // namespace content | 87 } // namespace content |
OLD | NEW |