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 #ifndef ApplicationCacheErrorEvent_h 6 #define ApplicationCacheErrorEvent_h 7 8 #include "core/events/Event.h" 9 #include "core/loader/appcache/ApplicationCacheHost.h" 10 #include "public/platform/WebApplicationCacheHostClient.h" 11 12 namespace WebCore { 13 14 class ApplicationCacheErrorEvent; 15 16 struct ApplicationCacheErrorEventInit : public EventInit { 17 ApplicationCacheErrorEventInit(); 18 19 String reason; 20 String url; 21 int status; 22 String message; 23 }; 24 25 class ApplicationCacheErrorEvent FINAL : public Event { 26 public: 27 virtual ~ApplicationCacheErrorEvent(); 28 29 static PassRefPtrWillBeRawPtr<ApplicationCacheErrorEvent> create() 30 { 31 return adoptRefWillBeNoop(new ApplicationCacheErrorEvent); 32 } 33 34 static PassRefPtrWillBeRawPtr<ApplicationCacheErrorEvent> create(blink::WebApplicationCacheHost::ErrorReason reason, const String& url, int status, const String& message) 35 { 36 return adoptRefWillBeNoop(new ApplicationCacheErrorEvent(reason, url, status, message)); 37 } 38 39 static PassRefPtrWillBeRawPtr<ApplicationCacheErrorEvent> create(const AtomicString& eventType, const ApplicationCacheErrorEventInit& initializer) 40 { 41 return adoptRefWillBeNoop(new ApplicationCacheErrorEvent(eventType, initializer)); 42 } 43 44 const String& reason() const { return m_reason; } 45 const String& url() const { return m_url; } 46 int status() const { return m_status; } 47 const String& message() const { return m_message; } 48 49 virtual const AtomicString& interfaceName() const OVERRIDE { return EventNames::ApplicationCacheErrorEvent; } 50 51 virtual void trace(Visitor*) OVERRIDE; 52 53 private: 54 ApplicationCacheErrorEvent(); 55 ApplicationCacheErrorEvent(blink::WebApplicationCacheHost::ErrorReason, const String& url, int status, const String& message); 56 ApplicationCacheErrorEvent(const AtomicString& eventType, const ApplicationCacheErrorEventInit& initializer); 57 58 String m_reason; 59 String m_url; 60 int m_status; 61 String m_message; 62 }; 63 64 } // namespace WebCore 65 66 #endif // ApplicationCacheErrorEvent_h 67