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. 4 5 #include "webkit/glue/context_menu.h" 6 #include "webkit/glue/glue_serialize.h" 7 8 namespace webkit_glue { 9 10 const int32 CustomContextMenuContext::kCurrentRenderWidget = kint32max; 11 12 CustomContextMenuContext::CustomContextMenuContext() 13 : is_pepper_menu(false), 14 request_id(0), 15 render_widget_id(kCurrentRenderWidget) { 16 } 17 18 } // namespace webkit_glue 19 20 ContextMenuParams::ContextMenuParams() { 21 } 22 23 ContextMenuParams::ContextMenuParams(const WebKit::WebContextMenuData& data) 24 : media_type(data.mediaType), 25 x(data.mousePosition.x), 26 y(data.mousePosition.y), 27 link_url(data.linkURL), 28 unfiltered_link_url(data.linkURL), 29 src_url(data.srcURL), 30 is_image_blocked(data.isImageBlocked), 31 page_url(data.pageURL), 32 frame_url(data.frameURL), 33 media_flags(data.mediaFlags), 34 selection_text(data.selectedText), 35 misspelled_word(data.misspelledWord), 36 spellcheck_enabled(data.isSpellCheckingEnabled), 37 is_editable(data.isEditable), 38 #if defined(OS_MACOSX) 39 writing_direction_default(data.writingDirectionDefault), 40 writing_direction_left_to_right(data.writingDirectionLeftToRight), 41 writing_direction_right_to_left(data.writingDirectionRightToLeft), 42 #endif // OS_MACOSX 43 edit_flags(data.editFlags), 44 security_info(data.securityInfo), 45 frame_charset(data.frameEncoding.utf8()) { 46 for (size_t i = 0; i < data.dictionarySuggestions.size(); ++i) 47 dictionary_suggestions.push_back(data.dictionarySuggestions[i]); 48 49 custom_context.is_pepper_menu = false; 50 for (size_t i = 0; i < data.customItems.size(); ++i) 51 custom_items.push_back(WebMenuItem(data.customItems[i])); 52 53 if (!data.frameHistoryItem.isNull()) { 54 frame_content_state = 55 webkit_glue::HistoryItemToString(data.frameHistoryItem); 56 } 57 } 58 59 ContextMenuParams::~ContextMenuParams() { 60 } 61