OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/automation/extension_port_container.h" | 5 #include "chrome/browser/automation/extension_port_container.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 const ListValue& args, | 112 const ListValue& args, |
113 const GURL& event_url) { | 113 const GURL& event_url) { |
114 if (function_name == ExtensionMessageService::kDispatchOnMessage) { | 114 if (function_name == ExtensionMessageService::kDispatchOnMessage) { |
115 DCHECK_EQ(args.GetSize(), 2u); | 115 DCHECK_EQ(args.GetSize(), 2u); |
116 | 116 |
117 std::string message; | 117 std::string message; |
118 int source_port_id; | 118 int source_port_id; |
119 if (args.GetString(0, &message) && args.GetInteger(1, &source_port_id)) | 119 if (args.GetString(0, &message) && args.GetInteger(1, &source_port_id)) |
120 OnExtensionHandleMessage(message, source_port_id); | 120 OnExtensionHandleMessage(message, source_port_id); |
121 } else if (function_name == ExtensionMessageService::kDispatchOnDisconnect) { | 121 } else if (function_name == ExtensionMessageService::kDispatchOnDisconnect) { |
122 DCHECK_EQ(args.GetSize(), 1u); | 122 DCHECK_EQ(args.GetSize(), 2u); |
123 int port_id; | 123 int port_id; |
124 if (args.GetInteger(0, &port_id)) | 124 if (args.GetInteger(0, &port_id)) |
125 OnExtensionPortDisconnected(port_id); | 125 OnExtensionPortDisconnected(port_id); |
126 } else if (function_name == ExtensionMessageService::kDispatchOnConnect) { | 126 } else if (function_name == ExtensionMessageService::kDispatchOnConnect) { |
127 // Do nothing. | 127 // Do nothing. |
128 // TODO(siggi): implement | 128 // TODO(siggi): implement |
129 } else { | 129 } else { |
130 NOTREACHED() << function_name << " shouldn't be called."; | 130 NOTREACHED() << function_name << " shouldn't be called."; |
131 } | 131 } |
132 } | 132 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // This will delete the port and notify the other end of the disconnect. | 252 // This will delete the port and notify the other end of the disconnect. |
253 automation->RemovePortContainer(port); | 253 automation->RemovePortContainer(port); |
254 } | 254 } |
255 } else { | 255 } else { |
256 // We don't expect other messages here. | 256 // We don't expect other messages here. |
257 NOTREACHED(); | 257 NOTREACHED(); |
258 } | 258 } |
259 | 259 |
260 return true; | 260 return true; |
261 } | 261 } |
OLD | NEW |