OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "public/platform/WebDOMException.h" |
| 7 |
| 8 #include "V8DOMException.h" |
| 9 #include "bindings/v8/V8Binding.h" |
| 10 #include "core/dom/DOMException.h" |
| 11 #include "wtf/PassOwnPtr.h" |
| 12 |
| 13 using namespace WebCore; |
| 14 |
| 15 namespace blink { |
| 16 |
| 17 WebDOMException WebDOMException::create(unsigned short code, const WebString& na
me, const WebString& message) |
| 18 { |
| 19 return WebDOMException(DOMException::create(code, name, message)); |
| 20 } |
| 21 |
| 22 void WebDOMException::reset() |
| 23 { |
| 24 m_private.reset(); |
| 25 } |
| 26 |
| 27 void WebDOMException::assign(const WebDOMException& other) |
| 28 { |
| 29 m_private = other.m_private; |
| 30 } |
| 31 |
| 32 unsigned short int WebDOMException::code() const |
| 33 { |
| 34 if (!m_private.get()) |
| 35 return 0; |
| 36 return m_private->code(); |
| 37 } |
| 38 |
| 39 WebString WebDOMException::name() const |
| 40 { |
| 41 if (!m_private.get()) |
| 42 return WebString(); |
| 43 return m_private->name(); |
| 44 } |
| 45 |
| 46 WebString WebDOMException::message() const |
| 47 { |
| 48 if (!m_private.get()) |
| 49 return WebString(); |
| 50 return m_private->message(); |
| 51 } |
| 52 |
| 53 v8::Handle<v8::Value> WebDOMException::toV8Value() |
| 54 { |
| 55 if (!m_private.get()) |
| 56 return v8::Handle<v8::Value>(); |
| 57 return toV8(m_private.get(), v8::Handle<v8::Object>(), v8::Isolate::GetCurre
nt()); |
| 58 } |
| 59 |
| 60 WebDOMException::WebDOMException(const PassRefPtrWillBeRawPtr<WebCore::DOMExcept
ion>& error) |
| 61 : m_private(error) |
| 62 { |
| 63 } |
| 64 |
| 65 WebDOMException& WebDOMException::operator=(const PassRefPtrWillBeRawPtr<WebCore
::DOMException>& error) |
| 66 { |
| 67 m_private = error; |
| 68 return *this; |
| 69 } |
| 70 |
| 71 } // namespace blink |
| 72 |
OLD | NEW |