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

Side by Side Diff: Source/web/WebDOMMessageEvent.cpp

Issue 683013002: Extract a DOMWindow interface from LocalDOMWindow and use it in the idl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix incorrect assumption Created 6 years, 1 month 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) 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 30 matching lines...) Expand all
41 #include "public/web/WebSerializedScriptValue.h" 41 #include "public/web/WebSerializedScriptValue.h"
42 #include "web/WebLocalFrameImpl.h" 42 #include "web/WebLocalFrameImpl.h"
43 43
44 namespace blink { 44 namespace blink {
45 45
46 void WebDOMMessageEvent::initMessageEvent(const WebString& type, bool canBubble, bool cancelable, const WebSerializedScriptValue& messageData, const WebString& origin, const WebFrame* sourceFrame, const WebString& lastEventId, const WebMess agePortChannelArray& webChannels) 46 void WebDOMMessageEvent::initMessageEvent(const WebString& type, bool canBubble, bool cancelable, const WebSerializedScriptValue& messageData, const WebString& origin, const WebFrame* sourceFrame, const WebString& lastEventId, const WebMess agePortChannelArray& webChannels)
47 { 47 {
48 ASSERT(m_private.get()); 48 ASSERT(m_private.get());
49 ASSERT(isMessageEvent()); 49 ASSERT(isMessageEvent());
50 LocalDOMWindow* window = 0; 50 LocalDOMWindow* window = 0;
51 // FIXME: Figure out if this is the right thing to do.
51 if (sourceFrame) 52 if (sourceFrame)
52 window = toWebLocalFrameImpl(sourceFrame)->frame()->domWindow(); 53 window = toWebLocalFrameImpl(sourceFrame)->frame()->localDOMWindow();
53 OwnPtrWillBeRawPtr<MessagePortArray> ports = nullptr; 54 OwnPtrWillBeRawPtr<MessagePortArray> ports = nullptr;
54 if (sourceFrame) 55 if (sourceFrame)
55 ports = MessagePort::toMessagePortArray(window->document(), webChannels) ; 56 ports = MessagePort::toMessagePortArray(window->document(), webChannels) ;
56 unwrap<MessageEvent>()->initMessageEvent(type, canBubble, cancelable, messag eData, origin, lastEventId, window, ports.release()); 57 unwrap<MessageEvent>()->initMessageEvent(type, canBubble, cancelable, messag eData, origin, lastEventId, window, ports.release());
57 } 58 }
58 59
59 WebSerializedScriptValue WebDOMMessageEvent::data() const 60 WebSerializedScriptValue WebDOMMessageEvent::data() const
60 { 61 {
61 return WebSerializedScriptValue(constUnwrap<MessageEvent>()->dataAsSerialize dScriptValue()); 62 return WebSerializedScriptValue(constUnwrap<MessageEvent>()->dataAsSerialize dScriptValue());
62 } 63 }
63 64
64 WebString WebDOMMessageEvent::origin() const 65 WebString WebDOMMessageEvent::origin() const
65 { 66 {
66 return WebString(constUnwrap<MessageEvent>()->origin()); 67 return WebString(constUnwrap<MessageEvent>()->origin());
67 } 68 }
68 69
69 WebMessagePortChannelArray WebDOMMessageEvent::releaseChannels() 70 WebMessagePortChannelArray WebDOMMessageEvent::releaseChannels()
70 { 71 {
71 MessagePortChannelArray* channels = constUnwrap<MessageEvent>()->channels(); 72 MessagePortChannelArray* channels = constUnwrap<MessageEvent>()->channels();
72 WebMessagePortChannelArray webChannels(channels ? channels->size() : 0); 73 WebMessagePortChannelArray webChannels(channels ? channels->size() : 0);
73 if (channels) { 74 if (channels) {
74 for (size_t i = 0; i < channels->size(); ++i) 75 for (size_t i = 0; i < channels->size(); ++i)
75 webChannels[i] = (*channels)[i].leakPtr(); 76 webChannels[i] = (*channels)[i].leakPtr();
76 } 77 }
77 return webChannels; 78 return webChannels;
78 } 79 }
79 80
80 } // namespace blink 81 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698