OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "webkit/glue/npruntime_util.h" | 7 #include "webkit/glue/npruntime_util.h" |
8 | 8 |
9 #if USE(V8_BINDING) | 9 #if USE(V8_BINDING) |
10 #include "ChromiumDataObject.h" | 10 #include "ChromiumDataObject.h" |
11 #include "ClipboardChromium.h" | 11 #include "ClipboardChromium.h" |
12 #include "EventNames.h" | 12 #include "EventNames.h" |
13 #include "MouseEvent.h" | 13 #include "MouseEvent.h" |
14 #include "NPV8Object.h" // for PrivateIdentifier | 14 #include "NPV8Object.h" // for PrivateIdentifier |
15 #include "V8Helpers.h" | 15 #include "V8Helpers.h" |
16 #include "v8_proxy.h" | 16 #include "V8Proxy.h" |
17 #elif USE(JAVASCRIPTCORE_BINDINGS) | 17 #elif USE(JAVASCRIPTCORE_BINDINGS) |
18 #include "bridge/c/c_utility.h" | 18 #include "bridge/c/c_utility.h" |
19 #endif | 19 #endif |
20 | 20 |
21 #undef LOG | 21 #undef LOG |
22 | 22 |
23 #include "base/pickle.h" | 23 #include "base/pickle.h" |
24 #if USE(V8_BINDING) | 24 #if USE(V8_BINDING) |
25 #include "webkit/api/public/WebDragData.h" | 25 #include "webkit/api/public/WebDragData.h" |
26 #include "webkit/glue/glue_util.h" | 26 #include "webkit/glue/glue_util.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 if (npobj->_class != npScriptObjectClass) | 95 if (npobj->_class != npScriptObjectClass) |
96 return false; | 96 return false; |
97 | 97 |
98 v8::HandleScope handle_scope; | 98 v8::HandleScope handle_scope; |
99 v8::Handle<v8::Context> context = v8::Context::GetEntered(); | 99 v8::Handle<v8::Context> context = v8::Context::GetEntered(); |
100 if (context.IsEmpty()) | 100 if (context.IsEmpty()) |
101 return false; | 101 return false; |
102 | 102 |
103 // Get the current WebCore event. | 103 // Get the current WebCore event. |
104 v8::Handle<v8::Value> current_event(GetEvent(context)); | 104 v8::Handle<v8::Value> current_event(GetEvent(context)); |
105 WebCore::Event* event = V8Proxy::ToNativeEvent(current_event); | 105 WebCore::Event* event = V8Proxy::convertToNativeEvent(current_event); |
106 if (event == NULL) | 106 if (event == NULL) |
107 return false; | 107 return false; |
108 | 108 |
109 // Check that the given npobj is that event. | 109 // Check that the given npobj is that event. |
110 V8NPObject* object = reinterpret_cast<V8NPObject*>(npobj); | 110 V8NPObject* object = reinterpret_cast<V8NPObject*>(npobj); |
111 WebCore::Event* given = V8Proxy::ToNativeEvent(object->v8Object); | 111 WebCore::Event* given = V8Proxy::convertToNativeEvent(object->v8Object); |
112 if (given != event) | 112 if (given != event) |
113 return false; | 113 return false; |
114 | 114 |
115 // Check the execution frames are same origin. | 115 // Check the execution frames are same origin. |
116 V8Proxy* current = V8Proxy::retrieve(V8Proxy::retrieveFrame()); | 116 V8Proxy* current = V8Proxy::retrieve(V8Proxy::retrieveFrame()); |
117 WebCore::Frame* frame = V8Proxy::retrieveFrame(context); | 117 WebCore::Frame* frame = V8Proxy::retrieveFrame(context); |
118 if (!current || !current->CanAccessFrame(frame, false)) | 118 if (!current || !current->canAccessFrame(frame, false)) |
119 return false; | 119 return false; |
120 | 120 |
121 const WebCore::EventNames& event_names(WebCore::eventNames()); | 121 const WebCore::EventNames& event_names(WebCore::eventNames()); |
122 const WebCore::AtomicString& event_type(event->type()); | 122 const WebCore::AtomicString& event_type(event->type()); |
123 | 123 |
124 enum DragTargetMouseEventId { | 124 enum DragTargetMouseEventId { |
125 DragEnterId = 1, DragOverId = 2, DragLeaveId = 3, DropId = 4 | 125 DragEnterId = 1, DragOverId = 2, DragLeaveId = 3, DropId = 4 |
126 }; | 126 }; |
127 | 127 |
128 // The event type should be a drag event. | 128 // The event type should be a drag event. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 #if USE(V8) | 173 #if USE(V8) |
174 int event_id; | 174 int event_id; |
175 return DragEventData(event, &event_id, NULL); // Check the event only. | 175 return DragEventData(event, &event_id, NULL); // Check the event only. |
176 #else | 176 #else |
177 // Not supported on other ports (JSC, etc). | 177 // Not supported on other ports (JSC, etc). |
178 return false; | 178 return false; |
179 #endif | 179 #endif |
180 } | 180 } |
181 | 181 |
182 } // namespace webkit_glue | 182 } // namespace webkit_glue |
OLD | NEW |