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

Side by Side Diff: android_webview/renderer/aw_message_port_client.cc

Issue 956763002: Implement the close() API for Message ports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address Nasko review Created 5 years, 10 months 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
OLDNEW
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 "android_webview/common/aw_message_port_messages.h" 7 #include "android_webview/common/aw_message_port_messages.h"
8 #include "content/public/child/v8_value_converter.h" 8 #include "content/public/child/v8_value_converter.h"
9 #include "content/public/renderer/render_frame.h" 9 #include "content/public/renderer/render_frame.h"
10 #include "content/public/renderer/render_view.h" 10 #include "content/public/renderer/render_view.h"
(...skipping 16 matching lines...) Expand all
27 27
28 AwMessagePortClient::~AwMessagePortClient() { 28 AwMessagePortClient::~AwMessagePortClient() {
29 } 29 }
30 30
31 bool AwMessagePortClient::OnMessageReceived( 31 bool AwMessagePortClient::OnMessageReceived(
32 const IPC::Message& message) { 32 const IPC::Message& message) {
33 bool handled = true; 33 bool handled = true;
34 IPC_BEGIN_MESSAGE_MAP(AwMessagePortClient, message) 34 IPC_BEGIN_MESSAGE_MAP(AwMessagePortClient, message)
35 IPC_MESSAGE_HANDLER(AwMessagePortMsg_WebToAppMessage, OnWebToAppMessage) 35 IPC_MESSAGE_HANDLER(AwMessagePortMsg_WebToAppMessage, OnWebToAppMessage)
36 IPC_MESSAGE_HANDLER(AwMessagePortMsg_AppToWebMessage, OnAppToWebMessage) 36 IPC_MESSAGE_HANDLER(AwMessagePortMsg_AppToWebMessage, OnAppToWebMessage)
37 IPC_MESSAGE_HANDLER(AwMessagePortMsg_ClosePort, OnClosePort)
37 IPC_MESSAGE_UNHANDLED(handled = false) 38 IPC_MESSAGE_UNHANDLED(handled = false)
38 IPC_END_MESSAGE_MAP() 39 IPC_END_MESSAGE_MAP()
39 40
40 return handled; 41 return handled;
41 } 42 }
42 43
43 void AwMessagePortClient::OnWebToAppMessage( 44 void AwMessagePortClient::OnWebToAppMessage(
44 int message_port_id, 45 int message_port_id,
45 const base::string16& message, 46 const base::string16& message,
46 const vector<int>& sent_message_port_ids) { 47 const vector<int>& sent_message_port_ids) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 v8::Handle<v8::Value> result_value = converter->ToV8Value(value.get(), 89 v8::Handle<v8::Value> result_value = converter->ToV8Value(value.get(),
89 context); 90 context);
90 WebSerializedScriptValue serialized_script_value = 91 WebSerializedScriptValue serialized_script_value =
91 WebSerializedScriptValue::serialize(result_value); 92 WebSerializedScriptValue::serialize(result_value);
92 base::string16 result = serialized_script_value.toString(); 93 base::string16 result = serialized_script_value.toString();
93 Send(new AwMessagePortHostMsg_ConvertedAppToWebMessage( 94 Send(new AwMessagePortHostMsg_ConvertedAppToWebMessage(
94 render_frame()->GetRoutingID(), message_port_id, 95 render_frame()->GetRoutingID(), message_port_id,
95 result, sent_message_port_ids)); 96 result, sent_message_port_ids));
96 } 97 }
97 98
99 void AwMessagePortClient::OnClosePort(int message_port_id) {
100 Send(new AwMessagePortHostMsg_ClosePortAck(render_frame()->GetRoutingID(),
101 message_port_id));
98 } 102 }
103
104 }
OLDNEW
« no previous file with comments | « android_webview/renderer/aw_message_port_client.h ('k') | content/browser/message_port_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698