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

Side by Side Diff: chrome/browser/debugger/debugger_remote_service.cc

Issue 3056029: Move the number conversions from string_util to a new file.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 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"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/string_util.h" 12 #include "base/string_number_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/debugger/devtools_manager.h" 15 #include "chrome/browser/debugger/devtools_manager.h"
16 #include "chrome/browser/debugger/devtools_protocol_handler.h" 16 #include "chrome/browser/debugger/devtools_protocol_handler.h"
17 #include "chrome/browser/debugger/devtools_remote_message.h" 17 #include "chrome/browser/debugger/devtools_remote_message.h"
18 #include "chrome/browser/debugger/inspectable_tab_proxy.h" 18 #include "chrome/browser/debugger/inspectable_tab_proxy.h"
19 #include "chrome/browser/renderer_host/render_view_host.h" 19 #include "chrome/browser/renderer_host/render_view_host.h"
20 #include "chrome/browser/tab_contents/tab_contents.h" 20 #include "chrome/browser/tab_contents/tab_contents.h"
21 #include "chrome/common/devtools_messages.h" 21 #include "chrome/common/devtools_messages.h"
22 #include "chrome/common/render_messages.h" 22 #include "chrome/common/render_messages.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 // Gets invoked from a DevToolsClientHost callback whenever 160 // Gets invoked from a DevToolsClientHost callback whenever
161 // a message from the V8 VM debugger corresponding to |tab_id| is received. 161 // a message from the V8 VM debugger corresponding to |tab_id| is received.
162 // Composes a Chrome Developer Tools Protocol JSON response and sends it 162 // Composes a Chrome Developer Tools Protocol JSON response and sends it
163 // to the remote debugger. 163 // to the remote debugger.
164 void DebuggerRemoteService::DebuggerOutput(int32 tab_uid, 164 void DebuggerRemoteService::DebuggerOutput(int32 tab_uid,
165 const std::string& message) { 165 const std::string& message) {
166 std::string content = StringPrintf( 166 std::string content = StringPrintf(
167 "{\"command\":\"%s\",\"result\":%s,\"data\":%s}", 167 "{\"command\":\"%s\",\"result\":%s,\"data\":%s}",
168 DebuggerRemoteServiceCommand::kDebuggerCommand.c_str(), 168 DebuggerRemoteServiceCommand::kDebuggerCommand.c_str(),
169 IntToString(RESULT_OK).c_str(), 169 base::IntToString(RESULT_OK).c_str(),
170 message.c_str()); 170 message.c_str());
171 scoped_ptr<DevToolsRemoteMessage> response_message( 171 scoped_ptr<DevToolsRemoteMessage> response_message(
172 DevToolsRemoteMessageBuilder::instance().Create( 172 DevToolsRemoteMessageBuilder::instance().Create(
173 kToolName, 173 kToolName,
174 IntToString(tab_uid), 174 base::IntToString(tab_uid),
175 content)); 175 content));
176 delegate_->Send(*(response_message.get())); 176 delegate_->Send(*(response_message.get()));
177 } 177 }
178 178
179 // Gets invoked from a DevToolsClientHost callback whenever 179 // Gets invoked from a DevToolsClientHost callback whenever
180 // a tab corresponding to |tab_id| changes its URL. |url| is the new 180 // a tab corresponding to |tab_id| changes its URL. |url| is the new
181 // URL of the tab (may be the same as the previous one if the tab is reloaded). 181 // URL of the tab (may be the same as the previous one if the tab is reloaded).
182 // Sends the corresponding message to the remote debugger. 182 // Sends the corresponding message to the remote debugger.
183 void DebuggerRemoteService::FrameNavigate(int32 tab_uid, 183 void DebuggerRemoteService::FrameNavigate(int32 tab_uid,
184 const std::string& url) { 184 const std::string& url) {
185 DictionaryValue value; 185 DictionaryValue value;
186 value.SetString(kCommandWide, DebuggerRemoteServiceCommand::kFrameNavigate); 186 value.SetString(kCommandWide, DebuggerRemoteServiceCommand::kFrameNavigate);
187 value.SetInteger(kResultWide, RESULT_OK); 187 value.SetInteger(kResultWide, RESULT_OK);
188 value.SetString(kDataWide, url); 188 value.SetString(kDataWide, url);
189 SendResponse(value, kToolName, IntToString(tab_uid)); 189 SendResponse(value, kToolName, base::IntToString(tab_uid));
190 } 190 }
191 191
192 // Gets invoked from a DevToolsClientHost callback whenever 192 // Gets invoked from a DevToolsClientHost callback whenever
193 // a tab corresponding to |tab_id| gets closed. 193 // a tab corresponding to |tab_id| gets closed.
194 // Sends the corresponding message to the remote debugger. 194 // Sends the corresponding message to the remote debugger.
195 void DebuggerRemoteService::TabClosed(int32 tab_id) { 195 void DebuggerRemoteService::TabClosed(int32 tab_id) {
196 DictionaryValue value; 196 DictionaryValue value;
197 value.SetString(kCommandWide, DebuggerRemoteServiceCommand::kTabClosed); 197 value.SetString(kCommandWide, DebuggerRemoteServiceCommand::kTabClosed);
198 value.SetInteger(kResultWide, RESULT_OK); 198 value.SetInteger(kResultWide, RESULT_OK);
199 SendResponse(value, kToolName, IntToString(tab_id)); 199 SendResponse(value, kToolName, base::IntToString(tab_id));
200 } 200 }
201 201
202 // Attaches a remote debugger to the target tab specified by |destination| 202 // Attaches a remote debugger to the target tab specified by |destination|
203 // by posting the DevToolsAgentMsg_Attach message and sends a response 203 // by posting the DevToolsAgentMsg_Attach message and sends a response
204 // to the remote debugger immediately. 204 // to the remote debugger immediately.
205 void DebuggerRemoteService::AttachToTab(const std::string& destination, 205 void DebuggerRemoteService::AttachToTab(const std::string& destination,
206 DictionaryValue* response) { 206 DictionaryValue* response) {
207 int32 tab_uid = -1; 207 int32 tab_uid = -1;
208 StringToInt(destination, &tab_uid); 208 StringToInt(destination, &tab_uid);
209 if (tab_uid < 0) { 209 if (tab_uid < 0) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 return true; 338 return true;
339 } 339 }
340 std::wstring javascript; 340 std::wstring javascript;
341 content->GetString(kDataWide, &javascript); 341 content->GetString(kDataWide, &javascript);
342 render_view_host->Send( 342 render_view_host->Send(
343 new ViewMsg_ScriptEvalRequest(render_view_host->routing_id(), 343 new ViewMsg_ScriptEvalRequest(render_view_host->routing_id(),
344 L"", 344 L"",
345 javascript)); 345 javascript));
346 return false; 346 return false;
347 } 347 }
OLDNEW
« no previous file with comments | « chrome/browser/config_dir_policy_provider_unittest.cc ('k') | chrome/browser/debugger/devtools_remote_listen_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698