Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: Source/core/dom/ResourceProgressEvent.h

Issue 14773025: Create ResourceProgressEvent, expose as Chromium API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: merge Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/EventNames.in ('k') | Source/core/dom/ResourceProgressEvent.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #ifndef ResourceProgressEvent_h
32 #include "modules/webmidi/MIDIPort.h" 32 #define ResourceProgressEvent_h
33
34 #include "core/dom/ProgressEvent.h"
33 35
34 namespace WebCore { 36 namespace WebCore {
35 37
36 PassRefPtr<MIDIPort> MIDIPort::create(ScriptExecutionContext* context, const Str ing& id, const String& manufacturer, const String& name, MIDIPortTypeCode type, const String& version) 38 // ResourceProgressEvent is a non-standard class that is simply a ProgressEvent
37 { 39 // with an additional read-only "url" property containing a string URL. This is
38 RefPtr<MIDIPort> midiPort(adoptRef(new MIDIPort(context, id, manufacturer, n ame, type, version))); 40 // used by the Chromium NaCl integration to indicate to which resource the
39 midiPort->suspendIfNeeded(); 41 // event applies. This is useful because the NaCl integration will download
40 return midiPort.release(); 42 // (and translate in the case of PNaCl) multiple binary files. It is not
41 } 43 // constructable by web content at all, and so does not provide the usual
44 // EventInit pattern for Event construction.
45 class ResourceProgressEvent : public ProgressEvent {
46 public:
47 static PassRefPtr<ResourceProgressEvent> create()
48 {
49 return adoptRef(new ResourceProgressEvent);
50 }
51 static PassRefPtr<ResourceProgressEvent> create(const AtomicString& type, bo ol lengthComputable, unsigned long long loaded, unsigned long long total, const String& url)
52 {
53 return adoptRef(new ResourceProgressEvent(type, lengthComputable, loaded , total, url));
54 }
42 55
43 MIDIPort::MIDIPort(ScriptExecutionContext* context, const String& id, const Stri ng& manufacturer, const String& name, MIDIPortTypeCode type, const String& versi on) 56 const String& url() const;
44 : ActiveDOMObject(context)
45 , m_id(id)
46 , m_manufacturer(manufacturer)
47 , m_name(name)
48 , m_type(type)
49 , m_version(version)
50 {
51 ASSERT(type == MIDIPortTypeInput || type == MIDIPortTypeOutput);
52 ScriptWrappable::init(this);
53 }
54 57
55 MIDIPort::~MIDIPort() 58 virtual const AtomicString& interfaceName() const;
56 {
57 stop();
58 }
59 59
60 String MIDIPort::type() const 60 protected:
61 { 61 ResourceProgressEvent();
62 switch (m_type) { 62 ResourceProgressEvent(const AtomicString& type, bool lengthComputable, unsig ned long long loaded, unsigned long long total, const String& url);
63 case MIDIPortTypeInput: 63
64 return ASCIILiteral("input"); 64 private:
65 case MIDIPortTypeOutput: 65 String m_url;
66 return ASCIILiteral("output"); 66 };
67 default:
68 ASSERT_NOT_REACHED();
69 }
70 return emptyString();
71 }
72 67
73 } // namespace WebCore 68 } // namespace WebCore
69
70 #endif // ResourceProgressEvent_h
OLDNEW
« no previous file with comments | « Source/core/dom/EventNames.in ('k') | Source/core/dom/ResourceProgressEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698