| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file contains implementations of the DebuggerRemoteService methods, | 5 // This file contains implementations of the DebuggerRemoteService methods, |
| 6 // defines DebuggerRemoteService and DebuggerRemoteServiceCommand constants. | 6 // defines DebuggerRemoteService and DebuggerRemoteServiceCommand constants. |
| 7 | 7 |
| 8 #include "chrome/browser/debugger/debugger_remote_service.h" | 8 #include "chrome/browser/debugger/debugger_remote_service.h" |
| 9 | 9 |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 void DebuggerRemoteService::HandleMessage( | 58 void DebuggerRemoteService::HandleMessage( |
| 59 const DevToolsRemoteMessage& message) { | 59 const DevToolsRemoteMessage& message) { |
| 60 const std::string destination = message.destination(); | 60 const std::string destination = message.destination(); |
| 61 scoped_ptr<Value> request(base::JSONReader::Read(message.content(), true)); | 61 scoped_ptr<Value> request(base::JSONReader::Read(message.content(), true)); |
| 62 if (request.get() == NULL) { | 62 if (request.get() == NULL) { |
| 63 // Bad JSON | 63 // Bad JSON |
| 64 NOTREACHED(); | 64 NOTREACHED(); |
| 65 return; | 65 return; |
| 66 } | 66 } |
| 67 DictionaryValue* content; | 67 DictionaryValue* content; |
| 68 if (!request->IsType(Value::TYPE_DICTIONARY)) { | 68 if (!request->IsDictionary()) { |
| 69 NOTREACHED(); // Broken protocol :( | 69 NOTREACHED(); // Broken protocol :( |
| 70 return; | 70 return; |
| 71 } | 71 } |
| 72 content = static_cast<DictionaryValue*>(request.get()); | 72 content = static_cast<DictionaryValue*>(request.get()); |
| 73 if (!content->HasKey(kCommandKey)) { | 73 if (!content->HasKey(kCommandKey)) { |
| 74 NOTREACHED(); // Broken protocol :( | 74 NOTREACHED(); // Broken protocol :( |
| 75 return; | 75 return; |
| 76 } | 76 } |
| 77 std::string command; | 77 std::string command; |
| 78 DictionaryValue response; | 78 DictionaryValue response; |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 // No RenderViewHost | 328 // No RenderViewHost |
| 329 response->SetInteger(kResultKey, RESULT_UNKNOWN_TAB); | 329 response->SetInteger(kResultKey, RESULT_UNKNOWN_TAB); |
| 330 return true; | 330 return true; |
| 331 } | 331 } |
| 332 std::string javascript; | 332 std::string javascript; |
| 333 content->GetString(kDataKey, &javascript); | 333 content->GetString(kDataKey, &javascript); |
| 334 render_view_host->ExecuteJavascriptInWebFrame(string16(), | 334 render_view_host->ExecuteJavascriptInWebFrame(string16(), |
| 335 UTF8ToUTF16(javascript)); | 335 UTF8ToUTF16(javascript)); |
| 336 return false; | 336 return false; |
| 337 } | 337 } |
| OLD | NEW |