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

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

Issue 7661009: base: Add Is* functions to Value class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tony review Created 9 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) 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 #include "chrome/browser/debugger/devtools_remote_service.h" 5 #include "chrome/browser/debugger/devtools_remote_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 28 matching lines...) Expand all
39 39
40 void DevToolsRemoteService::HandleMessage( 40 void DevToolsRemoteService::HandleMessage(
41 const DevToolsRemoteMessage& message) { 41 const DevToolsRemoteMessage& message) {
42 scoped_ptr<Value> request(base::JSONReader::Read(message.content(), false)); 42 scoped_ptr<Value> request(base::JSONReader::Read(message.content(), false));
43 if (request.get() == NULL) { 43 if (request.get() == NULL) {
44 // Bad JSON 44 // Bad JSON
45 NOTREACHED(); 45 NOTREACHED();
46 return; 46 return;
47 } 47 }
48 DictionaryValue* json; 48 DictionaryValue* json;
49 if (request->IsType(Value::TYPE_DICTIONARY)) { 49 if (request->IsDictionary()) {
50 json = static_cast<DictionaryValue*>(request.get()); 50 json = static_cast<DictionaryValue*>(request.get());
51 if (!json->HasKey(kCommandKey)) { 51 if (!json->HasKey(kCommandKey)) {
52 NOTREACHED(); // Broken protocol - no "command" specified 52 NOTREACHED(); // Broken protocol - no "command" specified
53 return; 53 return;
54 } 54 }
55 } else { 55 } else {
56 NOTREACHED(); // Broken protocol - not a JS object 56 NOTREACHED(); // Broken protocol - not a JS object
57 return; 57 return;
58 } 58 }
59 ProcessJson(json, message); 59 ProcessJson(json, message);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 response.SetInteger(kResultKey, Result::kUnknownCommand); 101 response.SetInteger(kResultKey, Result::kUnknownCommand);
102 } 102 }
103 std::string response_json; 103 std::string response_json;
104 base::JSONWriter::Write(&response, false, &response_json); 104 base::JSONWriter::Write(&response, false, &response_json);
105 scoped_ptr<DevToolsRemoteMessage> response_message( 105 scoped_ptr<DevToolsRemoteMessage> response_message(
106 DevToolsRemoteMessageBuilder::instance().Create(message.tool(), 106 DevToolsRemoteMessageBuilder::instance().Create(message.tool(),
107 message.destination(), 107 message.destination(),
108 response_json)); 108 response_json));
109 delegate_->Send(*response_message.get()); 109 delegate_->Send(*response_message.get());
110 } 110 }
OLDNEW
« no previous file with comments | « chrome/browser/debugger/debugger_remote_service.cc ('k') | chrome/browser/debugger/extension_ports_remote_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698