| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "android_webview/renderer/aw_message_port_client.h" | 5 #include "android_webview/renderer/aw_message_port_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "android_webview/common/aw_message_port_messages.h" | 10 #include "android_webview/common/aw_message_port_messages.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 IPC_BEGIN_MESSAGE_MAP(AwMessagePortClient, message) | 37 IPC_BEGIN_MESSAGE_MAP(AwMessagePortClient, message) |
| 38 IPC_MESSAGE_HANDLER(AwMessagePortMsg_WebToAppMessage, OnWebToAppMessage) | 38 IPC_MESSAGE_HANDLER(AwMessagePortMsg_WebToAppMessage, OnWebToAppMessage) |
| 39 IPC_MESSAGE_HANDLER(AwMessagePortMsg_AppToWebMessage, OnAppToWebMessage) | 39 IPC_MESSAGE_HANDLER(AwMessagePortMsg_AppToWebMessage, OnAppToWebMessage) |
| 40 IPC_MESSAGE_HANDLER(AwMessagePortMsg_ClosePort, OnClosePort) | 40 IPC_MESSAGE_HANDLER(AwMessagePortMsg_ClosePort, OnClosePort) |
| 41 IPC_MESSAGE_UNHANDLED(handled = false) | 41 IPC_MESSAGE_UNHANDLED(handled = false) |
| 42 IPC_END_MESSAGE_MAP() | 42 IPC_END_MESSAGE_MAP() |
| 43 | 43 |
| 44 return handled; | 44 return handled; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void AwMessagePortClient::OnDestruct() { |
| 48 delete this; |
| 49 } |
| 50 |
| 47 void AwMessagePortClient::OnWebToAppMessage( | 51 void AwMessagePortClient::OnWebToAppMessage( |
| 48 int message_port_id, | 52 int message_port_id, |
| 49 const base::string16& message, | 53 const base::string16& message, |
| 50 const vector<int>& sent_message_port_ids) { | 54 const vector<int>& sent_message_port_ids) { |
| 51 v8::HandleScope handle_scope(blink::mainThreadIsolate()); | 55 v8::HandleScope handle_scope(blink::mainThreadIsolate()); |
| 52 blink::WebFrame* main_frame = | 56 blink::WebFrame* main_frame = |
| 53 render_frame()->GetRenderView()->GetWebView()->mainFrame(); | 57 render_frame()->GetRenderView()->GetWebView()->mainFrame(); |
| 54 if (main_frame == nullptr) { | 58 if (main_frame == nullptr) { |
| 55 return; | 59 return; |
| 56 } | 60 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 render_frame()->GetRoutingID(), message_port_id, | 106 render_frame()->GetRoutingID(), message_port_id, |
| 103 result, sent_message_port_ids)); | 107 result, sent_message_port_ids)); |
| 104 } | 108 } |
| 105 | 109 |
| 106 void AwMessagePortClient::OnClosePort(int message_port_id) { | 110 void AwMessagePortClient::OnClosePort(int message_port_id) { |
| 107 Send(new AwMessagePortHostMsg_ClosePortAck(render_frame()->GetRoutingID(), | 111 Send(new AwMessagePortHostMsg_ClosePortAck(render_frame()->GetRoutingID(), |
| 108 message_port_id)); | 112 message_port_id)); |
| 109 } | 113 } |
| 110 | 114 |
| 111 } | 115 } |
| OLD | NEW |