Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 18281002: Move WebDropData to content::DropData and split off conversion function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac build error. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/renderer/webclipboard_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "content/common/pepper_messages.h" 45 #include "content/common/pepper_messages.h"
46 #include "content/common/pepper_plugin_registry.h" 46 #include "content/common/pepper_plugin_registry.h"
47 #include "content/common/socket_stream_handle_data.h" 47 #include "content/common/socket_stream_handle_data.h"
48 #include "content/common/ssl_status_serialization.h" 48 #include "content/common/ssl_status_serialization.h"
49 #include "content/common/view_messages.h" 49 #include "content/common/view_messages.h"
50 #include "content/public/common/bindings_policy.h" 50 #include "content/public/common/bindings_policy.h"
51 #include "content/public/common/content_client.h" 51 #include "content/public/common/content_client.h"
52 #include "content/public/common/content_constants.h" 52 #include "content/public/common/content_constants.h"
53 #include "content/public/common/content_switches.h" 53 #include "content/public/common/content_switches.h"
54 #include "content/public/common/context_menu_params.h" 54 #include "content/public/common/context_menu_params.h"
55 #include "content/public/common/drop_data.h"
55 #include "content/public/common/favicon_url.h" 56 #include "content/public/common/favicon_url.h"
56 #include "content/public/common/file_chooser_params.h" 57 #include "content/public/common/file_chooser_params.h"
57 #include "content/public/common/ssl_status.h" 58 #include "content/public/common/ssl_status.h"
58 #include "content/public/common/three_d_api_types.h" 59 #include "content/public/common/three_d_api_types.h"
59 #include "content/public/common/url_constants.h" 60 #include "content/public/common/url_constants.h"
60 #include "content/public/common/url_utils.h" 61 #include "content/public/common/url_utils.h"
61 #include "content/public/renderer/content_renderer_client.h" 62 #include "content/public/renderer/content_renderer_client.h"
62 #include "content/public/renderer/context_menu_client.h" 63 #include "content/public/renderer/context_menu_client.h"
63 #include "content/public/renderer/document_state.h" 64 #include "content/public/renderer/document_state.h"
64 #include "content/public/renderer/history_item_serialization.h" 65 #include "content/public/renderer/history_item_serialization.h"
65 #include "content/public/renderer/navigation_state.h" 66 #include "content/public/renderer/navigation_state.h"
66 #include "content/public/renderer/password_form_conversion_utils.h" 67 #include "content/public/renderer/password_form_conversion_utils.h"
67 #include "content/public/renderer/render_view_observer.h" 68 #include "content/public/renderer/render_view_observer.h"
68 #include "content/public/renderer/render_view_visitor.h" 69 #include "content/public/renderer/render_view_visitor.h"
69 #include "content/renderer/accessibility/renderer_accessibility.h" 70 #include "content/renderer/accessibility/renderer_accessibility.h"
70 #include "content/renderer/accessibility/renderer_accessibility_complete.h" 71 #include "content/renderer/accessibility/renderer_accessibility_complete.h"
71 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h" 72 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h"
72 #include "content/renderer/browser_plugin/browser_plugin.h" 73 #include "content/renderer/browser_plugin/browser_plugin.h"
73 #include "content/renderer/browser_plugin/browser_plugin_manager.h" 74 #include "content/renderer/browser_plugin/browser_plugin_manager.h"
74 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" 75 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h"
75 #include "content/renderer/context_menu_params_builder.h" 76 #include "content/renderer/context_menu_params_builder.h"
76 #include "content/renderer/device_orientation_dispatcher.h" 77 #include "content/renderer/device_orientation_dispatcher.h"
77 #include "content/renderer/devtools/devtools_agent.h" 78 #include "content/renderer/devtools/devtools_agent.h"
78 #include "content/renderer/disambiguation_popup_helper.h" 79 #include "content/renderer/disambiguation_popup_helper.h"
79 #include "content/renderer/dom_automation_controller.h" 80 #include "content/renderer/dom_automation_controller.h"
80 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" 81 #include "content/renderer/dom_storage/webstoragenamespace_impl.h"
82 #include "content/renderer/drop_data_builder.h"
81 #include "content/renderer/external_popup_menu.h" 83 #include "content/renderer/external_popup_menu.h"
82 #include "content/renderer/fetchers/alt_error_page_resource_fetcher.h" 84 #include "content/renderer/fetchers/alt_error_page_resource_fetcher.h"
83 #include "content/renderer/geolocation_dispatcher.h" 85 #include "content/renderer/geolocation_dispatcher.h"
84 #include "content/renderer/gpu/input_handler_manager.h" 86 #include "content/renderer/gpu/input_handler_manager.h"
85 #include "content/renderer/gpu/render_widget_compositor.h" 87 #include "content/renderer/gpu/render_widget_compositor.h"
86 #include "content/renderer/idle_user_detector.h" 88 #include "content/renderer/idle_user_detector.h"
87 #include "content/renderer/image_loading_helper.h" 89 #include "content/renderer/image_loading_helper.h"
88 #include "content/renderer/ime_event_guard.h" 90 #include "content/renderer/ime_event_guard.h"
89 #include "content/renderer/input_tag_speech_dispatcher.h" 91 #include "content/renderer/input_tag_speech_dispatcher.h"
90 #include "content/renderer/internal_document_state_data.h" 92 #include "content/renderer/internal_document_state_data.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 #include "third_party/skia/include/core/SkPicture.h" 197 #include "third_party/skia/include/core/SkPicture.h"
196 #include "ui/base/ui_base_switches_util.h" 198 #include "ui/base/ui_base_switches_util.h"
197 #include "ui/gfx/native_widget_types.h" 199 #include "ui/gfx/native_widget_types.h"
198 #include "ui/gfx/point.h" 200 #include "ui/gfx/point.h"
199 #include "ui/gfx/rect.h" 201 #include "ui/gfx/rect.h"
200 #include "ui/gfx/rect_conversions.h" 202 #include "ui/gfx/rect_conversions.h"
201 #include "ui/gfx/size_conversions.h" 203 #include "ui/gfx/size_conversions.h"
202 #include "ui/shell_dialogs/selected_file_info.h" 204 #include "ui/shell_dialogs/selected_file_info.h"
203 #include "v8/include/v8.h" 205 #include "v8/include/v8.h"
204 #include "webkit/common/dom_storage/dom_storage_types.h" 206 #include "webkit/common/dom_storage/dom_storage_types.h"
205 #include "webkit/common/webdropdata.h"
206 #include "webkit/glue/webkit_glue.h" 207 #include "webkit/glue/webkit_glue.h"
207 #include "webkit/glue/weburlresponse_extradata_impl.h" 208 #include "webkit/glue/weburlresponse_extradata_impl.h"
208 #include "webkit/plugins/npapi/plugin_list.h" 209 #include "webkit/plugins/npapi/plugin_list.h"
209 #include "webkit/plugins/npapi/plugin_utils.h" 210 #include "webkit/plugins/npapi/plugin_utils.h"
210 #include "webkit/plugins/npapi/webplugin_delegate.h" 211 #include "webkit/plugins/npapi/webplugin_delegate.h"
211 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" 212 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
212 #include "webkit/plugins/npapi/webplugin_impl.h" 213 #include "webkit/plugins/npapi/webplugin_impl.h"
213 #include "webkit/renderer/appcache/web_application_cache_host_impl.h" 214 #include "webkit/renderer/appcache/web_application_cache_host_impl.h"
214 #include "webkit/renderer/media/webmediaplayer_impl.h" 215 #include "webkit/renderer/media/webmediaplayer_impl.h"
215 #include "webkit/renderer/media/webmediaplayer_ms.h" 216 #include "webkit/renderer/media/webmediaplayer_ms.h"
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 684
684 bool TouchEnabled() { 685 bool TouchEnabled() {
685 // Based on the definition of chrome::kEnableTouchIcon. 686 // Based on the definition of chrome::kEnableTouchIcon.
686 #if defined(OS_ANDROID) 687 #if defined(OS_ANDROID)
687 return true; 688 return true;
688 #else 689 #else
689 return false; 690 return false;
690 #endif 691 #endif
691 } 692 }
692 693
693 WebDragData WebDropDataToDragData(const WebDropData& drop_data) { 694 WebDragData DropDataToWebDragData(const DropData& drop_data) {
694 std::vector<WebDragData::Item> item_list; 695 std::vector<WebDragData::Item> item_list;
695 696
696 // These fields are currently unused when dragging into WebKit. 697 // These fields are currently unused when dragging into WebKit.
697 DCHECK(drop_data.download_metadata.empty()); 698 DCHECK(drop_data.download_metadata.empty());
698 DCHECK(drop_data.file_contents.empty()); 699 DCHECK(drop_data.file_contents.empty());
699 DCHECK(drop_data.file_description_filename.empty()); 700 DCHECK(drop_data.file_description_filename.empty());
700 701
701 if (!drop_data.text.is_null()) { 702 if (!drop_data.text.is_null()) {
702 WebDragData::Item item; 703 WebDragData::Item item;
703 item.storageType = WebDragData::Item::StorageTypeString; 704 item.storageType = WebDragData::Item::StorageTypeString;
(...skipping 15 matching lines...) Expand all
719 720
720 if (!drop_data.html.is_null()) { 721 if (!drop_data.html.is_null()) {
721 WebDragData::Item item; 722 WebDragData::Item item;
722 item.storageType = WebDragData::Item::StorageTypeString; 723 item.storageType = WebDragData::Item::StorageTypeString;
723 item.stringType = WebString::fromUTF8(ui::Clipboard::kMimeTypeHTML); 724 item.stringType = WebString::fromUTF8(ui::Clipboard::kMimeTypeHTML);
724 item.stringData = drop_data.html.string(); 725 item.stringData = drop_data.html.string();
725 item.baseURL = drop_data.html_base_url; 726 item.baseURL = drop_data.html_base_url;
726 item_list.push_back(item); 727 item_list.push_back(item);
727 } 728 }
728 729
729 for (std::vector<WebDropData::FileInfo>::const_iterator it = 730 for (std::vector<DropData::FileInfo>::const_iterator it =
730 drop_data.filenames.begin(); 731 drop_data.filenames.begin();
731 it != drop_data.filenames.end(); 732 it != drop_data.filenames.end();
732 ++it) { 733 ++it) {
733 WebDragData::Item item; 734 WebDragData::Item item;
734 item.storageType = WebDragData::Item::StorageTypeFilename; 735 item.storageType = WebDragData::Item::StorageTypeFilename;
735 item.filenameData = it->path; 736 item.filenameData = it->path;
736 item.displayNameData = it->display_name; 737 item.displayNameData = it->display_name;
737 item_list.push_back(item); 738 item_list.push_back(item);
738 } 739 }
739 740
(...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after
2582 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) { 2583 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) {
2583 focus_url_ = GURL(url); 2584 focus_url_ = GURL(url);
2584 UpdateTargetURL(focus_url_, mouse_over_url_); 2585 UpdateTargetURL(focus_url_, mouse_over_url_);
2585 } 2586 }
2586 2587
2587 void RenderViewImpl::startDragging(WebFrame* frame, 2588 void RenderViewImpl::startDragging(WebFrame* frame,
2588 const WebDragData& data, 2589 const WebDragData& data,
2589 WebDragOperationsMask mask, 2590 WebDragOperationsMask mask,
2590 const WebImage& image, 2591 const WebImage& image,
2591 const WebPoint& webImageOffset) { 2592 const WebPoint& webImageOffset) {
2592 WebDropData drop_data(data); 2593 DropData drop_data(DropDataBuilder::Build(data));
2593 drop_data.referrer_policy = frame->document().referrerPolicy(); 2594 drop_data.referrer_policy = frame->document().referrerPolicy();
2594 gfx::Vector2d imageOffset(webImageOffset.x, webImageOffset.y); 2595 gfx::Vector2d imageOffset(webImageOffset.x, webImageOffset.y);
2595 Send(new DragHostMsg_StartDragging(routing_id_, 2596 Send(new DragHostMsg_StartDragging(routing_id_,
2596 drop_data, 2597 drop_data,
2597 mask, 2598 mask,
2598 image.getSkBitmap(), 2599 image.getSkBitmap(),
2599 imageOffset, 2600 imageOffset,
2600 possible_drag_event_info_)); 2601 possible_drag_event_info_));
2601 } 2602 }
2602 2603
(...skipping 2733 matching lines...) Expand 10 before | Expand all | Expand 10 after
5336 RenderThread::Get()->RegisterExtension(WebUIExtension::Get()); 5337 RenderThread::Get()->RegisterExtension(WebUIExtension::Get());
5337 new WebUIExtensionData(this); 5338 new WebUIExtensionData(this);
5338 } 5339 }
5339 5340
5340 enabled_bindings_ |= enabled_bindings_flags; 5341 enabled_bindings_ |= enabled_bindings_flags;
5341 5342
5342 // Keep track of the total bindings accumulated in this process. 5343 // Keep track of the total bindings accumulated in this process.
5343 RenderProcess::current()->AddBindings(enabled_bindings_flags); 5344 RenderProcess::current()->AddBindings(enabled_bindings_flags);
5344 } 5345 }
5345 5346
5346 void RenderViewImpl::OnDragTargetDragEnter(const WebDropData& drop_data, 5347 void RenderViewImpl::OnDragTargetDragEnter(const DropData& drop_data,
5347 const gfx::Point& client_point, 5348 const gfx::Point& client_point,
5348 const gfx::Point& screen_point, 5349 const gfx::Point& screen_point,
5349 WebDragOperationsMask ops, 5350 WebDragOperationsMask ops,
5350 int key_modifiers) { 5351 int key_modifiers) {
5351 WebDragOperation operation = webview()->dragTargetDragEnter( 5352 WebDragOperation operation = webview()->dragTargetDragEnter(
5352 WebDropDataToDragData(drop_data), 5353 DropDataToWebDragData(drop_data),
5353 client_point, 5354 client_point,
5354 screen_point, 5355 screen_point,
5355 ops, 5356 ops,
5356 key_modifiers); 5357 key_modifiers);
5357 5358
5358 Send(new DragHostMsg_UpdateDragCursor(routing_id_, operation)); 5359 Send(new DragHostMsg_UpdateDragCursor(routing_id_, operation));
5359 } 5360 }
5360 5361
5361 void RenderViewImpl::OnDragTargetDragOver(const gfx::Point& client_point, 5362 void RenderViewImpl::OnDragTargetDragOver(const gfx::Point& client_point,
5362 const gfx::Point& screen_point, 5363 const gfx::Point& screen_point,
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
6778 WebURL url = icon_urls[i].iconURL(); 6779 WebURL url = icon_urls[i].iconURL();
6779 if (!url.isEmpty()) 6780 if (!url.isEmpty())
6780 urls.push_back(FaviconURL(url, 6781 urls.push_back(FaviconURL(url,
6781 ToFaviconType(icon_urls[i].iconType()))); 6782 ToFaviconType(icon_urls[i].iconType())));
6782 } 6783 }
6783 SendUpdateFaviconURL(urls); 6784 SendUpdateFaviconURL(urls);
6784 } 6785 }
6785 6786
6786 6787
6787 } // namespace content 6788 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/renderer/webclipboard_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698