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

Side by Side Diff: chrome/browser/debugger/extension_ports_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) 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 // Implementation of the ExtensionPortsRemoteService. 5 // Implementation of the ExtensionPortsRemoteService.
6 6
7 // Inspired significantly from debugger_remote_service 7 // Inspired significantly from debugger_remote_service
8 // and ../automation/extension_port_container. 8 // and ../automation/extension_port_container.
9 9
10 #include "chrome/browser/debugger/extension_ports_remote_service.h" 10 #include "chrome/browser/debugger/extension_ports_remote_service.h"
11 11
12 #include "base/json/json_reader.h" 12 #include "base/json/json_reader.h"
13 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/string_util.h" 15 #include "base/string_number_conversions.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/debugger/devtools_manager.h" 18 #include "chrome/browser/debugger/devtools_manager.h"
19 #include "chrome/browser/debugger/devtools_protocol_handler.h" 19 #include "chrome/browser/debugger/devtools_protocol_handler.h"
20 #include "chrome/browser/debugger/devtools_remote_message.h" 20 #include "chrome/browser/debugger/devtools_remote_message.h"
21 #include "chrome/browser/debugger/inspectable_tab_proxy.h" 21 #include "chrome/browser/debugger/inspectable_tab_proxy.h"
22 #include "chrome/browser/profile.h" 22 #include "chrome/browser/profile.h"
23 #include "chrome/browser/profile_manager.h" 23 #include "chrome/browser/profile_manager.h"
24 #include "chrome/browser/tab_contents/tab_contents.h" 24 #include "chrome/browser/tab_contents/tab_contents.h"
25 #include "chrome/common/devtools_messages.h" 25 #include "chrome/common/devtools_messages.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 DictionaryValue content; 273 DictionaryValue content;
274 content.SetString(kCommandWide, kOnMessage); 274 content.SetString(kCommandWide, kOnMessage);
275 content.SetInteger(kResultWide, RESULT_OK); 275 content.SetInteger(kResultWide, RESULT_OK);
276 // Turn the stringified message body back into JSON. 276 // Turn the stringified message body back into JSON.
277 Value* data = base::JSONReader::Read(message, false); 277 Value* data = base::JSONReader::Read(message, false);
278 if (!data) { 278 if (!data) {
279 NOTREACHED(); 279 NOTREACHED();
280 return; 280 return;
281 } 281 }
282 content.Set(kDataWide, data); 282 content.Set(kDataWide, data);
283 SendResponse(content, kToolName, IntToString(port_id)); 283 SendResponse(content, kToolName, base::IntToString(port_id));
284 } 284 }
285 285
286 void ExtensionPortsRemoteService::OnExtensionPortDisconnected(int port_id) { 286 void ExtensionPortsRemoteService::OnExtensionPortDisconnected(int port_id) {
287 LOG(INFO) << "Disconnect event for port " << port_id; 287 LOG(INFO) << "Disconnect event for port " << port_id;
288 openPortIds_.erase(port_id); 288 openPortIds_.erase(port_id);
289 DictionaryValue content; 289 DictionaryValue content;
290 content.SetString(kCommandWide, kOnDisconnect); 290 content.SetString(kCommandWide, kOnDisconnect);
291 content.SetInteger(kResultWide, RESULT_OK); 291 content.SetInteger(kResultWide, RESULT_OK);
292 SendResponse(content, kToolName, IntToString(port_id)); 292 SendResponse(content, kToolName, base::IntToString(port_id));
293 } 293 }
294 294
295 void ExtensionPortsRemoteService::ConnectCommand( 295 void ExtensionPortsRemoteService::ConnectCommand(
296 DictionaryValue* content, DictionaryValue* response) { 296 DictionaryValue* content, DictionaryValue* response) {
297 // Parse out the parameters. 297 // Parse out the parameters.
298 DictionaryValue* data; 298 DictionaryValue* data;
299 if (!content->GetDictionary(kDataWide, &data)) { 299 if (!content->GetDictionary(kDataWide, &data)) {
300 response->SetInteger(kResultWide, RESULT_PARAMETER_ERROR); 300 response->SetInteger(kResultWide, RESULT_PARAMETER_ERROR);
301 return; 301 return;
302 } 302 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 LOG(INFO) << "unknown port: " << port_id; 385 LOG(INFO) << "unknown port: " << port_id;
386 response->SetInteger(kResultWide, RESULT_UNKNOWN_PORT); 386 response->SetInteger(kResultWide, RESULT_UNKNOWN_PORT);
387 return; 387 return;
388 } 388 }
389 // Post the message through the ExtensionMessageService. 389 // Post the message through the ExtensionMessageService.
390 DCHECK(service_); 390 DCHECK(service_);
391 service_->PostMessageFromRenderer(port_id, message); 391 service_->PostMessageFromRenderer(port_id, message);
392 // Confirm to the external client that we sent its message. 392 // Confirm to the external client that we sent its message.
393 response->SetInteger(kResultWide, RESULT_OK); 393 response->SetInteger(kResultWide, RESULT_OK);
394 } 394 }
OLDNEW
« no previous file with comments | « chrome/browser/debugger/devtools_remote_message_unittest.cc ('k') | chrome/browser/diagnostics/recon_diagnostics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698