1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/public/common/context_menu_params.h"
7 #include "content/common/ssl_status_serialization.h"
8 #include "webkit/glue/glue_serialize.h"
12 const int32
CustomContextMenuContext::kCurrentRenderWidget
= kint32max
;
14 CustomContextMenuContext::CustomContextMenuContext()
15 : is_pepper_menu(false),
17 render_widget_id(kCurrentRenderWidget
) {
20 ContextMenuParams::ContextMenuParams()
21 : media_type(WebKit::WebContextMenuData::MediaTypeNone
),
24 is_image_blocked(false),
27 speech_input_enabled(false),
28 spellcheck_enabled(false),
31 referrer_policy(WebKit::WebReferrerPolicyDefault
) {
34 ContextMenuParams::~ContextMenuParams() {
37 ContextMenuParams::ContextMenuParams(const WebKit::WebContextMenuData
& data
)
38 : media_type(data
.mediaType
),
39 x(data
.mousePosition
.x
),
40 y(data
.mousePosition
.y
),
41 link_url(data
.linkURL
),
42 unfiltered_link_url(data
.linkURL
),
44 is_image_blocked(data
.isImageBlocked
),
45 page_url(data
.pageURL
),
46 keyword_url(data
.keywordURL
),
47 frame_url(data
.frameURL
),
49 media_flags(data
.mediaFlags
),
50 selection_text(data
.selectedText
),
51 misspelled_word(data
.misspelledWord
),
52 speech_input_enabled(data
.isSpeechInputEnabled
),
53 spellcheck_enabled(data
.isSpellCheckingEnabled
),
54 is_editable(data
.isEditable
),
55 #if defined(OS_MACOSX)
56 writing_direction_default(data
.writingDirectionDefault
),
57 writing_direction_left_to_right(data
.writingDirectionLeftToRight
),
58 writing_direction_right_to_left(data
.writingDirectionRightToLeft
),
60 edit_flags(data
.editFlags
),
61 frame_charset(data
.frameEncoding
.utf8()),
62 referrer_policy(data
.referrerPolicy
) {
63 for (size_t i
= 0; i
< data
.dictionarySuggestions
.size(); ++i
)
64 dictionary_suggestions
.push_back(data
.dictionarySuggestions
[i
]);
66 custom_context
.is_pepper_menu
= false;
67 for (size_t i
= 0; i
< data
.customItems
.size(); ++i
)
68 custom_items
.push_back(WebMenuItem(data
.customItems
[i
]));
70 if (!data
.frameHistoryItem
.isNull()) {
72 webkit_glue::HistoryItemToString(data
.frameHistoryItem
);
75 // Deserialize the SSL info.
76 if (!data
.securityInfo
.isEmpty()) {
77 DeserializeSecurityInfo(data
.securityInfo
,
78 &security_info
.cert_id
,
79 &security_info
.cert_status
,
80 &security_info
.security_bits
,
81 &security_info
.connection_status
);
85 } // namespace content