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 "content/shell/common/shell_messages.h" | 8 #include "content/shell/common/shell_messages.h" |
9 #include "content/shell/renderer/binding_helpers.h" | 9 #include "content/shell/renderer/binding_helpers.h" |
10 #include "gin/object_template_builder.h" | 10 #include "gin/object_template_builder.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 static void Install(base::WeakPtr<IPCEcho> echo, blink::WebFrame* frame); | 22 static void Install(base::WeakPtr<IPCEcho> echo, blink::WebFrame* frame); |
23 | 23 |
24 explicit IPCEchoBindings(base::WeakPtr<IPCEcho>); | 24 explicit IPCEchoBindings(base::WeakPtr<IPCEcho>); |
25 | 25 |
26 void RequestEcho(int id, int size); | 26 void RequestEcho(int id, int size); |
27 int GetLastEchoId() const; | 27 int GetLastEchoId() const; |
28 int GetLastEchoSize() const; | 28 int GetLastEchoSize() const; |
29 | 29 |
30 private: | 30 private: |
31 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | 31 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( |
32 v8::Isolate*) OVERRIDE; | 32 v8::Isolate*) override; |
33 | 33 |
34 base::WeakPtr<IPCEcho> native_; | 34 base::WeakPtr<IPCEcho> native_; |
35 }; | 35 }; |
36 | 36 |
37 IPCEchoBindings::IPCEchoBindings(base::WeakPtr<IPCEcho> native) | 37 IPCEchoBindings::IPCEchoBindings(base::WeakPtr<IPCEcho> native) |
38 : native_(native) { | 38 : native_(native) { |
39 } | 39 } |
40 | 40 |
41 void IPCEchoBindings::RequestEcho(int id, int size) { | 41 void IPCEchoBindings::RequestEcho(int id, int size) { |
42 if (!native_) | 42 if (!native_) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 event.to<blink::WebDOMCustomEvent>().initCustomEvent( | 104 event.to<blink::WebDOMCustomEvent>().initCustomEvent( |
105 eventType, false, false, blink::WebSerializedScriptValue()); | 105 eventType, false, false, blink::WebSerializedScriptValue()); |
106 document_.dispatchEvent(event); | 106 document_.dispatchEvent(event); |
107 } | 107 } |
108 | 108 |
109 void IPCEcho::Install(blink::WebFrame* frame) { | 109 void IPCEcho::Install(blink::WebFrame* frame) { |
110 IPCEchoBindings::Install(weak_factory_.GetWeakPtr(), frame); | 110 IPCEchoBindings::Install(weak_factory_.GetWeakPtr(), frame); |
111 } | 111 } |
112 | 112 |
113 } // namespace content | 113 } // namespace content |
OLD | NEW |