OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/devtools/devtools_embedder_message_dispatcher.h" | 5 #include "chrome/browser/devtools/devtools_embedder_message_dispatcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 * | 148 * |
149 * The messages are sent via InspectorFrontendHost.sendMessageToEmbedder or | 149 * The messages are sent via InspectorFrontendHost.sendMessageToEmbedder or |
150 * chrome.send method accordingly. | 150 * chrome.send method accordingly. |
151 */ | 151 */ |
152 class DispatcherImpl : public DevToolsEmbedderMessageDispatcher { | 152 class DispatcherImpl : public DevToolsEmbedderMessageDispatcher { |
153 public: | 153 public: |
154 virtual ~DispatcherImpl() {} | 154 virtual ~DispatcherImpl() {} |
155 | 155 |
156 virtual bool Dispatch(const std::string& method, | 156 virtual bool Dispatch(const std::string& method, |
157 const base::ListValue* params, | 157 const base::ListValue* params, |
158 std::string* error) OVERRIDE { | 158 std::string* error) override { |
159 HandlerMap::iterator it = handlers_.find(method); | 159 HandlerMap::iterator it = handlers_.find(method); |
160 if (it == handlers_.end()) | 160 if (it == handlers_.end()) |
161 return false; | 161 return false; |
162 | 162 |
163 if (it->second.Run(*params)) | 163 if (it->second.Run(*params)) |
164 return true; | 164 return true; |
165 | 165 |
166 if (error) | 166 if (error) |
167 *error = "Invalid frontend host message parameters: " + method; | 167 *error = "Invalid frontend host message parameters: " + method; |
168 return false; | 168 return false; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 d->RegisterHandler("openUrlOnRemoteDeviceAndInspect", | 255 d->RegisterHandler("openUrlOnRemoteDeviceAndInspect", |
256 &Delegate::OpenUrlOnRemoteDeviceAndInspect, delegate); | 256 &Delegate::OpenUrlOnRemoteDeviceAndInspect, delegate); |
257 d->RegisterHandler("setDeviceCountUpdatesEnabled", | 257 d->RegisterHandler("setDeviceCountUpdatesEnabled", |
258 &Delegate::SetDeviceCountUpdatesEnabled, delegate); | 258 &Delegate::SetDeviceCountUpdatesEnabled, delegate); |
259 d->RegisterHandler("setDevicesUpdatesEnabled", | 259 d->RegisterHandler("setDevicesUpdatesEnabled", |
260 &Delegate::SetDevicesUpdatesEnabled, delegate); | 260 &Delegate::SetDevicesUpdatesEnabled, delegate); |
261 d->RegisterHandler("sendMessageToBrowser", | 261 d->RegisterHandler("sendMessageToBrowser", |
262 &Delegate::SendMessageToBrowser, delegate); | 262 &Delegate::SendMessageToBrowser, delegate); |
263 return d; | 263 return d; |
264 } | 264 } |
OLD | NEW |