| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "content/public/common/context_menu_params.h" | 9 #include "content/public/common/context_menu_params.h" |
| 10 #include "content/public/renderer/content_renderer_client.h" | 10 #include "content/public/renderer/content_renderer_client.h" |
| 11 #include "content/renderer/history_serialization.h" | 11 #include "content/renderer/history_serialization.h" |
| 12 #include "content/renderer/menu_item_builder.h" | 12 #include "content/renderer/menu_item_builder.h" |
| 13 #include "ui/base/ui_base_types.h" |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 16 // static | 17 // static |
| 17 ContextMenuParams ContextMenuParamsBuilder::Build( | 18 ContextMenuParams ContextMenuParamsBuilder::Build( |
| 18 const blink::WebContextMenuData& data) { | 19 const blink::WebContextMenuData& data) { |
| 19 ContextMenuParams params; | 20 ContextMenuParams params; |
| 20 params.media_type = data.media_type; | 21 params.media_type = data.media_type; |
| 21 params.x = data.mouse_position.x; | 22 params.x = data.mouse_position.x; |
| 22 params.y = data.mouse_position.y; | 23 params.y = data.mouse_position.y; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 for (size_t i = 0; i < data.custom_items.size(); ++i) | 56 for (size_t i = 0; i < data.custom_items.size(); ++i) |
| 56 params.custom_items.push_back(MenuItemBuilder::Build(data.custom_items[i])); | 57 params.custom_items.push_back(MenuItemBuilder::Build(data.custom_items[i])); |
| 57 | 58 |
| 58 if (!data.frame_history_item.IsNull()) { | 59 if (!data.frame_history_item.IsNull()) { |
| 59 params.frame_page_state = | 60 params.frame_page_state = |
| 60 SingleHistoryItemToPageState(data.frame_history_item); | 61 SingleHistoryItemToPageState(data.frame_history_item); |
| 61 } | 62 } |
| 62 | 63 |
| 63 params.link_text = data.link_text.Utf16(); | 64 params.link_text = data.link_text.Utf16(); |
| 64 | 65 |
| 66 if (data.from_select_all) |
| 67 params.source_type = ui::MENU_SOURCE_SELECT_ALL; |
| 65 return params; | 68 return params; |
| 66 } | 69 } |
| 67 | 70 |
| 68 } // namespace content | 71 } // namespace content |
| OLD | NEW |