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 // 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 if (!content->HasKey(kCommandKey)) { | 72 if (!content->HasKey(kCommandKey)) { |
73 NOTREACHED(); // Broken protocol :( | 73 NOTREACHED(); // Broken protocol :( |
74 return; | 74 return; |
75 } | 75 } |
76 std::string command; | 76 std::string command; |
77 DictionaryValue response; | 77 DictionaryValue response; |
78 | 78 |
79 content->GetString(kCommandKey, &command); | 79 content->GetString(kCommandKey, &command); |
80 response.SetString(kCommandKey, command); | 80 response.SetString(kCommandKey, command); |
81 bool send_response = true; | 81 bool send_response = true; |
82 if (destination.size() == 0) { | 82 if (destination.empty()) { |
83 // Unknown command (bad format?) | 83 // Unknown command (bad format?) |
84 NOTREACHED(); | 84 NOTREACHED(); |
85 response.SetInteger(kResultKey, RESULT_UNKNOWN_COMMAND); | 85 response.SetInteger(kResultKey, RESULT_UNKNOWN_COMMAND); |
86 SendResponse(response, message.tool(), message.destination()); | 86 SendResponse(response, message.tool(), message.destination()); |
87 return; | 87 return; |
88 } | 88 } |
89 int32 tab_uid = -1; | 89 int32 tab_uid = -1; |
90 base::StringToInt(destination, &tab_uid); | 90 base::StringToInt(destination, &tab_uid); |
91 | 91 |
92 if (command == DebuggerRemoteServiceCommand::kAttach) { | 92 if (command == DebuggerRemoteServiceCommand::kAttach) { |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // No RenderViewHost | 327 // No RenderViewHost |
328 response->SetInteger(kResultKey, RESULT_UNKNOWN_TAB); | 328 response->SetInteger(kResultKey, RESULT_UNKNOWN_TAB); |
329 return true; | 329 return true; |
330 } | 330 } |
331 std::string javascript; | 331 std::string javascript; |
332 content->GetString(kDataKey, &javascript); | 332 content->GetString(kDataKey, &javascript); |
333 render_view_host->ExecuteJavascriptInWebFrame(string16(), | 333 render_view_host->ExecuteJavascriptInWebFrame(string16(), |
334 UTF8ToUTF16(javascript)); | 334 UTF8ToUTF16(javascript)); |
335 return false; | 335 return false; |
336 } | 336 } |
OLD | NEW |