OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/shell/renderer/ipc_echo.h" | 5 #include "content/shell/renderer/ipc_echo.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/shell/common/shell_messages.h" | 9 #include "content/shell/common/shell_messages.h" |
10 #include "gin/handle.h" | 10 #include "gin/handle.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 104 } |
105 | 105 |
106 void IPCEcho::RequestEcho(int id, int size) { | 106 void IPCEcho::RequestEcho(int id, int size) { |
107 sender_->Send(new ShellViewHostMsg_EchoPing( | 107 sender_->Send(new ShellViewHostMsg_EchoPing( |
108 routing_id_, id, std::string(size, '*'))); | 108 routing_id_, id, std::string(size, '*'))); |
109 } | 109 } |
110 | 110 |
111 void IPCEcho::DidRespondEcho(int id, int size) { | 111 void IPCEcho::DidRespondEcho(int id, int size) { |
112 last_echo_id_ = id; | 112 last_echo_id_ = id; |
113 last_echo_size_ = size; | 113 last_echo_size_ = size; |
114 blink::WebString eventName = blink::WebString::fromUTF8("CustomEvent"); | 114 document_.dispatchEvent(blink::WebDOMCustomEvent("pong")); |
115 blink::WebString eventType = blink::WebString::fromUTF8("pong"); | |
116 blink::WebDOMEvent event = document_.createEvent(eventName); | |
117 event.to<blink::WebDOMCustomEvent>().initCustomEvent( | |
118 eventType, false, false, blink::WebSerializedScriptValue()); | |
119 document_.dispatchEvent(event); | |
120 } | 115 } |
121 | 116 |
122 void IPCEcho::Install(blink::WebFrame* frame) { | 117 void IPCEcho::Install(blink::WebFrame* frame) { |
123 IPCEchoBindings::Install(weak_factory_.GetWeakPtr(), frame); | 118 IPCEchoBindings::Install(weak_factory_.GetWeakPtr(), frame); |
124 } | 119 } |
125 | 120 |
126 } // namespace content | 121 } // namespace content |
OLD | NEW |