OLD | NEW |
1 // Copyright (c) 2011 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/public/common/context_menu_params.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 "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" |
9 #include "webkit/glue/glue_serialize.h" | 11 #include "webkit/glue/glue_serialize.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" | |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 const int32 CustomContextMenuContext::kCurrentRenderWidget = kint32max; | 15 ContextMenuParamsBuilder::ContextMenuParamsBuilder( |
| 16 const WebKit::WebContextMenuData& data) { |
| 17 media_type = data.mediaType; |
| 18 x = data.mousePosition.x; |
| 19 y = data.mousePosition.y; |
| 20 link_url = data.linkURL; |
| 21 unfiltered_link_url = data.linkURL; |
| 22 src_url = data.srcURL; |
| 23 is_image_blocked = data.isImageBlocked; |
| 24 page_url = data.pageURL; |
| 25 keyword_url = data.keywordURL; |
| 26 frame_url = data.frameURL; |
| 27 media_flags = data.mediaFlags; |
| 28 selection_text = data.selectedText; |
| 29 misspelled_word = data.misspelledWord; |
| 30 speech_input_enabled = data.isSpeechInputEnabled; |
| 31 spellcheck_enabled = data.isSpellCheckingEnabled; |
| 32 is_editable = data.isEditable; |
| 33 #if defined(OS_MACOSX) |
| 34 writing_direction_default = data.writingDirectionDefault; |
| 35 writing_direction_left_to_right = data.writingDirectionLeftToRight; |
| 36 writing_direction_right_to_left = data.writingDirectionRightToLeft; |
| 37 #endif // OS_MACOSX |
| 38 edit_flags = data.editFlags; |
| 39 frame_charset = data.frameEncoding.utf8(); |
| 40 referrer_policy = data.referrerPolicy; |
16 | 41 |
17 CustomContextMenuContext::CustomContextMenuContext() | |
18 : is_pepper_menu(false), | |
19 request_id(0), | |
20 render_widget_id(kCurrentRenderWidget) { | |
21 } | |
22 | |
23 ContextMenuParams::ContextMenuParams() | |
24 : media_type(WebKit::WebContextMenuData::MediaTypeNone), | |
25 x(0), | |
26 y(0), | |
27 is_image_blocked(false), | |
28 frame_id(0), | |
29 media_flags(0), | |
30 speech_input_enabled(false), | |
31 spellcheck_enabled(false), | |
32 is_editable(false), | |
33 edit_flags(0), | |
34 referrer_policy(WebKit::WebReferrerPolicyDefault) { | |
35 } | |
36 | |
37 ContextMenuParams::~ContextMenuParams() { | |
38 } | |
39 | |
40 ContextMenuParams::ContextMenuParams(const WebKit::WebContextMenuData& data) | |
41 : media_type(data.mediaType), | |
42 x(data.mousePosition.x), | |
43 y(data.mousePosition.y), | |
44 link_url(data.linkURL), | |
45 unfiltered_link_url(data.linkURL), | |
46 src_url(data.srcURL), | |
47 is_image_blocked(data.isImageBlocked), | |
48 page_url(data.pageURL), | |
49 keyword_url(data.keywordURL), | |
50 frame_url(data.frameURL), | |
51 frame_id(0), | |
52 media_flags(data.mediaFlags), | |
53 selection_text(data.selectedText), | |
54 misspelled_word(data.misspelledWord), | |
55 speech_input_enabled(data.isSpeechInputEnabled), | |
56 spellcheck_enabled(data.isSpellCheckingEnabled), | |
57 is_editable(data.isEditable), | |
58 #if defined(OS_MACOSX) | |
59 writing_direction_default(data.writingDirectionDefault), | |
60 writing_direction_left_to_right(data.writingDirectionLeftToRight), | |
61 writing_direction_right_to_left(data.writingDirectionRightToLeft), | |
62 #endif // OS_MACOSX | |
63 edit_flags(data.editFlags), | |
64 frame_charset(data.frameEncoding.utf8()), | |
65 referrer_policy(data.referrerPolicy) { | |
66 for (size_t i = 0; i < data.dictionarySuggestions.size(); ++i) | 42 for (size_t i = 0; i < data.dictionarySuggestions.size(); ++i) |
67 dictionary_suggestions.push_back(data.dictionarySuggestions[i]); | 43 dictionary_suggestions.push_back(data.dictionarySuggestions[i]); |
68 | 44 |
69 custom_context.is_pepper_menu = false; | 45 custom_context.is_pepper_menu = false; |
70 for (size_t i = 0; i < data.customItems.size(); ++i) | 46 for (size_t i = 0; i < data.customItems.size(); ++i) |
71 custom_items.push_back(WebMenuItem(data.customItems[i])); | 47 custom_items.push_back(WebMenuItem(data.customItems[i])); |
72 | 48 |
73 if (!data.frameHistoryItem.isNull()) { | 49 if (!data.frameHistoryItem.isNull()) { |
74 frame_content_state = | 50 frame_content_state = |
75 webkit_glue::HistoryItemToString(data.frameHistoryItem); | 51 webkit_glue::HistoryItemToString(data.frameHistoryItem); |
(...skipping 22 matching lines...) Expand all Loading... |
98 if (!data.securityInfo.isEmpty()) { | 74 if (!data.securityInfo.isEmpty()) { |
99 DeserializeSecurityInfo(data.securityInfo, | 75 DeserializeSecurityInfo(data.securityInfo, |
100 &security_info.cert_id, | 76 &security_info.cert_id, |
101 &security_info.cert_status, | 77 &security_info.cert_status, |
102 &security_info.security_bits, | 78 &security_info.security_bits, |
103 &security_info.connection_status); | 79 &security_info.connection_status); |
104 } | 80 } |
105 } | 81 } |
106 | 82 |
107 } // namespace content | 83 } // namespace content |
OLD | NEW |