OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 WebDOMMessageEvent::WebDOMMessageEvent( | 46 WebDOMMessageEvent::WebDOMMessageEvent( |
47 const WebSerializedScriptValue& message_data, | 47 const WebSerializedScriptValue& message_data, |
48 const WebString& origin, | 48 const WebString& origin, |
49 const WebFrame* source_frame, | 49 const WebFrame* source_frame, |
50 const WebDocument& target_document, | 50 const WebDocument& target_document, |
51 WebMessagePortChannelArray channels) | 51 WebMessagePortChannelArray channels) |
52 : WebDOMMessageEvent(MessageEvent::Create()) { | 52 : WebDOMMessageEvent(MessageEvent::Create()) { |
53 DOMWindow* window = nullptr; | 53 DOMWindow* window = nullptr; |
54 if (source_frame) | 54 if (source_frame) |
55 window = source_frame->ToImplBase()->GetFrame()->DomWindow(); | 55 window = WebFrame::CoreFrame(source_frame)->DomWindow(); |
56 MessagePortArray* ports = nullptr; | 56 MessagePortArray* ports = nullptr; |
57 if (!target_document.IsNull()) { | 57 if (!target_document.IsNull()) { |
58 Document* core_document = target_document; | 58 Document* core_document = target_document; |
59 ports = MessagePort::ToMessagePortArray(core_document, std::move(channels)); | 59 ports = MessagePort::ToMessagePortArray(core_document, std::move(channels)); |
60 } | 60 } |
61 // Use an empty array for |ports| when it is null because this function | 61 // Use an empty array for |ports| when it is null because this function |
62 // is used to implement postMessage(). | 62 // is used to implement postMessage(). |
63 if (!ports) | 63 if (!ports) |
64 ports = new MessagePortArray; | 64 ports = new MessagePortArray; |
65 // TODO(esprehn): Chromium always passes empty string for lastEventId, is that | 65 // TODO(esprehn): Chromium always passes empty string for lastEventId, is that |
(...skipping 14 matching lines...) Expand all Loading... |
80 | 80 |
81 WebMessagePortChannelArray WebDOMMessageEvent::ReleaseChannels() { | 81 WebMessagePortChannelArray WebDOMMessageEvent::ReleaseChannels() { |
82 MessagePortChannelArray channels = Unwrap<MessageEvent>()->ReleaseChannels(); | 82 MessagePortChannelArray channels = Unwrap<MessageEvent>()->ReleaseChannels(); |
83 WebMessagePortChannelArray web_channels(channels.size()); | 83 WebMessagePortChannelArray web_channels(channels.size()); |
84 for (size_t i = 0; i < channels.size(); ++i) | 84 for (size_t i = 0; i < channels.size(); ++i) |
85 web_channels[i] = std::move(channels[i]); | 85 web_channels[i] = std::move(channels[i]); |
86 return web_channels; | 86 return web_channels; |
87 } | 87 } |
88 | 88 |
89 } // namespace blink | 89 } // namespace blink |
OLD | NEW |