Index: Source/WebCore/bindings/dart/custom/DartDOMWindowCustom.cpp |
diff --git a/Source/WebCore/bindings/dart/custom/DartDOMWindowCustom.cpp b/Source/WebCore/bindings/dart/custom/DartDOMWindowCustom.cpp |
deleted file mode 100644 |
index 4c853704e8834c9466965d2de914b96a1ffeff3c..0000000000000000000000000000000000000000 |
--- a/Source/WebCore/bindings/dart/custom/DartDOMWindowCustom.cpp |
+++ /dev/null |
@@ -1,334 +0,0 @@ |
-// Copyright 2011, Google Inc. |
-// All rights reserved. |
-// |
-// Redistribution and use in source and binary forms, with or without |
-// modification, are permitted provided that the following conditions are |
-// met: |
-// |
-// * Redistributions of source code must retain the above copyright |
-// notice, this list of conditions and the following disclaimer. |
-// * Redistributions in binary form must reproduce the above |
-// copyright notice, this list of conditions and the following disclaimer |
-// in the documentation and/or other materials provided with the |
-// distribution. |
-// * Neither the name of Google Inc. nor the names of its |
-// contributors may be used to endorse or promote products derived from |
-// this software without specific prior written permission. |
-// |
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- |
-#include "config.h" |
-#include "DartDOMWindow.h" |
- |
-#include "DOMTimer.h" |
-#include "DOMWindow.h" |
-#include "DartDOMWindow.h" |
-#include "DartDOMWrapper.h" |
-#include "DartFileReader.h" |
-#include "DartScheduledAction.h" |
-#include "DartUtilities.h" |
-#include "DartWebKitCSSMatrix.h" |
-#include "DartWebKitPoint.h" |
-#include "DartXMLHttpRequest.h" |
-#include "Document.h" |
-#include "FileReader.h" |
-#include "History.h" |
-#include "Location.h" |
-#include "MessagePort.h" |
-#include "OwnPtr.h" |
-#include "ScriptExecutionContext.h" |
-#include "SecurityOrigin.h" |
-#include "WebKitCSSMatrix.h" |
-#include "WebKitPoint.h" |
-#include "XMLHttpRequest.h" |
- |
-namespace WebCore { |
- |
-namespace DartDOMWindowInternal { |
- |
-void eventGetter(Dart_NativeArguments) |
-{ |
- // FIXME: proper implementation. |
- DART_UNIMPLEMENTED(); |
-} |
- |
-void historyCrossFrameGetter(Dart_NativeArguments args) |
-{ |
- DartApiScope dartApiScope; |
- { |
- DOMWindow* receiver = DartDOMWrapper::receiver< DOMWindow >(args); |
- |
- Dart_Handle result = DartDOMWrapper::toDart(receiver->history(), "HistoryCrossFrameImplementation"); |
- if (result) |
- Dart_SetReturnValue(args, result); |
- } |
-} |
- |
-void locationCrossFrameGetter(Dart_NativeArguments args) |
-{ |
- DartApiScope dartApiScope; |
- { |
- DOMWindow* receiver = DartDOMWrapper::receiver< DOMWindow >(args); |
- |
- Dart_Handle result = DartDOMWrapper::toDart(receiver->location(), "LocationCrossFrameImplementation"); |
- if (result) |
- Dart_SetReturnValue(args, result); |
- } |
-} |
- |
-void locationSetter(Dart_NativeArguments args) |
-{ |
- DartApiScope dartApiScope; |
- Dart_Handle exception; |
- { |
- DOMWindow* receiver = DartDOMWrapper::receiver< DOMWindow >(args); |
- ASSERT(receiver == DartUtilities::domWindowForCurrentIsolate()); |
- |
- const ParameterAdapter< String > location(Dart_GetNativeArgument(args, 1)); |
- if (!location.conversionSuccessful()) { |
- exception = location.exception(); |
- goto fail; |
- } |
- |
- receiver->setLocation(location, receiver, receiver); |
- return; |
- } |
- |
-fail: |
- Dart_ThrowException(exception); |
- ASSERT_NOT_REACHED(); |
-} |
- |
-void openCallback(Dart_NativeArguments args) |
-{ |
- DartApiScope dartApiScope; |
- Dart_Handle exception; |
- { |
- DOMWindow* receiver = DartDOMWrapper::receiver< DOMWindow >(args); |
- ASSERT(receiver == DartUtilities::domWindowForCurrentIsolate()); |
- |
- const ParameterAdapter< String > url(Dart_GetNativeArgument(args, 1)); |
- if (!url.conversionSuccessful()) { |
- exception = url.exception(); |
- goto fail; |
- } |
- const ParameterAdapter< String > name(Dart_GetNativeArgument(args, 2)); |
- if (!name.conversionSuccessful()) { |
- exception = name.exception(); |
- goto fail; |
- } |
- const ParameterAdapter< String > options(Dart_GetNativeArgument(args, 3), DartUtilities::ConvertNullToEmptyString); |
- if (!options.conversionSuccessful()) { |
- exception = options.exception(); |
- goto fail; |
- } |
- |
- RefPtr<DOMWindow> openedWindow = receiver->open(url, name, options, receiver, receiver); |
- if (openedWindow) |
- DartDOMWrapper::returnValue(args, openedWindow.release()); |
- return; |
- } |
- |
-fail: |
- Dart_ThrowException(exception); |
- ASSERT_NOT_REACHED(); |
-} |
- |
-void showModalDialogCallback(Dart_NativeArguments) |
-{ |
- // FIXME: proper implementation. |
- DART_UNIMPLEMENTED(); |
-} |
- |
-void postMessageCallback(Dart_NativeArguments args) |
-{ |
- DartApiScope dartApiScope; |
- Dart_Handle exception; |
- { |
- DOMWindow* receiver = DartDOMWrapper::receiver< DOMWindow >(args); |
- |
- DOMWindow* source = DartUtilities::domWindowForCurrentIsolate(); |
- ASSERT(source); |
- ASSERT(source->frame()); |
- |
- ParameterAdapter< RefPtr<SerializedScriptValue> > message(Dart_GetNativeArgument(args, 1)); |
- if (!message.conversionSuccessful()) { |
- exception = message.exception(); |
- goto fail; |
- } |
- |
- // This function has variable arguments and can either be: |
- // postMessage(message, ports, targetOrigin); |
- // or |
- // postMessage(message, targetOrigin); |
- int targetOriginParameterNumber = 2; |
- MessagePortArray portArray; |
- if (!Dart_IsNull(Dart_GetNativeArgument(args, 3))) { |
- exception = 0; |
- DartUtilities::toMessagePortArray(Dart_GetNativeArgument(args, 2), portArray, exception); |
- if (exception) |
- goto fail; |
- targetOriginParameterNumber = 3; |
- } |
- |
- const ParameterAdapter< String > targetOrigin(Dart_GetNativeArgument(args, targetOriginParameterNumber)); |
- if (!targetOrigin.conversionSuccessful()) { |
- exception = targetOrigin.exception(); |
- goto fail; |
- } |
- |
- ExceptionCode ec = 0; |
- receiver->postMessage(message.release(), &portArray, targetOrigin, source, ec); |
- if (UNLIKELY(ec)) { |
- exception = DartDOMWrapper::exceptionCodeToDartException(ec); |
- goto fail; |
- } |
- |
- return; |
- } |
- |
-fail: |
- Dart_ThrowException(exception); |
- ASSERT_NOT_REACHED(); |
-} |
- |
-void webkitPostMessageCallback(Dart_NativeArguments) |
-{ |
- // FIXME: proper implementation. |
- DART_UNIMPLEMENTED(); |
-} |
- |
-// NOTE: if throws exception, doesn't unwind the stack, should be called with caution! |
-static void windowSetTimeoutImpl(Dart_NativeArguments args, bool singleShot) |
-{ |
- DartApiScope dartApiScope; |
- Dart_Handle exception; |
- { |
- DOMWindow* receiver = DartDOMWrapper::receiver< DOMWindow >(args); |
- ASSERT(receiver == DartUtilities::domWindowForCurrentIsolate()); |
- |
- Dart_Handle callback = Dart_GetNativeArgument(args, 1); |
- if (!Dart_IsClosure(callback)) { |
- exception = Dart_NewString("Not a Dart closure passed"); |
- goto fail; |
- } |
- |
- const ParameterAdapter< int > timeout(Dart_GetNativeArgument(args, 2)); |
- if (!timeout.conversionSuccessful()) { |
- exception = timeout.exception(); |
- goto fail; |
- } |
- |
- ScriptExecutionContext* context = receiver->document(); |
- ASSERT(context); |
- OwnPtr<DartScheduledAction> action = adoptPtr(new DartScheduledAction(Dart_CurrentIsolate(), callback)); |
- intptr_t id = DOMTimer::install(context, action.release(), timeout, singleShot); |
- DartDOMWrapper::returnValue(args, id); |
- return; |
- } |
- |
-fail: |
- Dart_ThrowException(exception); |
- ASSERT_NOT_REACHED(); |
-} |
- |
-void setTimeoutCallback(Dart_NativeArguments args) |
-{ |
- windowSetTimeoutImpl(args, true /* singleShot */); |
-} |
- |
-void setIntervalCallback(Dart_NativeArguments args) |
-{ |
- windowSetTimeoutImpl(args, false /* singleShot */); |
-} |
- |
-void addEventListenerCallback(Dart_NativeArguments args) |
-{ |
- DartApiScope dartApiScope; |
- Dart_Handle exception; |
- { |
- DOMWindow* receiver = DartDOMWrapper::receiver< DOMWindow >(args); |
- ASSERT(receiver == DartUtilities::domWindowForCurrentIsolate()); |
- |
- const ParameterAdapter< String > type(Dart_GetNativeArgument(args, 1)); |
- if (!type.conversionSuccessful()) { |
- exception = type.exception(); |
- goto fail; |
- } |
- const ParameterAdapter< RefPtr<EventListener> > listener(Dart_GetNativeArgument(args, 2)); |
- if (!listener.conversionSuccessful()) { |
- exception = listener.exception(); |
- goto fail; |
- } |
- const ParameterAdapter< bool > useCapture(Dart_GetNativeArgument(args, 3)); |
- if (!useCapture.conversionSuccessful()) { |
- exception = useCapture.exception(); |
- goto fail; |
- } |
- |
- receiver->addEventListener(type, listener, useCapture); |
- return; |
- } |
- |
-fail: |
- Dart_ThrowException(exception); |
- ASSERT_NOT_REACHED(); |
-} |
- |
-void removeEventListenerCallback(Dart_NativeArguments args) |
-{ |
- DartApiScope dartApiScope; |
- Dart_Handle exception; |
- { |
- DOMWindow* receiver = DartDOMWrapper::receiver< DOMWindow >(args); |
- ASSERT(receiver == DartUtilities::domWindowForCurrentIsolate()); |
- |
- const ParameterAdapter< String > type(Dart_GetNativeArgument(args, 1)); |
- if (!type.conversionSuccessful()) { |
- exception = type.exception(); |
- goto fail; |
- } |
- const ParameterAdapter< RefPtr<EventListener> > listener(Dart_GetNativeArgument(args, 2)); |
- if (!listener.conversionSuccessful()) { |
- exception = listener.exception(); |
- goto fail; |
- } |
- const ParameterAdapter< bool > useCapture(Dart_GetNativeArgument(args, 3)); |
- if (!useCapture.conversionSuccessful()) { |
- exception = useCapture.exception(); |
- goto fail; |
- } |
- |
- receiver->removeEventListener(type, listener, useCapture); |
- return; |
- } |
- |
-fail: |
- Dart_ThrowException(exception); |
- ASSERT_NOT_REACHED(); |
-} |
- |
-void toStringCallback(Dart_NativeArguments) |
-{ |
- // FIXME: proper implementation. |
- DART_UNIMPLEMENTED(); |
-} |
- |
-} |
- |
-Dart_Handle toDartValue(DOMWindow* window) |
-{ |
- return DartDOMWrapper::toDart(window, "DOMWindowCrossFrameImplementation"); |
-} |
- |
-} |