| OLD | NEW |
| 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/browser/web_contents/web_drag_dest_gtk.h" | 5 #include "content/browser/web_contents/web_drag_dest_gtk.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "content/browser/renderer_host/render_view_host_impl.h" | 13 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 14 #include "content/browser/web_contents/drag_utils_gtk.h" | 14 #include "content/browser/web_contents/drag_utils_gtk.h" |
| 15 #include "content/browser/web_contents/web_contents_impl.h" | 15 #include "content/browser/web_contents/web_contents_impl.h" |
| 16 #include "content/public/browser/web_contents_delegate.h" | 16 #include "content/public/browser/web_contents_delegate.h" |
| 17 #include "content/public/browser/web_drag_dest_delegate.h" | 17 #include "content/public/browser/web_drag_dest_delegate.h" |
| 18 #include "content/public/common/url_constants.h" | 18 #include "content/public/common/url_constants.h" |
| 19 #include "net/base/net_util.h" | 19 #include "net/base/net_util.h" |
| 20 #include "third_party/WebKit/public/web/WebInputEvent.h" | 20 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 21 #include "ui/base/clipboard/custom_data_helper.h" | 21 #include "ui/base/clipboard/custom_data_helper.h" |
| 22 #include "ui/base/dragdrop/gtk_dnd_util.h" | 22 #include "ui/base/dragdrop/gtk_dnd_util.h" |
| 23 #include "ui/base/gtk/gtk_screen_util.h" | 23 #include "ui/base/gtk/gtk_screen_util.h" |
| 24 | 24 |
| 25 using WebKit::WebDragOperation; | 25 using blink::WebDragOperation; |
| 26 using WebKit::WebDragOperationNone; | 26 using blink::WebDragOperationNone; |
| 27 | 27 |
| 28 namespace content { | 28 namespace content { |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 const int kNumGtkHandlers = 5; | 31 const int kNumGtkHandlers = 5; |
| 32 | 32 |
| 33 int GetModifierFlags(GtkWidget* widget) { | 33 int GetModifierFlags(GtkWidget* widget) { |
| 34 int modifier_state = 0; | 34 int modifier_state = 0; |
| 35 GdkModifierType state; | 35 GdkModifierType state; |
| 36 gdk_window_get_pointer(gtk_widget_get_window(widget), NULL, NULL, &state); | 36 gdk_window_get_pointer(gtk_widget_get_window(widget), NULL, NULL, &state); |
| 37 | 37 |
| 38 if (state & GDK_SHIFT_MASK) | 38 if (state & GDK_SHIFT_MASK) |
| 39 modifier_state |= WebKit::WebInputEvent::ShiftKey; | 39 modifier_state |= blink::WebInputEvent::ShiftKey; |
| 40 if (state & GDK_CONTROL_MASK) | 40 if (state & GDK_CONTROL_MASK) |
| 41 modifier_state |= WebKit::WebInputEvent::ControlKey; | 41 modifier_state |= blink::WebInputEvent::ControlKey; |
| 42 if (state & GDK_MOD1_MASK) | 42 if (state & GDK_MOD1_MASK) |
| 43 modifier_state |= WebKit::WebInputEvent::AltKey; | 43 modifier_state |= blink::WebInputEvent::AltKey; |
| 44 if (state & GDK_META_MASK) | 44 if (state & GDK_META_MASK) |
| 45 modifier_state |= WebKit::WebInputEvent::MetaKey; | 45 modifier_state |= blink::WebInputEvent::MetaKey; |
| 46 return modifier_state; | 46 return modifier_state; |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace | 49 } // namespace |
| 50 | 50 |
| 51 WebDragDestGtk::WebDragDestGtk(WebContents* web_contents, GtkWidget* widget) | 51 WebDragDestGtk::WebDragDestGtk(WebContents* web_contents, GtkWidget* widget) |
| 52 : web_contents_(web_contents), | 52 : web_contents_(web_contents), |
| 53 widget_(widget), | 53 widget_(widget), |
| 54 context_(NULL), | 54 context_(NULL), |
| 55 data_requests_(0), | 55 data_requests_(0), |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 gtk_drag_finish(context, is_drop_target_, FALSE, time); | 329 gtk_drag_finish(context, is_drop_target_, FALSE, time); |
| 330 | 330 |
| 331 return TRUE; | 331 return TRUE; |
| 332 } | 332 } |
| 333 | 333 |
| 334 RenderViewHostImpl* WebDragDestGtk::GetRenderViewHost() const { | 334 RenderViewHostImpl* WebDragDestGtk::GetRenderViewHost() const { |
| 335 return static_cast<RenderViewHostImpl*>(web_contents_->GetRenderViewHost()); | 335 return static_cast<RenderViewHostImpl*>(web_contents_->GetRenderViewHost()); |
| 336 } | 336 } |
| 337 | 337 |
| 338 } // namespace content | 338 } // namespace content |
| OLD | NEW |