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

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

Issue 19457002: Make 'any'-typed attributes of events available in isolated worlds (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Henry Mason (hmason@mac.com) 2 * Copyright (C) 2007 Henry Mason (hmason@mac.com)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 virtual const AtomicString& interfaceName() const; 91 virtual const AtomicString& interfaceName() const;
92 92
93 enum DataType { 93 enum DataType {
94 DataTypeScriptValue, 94 DataTypeScriptValue,
95 DataTypeSerializedScriptValue, 95 DataTypeSerializedScriptValue,
96 DataTypeString, 96 DataTypeString,
97 DataTypeBlob, 97 DataTypeBlob,
98 DataTypeArrayBuffer 98 DataTypeArrayBuffer
99 }; 99 };
100 DataType dataType() const { return m_dataType; } 100 DataType dataType() const { return m_dataType; }
101 SerializedScriptValue* dataAsSerializedScriptValue() const { ASSERT(m_dataTy pe == DataTypeSerializedScriptValue); return m_dataAsSerializedScriptValue.get() ; } 101 SerializedScriptValue* dataAsSerializedScriptValue() const { ASSERT(m_dataTy pe == DataTypeScriptValue || m_dataType == DataTypeSerializedScriptValue); retur n m_dataAsSerializedScriptValue.get(); }
102 String dataAsString() const { ASSERT(m_dataType == DataTypeString); return m _dataAsString; } 102 String dataAsString() const { ASSERT(m_dataType == DataTypeString); return m _dataAsString; }
103 Blob* dataAsBlob() const { ASSERT(m_dataType == DataTypeBlob); return m_data AsBlob.get(); } 103 Blob* dataAsBlob() const { ASSERT(m_dataType == DataTypeBlob); return m_data AsBlob.get(); }
104 ArrayBuffer* dataAsArrayBuffer() const { ASSERT(m_dataType == DataTypeArrayB uffer); return m_dataAsArrayBuffer.get(); } 104 ArrayBuffer* dataAsArrayBuffer() const { ASSERT(m_dataType == DataTypeArrayB uffer); return m_dataAsArrayBuffer.get(); }
105 105
106 void setSerializedData(PassRefPtr<SerializedScriptValue> data)
107 {
108 ASSERT(!m_dataAsSerializedScriptValue);
109 m_dataAsSerializedScriptValue = data;
110 }
111
106 private: 112 private:
107 MessageEvent(); 113 MessageEvent();
108 MessageEvent(const AtomicString&, const MessageEventInit&); 114 MessageEvent(const AtomicString&, const MessageEventInit&);
109 MessageEvent(const String& origin, const String& lastEventId, PassRefPtr<DOM Window> source, PassOwnPtr<MessagePortArray>); 115 MessageEvent(const String& origin, const String& lastEventId, PassRefPtr<DOM Window> source, PassOwnPtr<MessagePortArray>);
110 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c onst String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortAr ray>); 116 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c onst String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortAr ray>);
111 117
112 explicit MessageEvent(const String& data, const String& origin); 118 explicit MessageEvent(const String& data, const String& origin);
113 explicit MessageEvent(PassRefPtr<Blob> data, const String& origin); 119 explicit MessageEvent(PassRefPtr<Blob> data, const String& origin);
114 explicit MessageEvent(PassRefPtr<ArrayBuffer> data, const String& origin); 120 explicit MessageEvent(PassRefPtr<ArrayBuffer> data, const String& origin);
115 121
116 DataType m_dataType; 122 DataType m_dataType;
117 RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue; 123 RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue;
118 String m_dataAsString; 124 String m_dataAsString;
119 RefPtr<Blob> m_dataAsBlob; 125 RefPtr<Blob> m_dataAsBlob;
120 RefPtr<ArrayBuffer> m_dataAsArrayBuffer; 126 RefPtr<ArrayBuffer> m_dataAsArrayBuffer;
121 String m_origin; 127 String m_origin;
122 String m_lastEventId; 128 String m_lastEventId;
123 RefPtr<DOMWindow> m_source; 129 RefPtr<DOMWindow> m_source;
124 OwnPtr<MessagePortArray> m_ports; 130 OwnPtr<MessagePortArray> m_ports;
125 }; 131 };
126 132
127 } // namespace WebCore 133 } // namespace WebCore
128 134
129 #endif // MessageEvent_h 135 #endif // MessageEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698