| Index: content/browser/renderer_host/render_widget_host_impl.cc
|
| diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
|
| index 66b1d275a2011db4fcd2dee983a4c332c0dd8330..adafc2b3f67c22fcbe141fcd6b0aaf1ceced4889 100644
|
| --- a/content/browser/renderer_host/render_widget_host_impl.cc
|
| +++ b/content/browser/renderer_host/render_widget_host_impl.cc
|
| @@ -79,6 +79,7 @@
|
| #include "skia/ext/image_operations.h"
|
| #include "skia/ext/platform_canvas.h"
|
| #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
|
| +#include "ui/base/clipboard/clipboard.h"
|
| #include "ui/events/blink/web_input_event_traits.h"
|
| #include "ui/events/event.h"
|
| #include "ui/events/keycodes/keyboard_codes.h"
|
| @@ -97,6 +98,7 @@
|
| using base::Time;
|
| using base::TimeDelta;
|
| using base::TimeTicks;
|
| +using blink::WebDragOperationsMask;
|
| using blink::WebGestureEvent;
|
| using blink::WebInputEvent;
|
| using blink::WebKeyboardEvent;
|
| @@ -182,6 +184,56 @@ inline blink::WebGestureEvent CreateScrollEndForWrapping(
|
| return wrap_gesture_scroll_end;
|
| }
|
|
|
| +std::vector<DropData::Metadata> DropDataToMetaData(const DropData& drop_data) {
|
| + std::vector<DropData::Metadata> metadata;
|
| + if (!drop_data.text.is_null()) {
|
| + metadata.push_back(DropData::Metadata::CreateForMimeType(
|
| + DropData::Kind::STRING,
|
| + base::ASCIIToUTF16(ui::Clipboard::kMimeTypeText)));
|
| + }
|
| +
|
| + if (drop_data.url.is_valid()) {
|
| + metadata.push_back(DropData::Metadata::CreateForMimeType(
|
| + DropData::Kind::STRING,
|
| + base::ASCIIToUTF16(ui::Clipboard::kMimeTypeURIList)));
|
| + }
|
| +
|
| + if (!drop_data.html.is_null()) {
|
| + metadata.push_back(DropData::Metadata::CreateForMimeType(
|
| + DropData::Kind::STRING,
|
| + base::ASCIIToUTF16(ui::Clipboard::kMimeTypeHTML)));
|
| + }
|
| +
|
| + // On Aura, filenames are available before drop.
|
| + for (const auto& file_info : drop_data.filenames) {
|
| + if (!file_info.path.empty()) {
|
| + metadata.push_back(DropData::Metadata::CreateForFilePath(file_info.path));
|
| + }
|
| + }
|
| +
|
| + // On Android, only files' mime types are available before drop.
|
| + for (const auto& mime_type : drop_data.file_mime_types) {
|
| + if (!mime_type.empty()) {
|
| + metadata.push_back(DropData::Metadata::CreateForMimeType(
|
| + DropData::Kind::FILENAME, mime_type));
|
| + }
|
| + }
|
| +
|
| + for (const auto& file_system_file : drop_data.file_system_files) {
|
| + if (!file_system_file.url.is_empty()) {
|
| + metadata.push_back(
|
| + DropData::Metadata::CreateForFileSystemUrl(file_system_file.url));
|
| + }
|
| + }
|
| +
|
| + for (const auto& custom_data_item : drop_data.custom_data) {
|
| + metadata.push_back(DropData::Metadata::CreateForMimeType(
|
| + DropData::Kind::STRING, custom_data_item.first));
|
| + }
|
| +
|
| + return metadata;
|
| +}
|
| +
|
| } // namespace
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -1277,6 +1329,42 @@ void RenderWidgetHostImpl::HandleCompositorProto(
|
| Send(new ViewMsg_HandleCompositorProto(GetRoutingID(), proto));
|
| }
|
|
|
| +void RenderWidgetHostImpl::DragTargetDragEnter(
|
| + const DropData& drop_data,
|
| + const gfx::Point& client_pt,
|
| + const gfx::Point& screen_pt,
|
| + WebDragOperationsMask operations_allowed,
|
| + int key_modifiers) {
|
| + std::vector<DropData::Metadata> metadata = DropDataToMetaData(drop_data);
|
| + Send(new DragMsg_TargetDragEnter(GetRoutingID(), metadata, client_pt,
|
| + screen_pt, operations_allowed,
|
| + key_modifiers));
|
| +}
|
| +
|
| +void RenderWidgetHostImpl::DragTargetDragOver(
|
| + const gfx::Point& client_pt,
|
| + const gfx::Point& screen_pt,
|
| + WebDragOperationsMask operations_allowed,
|
| + int key_modifiers) {
|
| + Send(new DragMsg_TargetDragOver(GetRoutingID(), client_pt, screen_pt,
|
| + operations_allowed, key_modifiers));
|
| +}
|
| +
|
| +void RenderWidgetHostImpl::DragTargetDragLeave() {
|
| + Send(new DragMsg_TargetDragLeave(GetRoutingID()));
|
| +}
|
| +
|
| +void RenderWidgetHostImpl::DragTargetDrop(const DropData& drop_data,
|
| + const gfx::Point& client_pt,
|
| + const gfx::Point& screen_pt,
|
| + int key_modifiers) {
|
| + DropData drop_data_with_permissions(drop_data);
|
| + delegate()->GetRenderViewHost()->GrantFileAccessFromDropData(
|
| + &drop_data_with_permissions);
|
| + Send(new DragMsg_TargetDrop(GetRoutingID(), drop_data_with_permissions,
|
| + client_pt, screen_pt, key_modifiers));
|
| +}
|
| +
|
| void RenderWidgetHostImpl::NotifyScreenInfoChanged() {
|
| if (delegate_)
|
| delegate_->ScreenInfoChanged();
|
|
|