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

Side by Side Diff: chrome/browser/debugger/extension_ports_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 // 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"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 const DevToolsRemoteMessage& message) { 141 const DevToolsRemoteMessage& message) {
142 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); 142 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI);
143 const std::string destinationString = message.destination(); 143 const std::string destinationString = message.destination();
144 scoped_ptr<Value> request(base::JSONReader::Read(message.content(), true)); 144 scoped_ptr<Value> request(base::JSONReader::Read(message.content(), true));
145 if (request.get() == NULL) { 145 if (request.get() == NULL) {
146 // Bad JSON 146 // Bad JSON
147 NOTREACHED(); 147 NOTREACHED();
148 return; 148 return;
149 } 149 }
150 DictionaryValue* content; 150 DictionaryValue* content;
151 if (!request->IsType(Value::TYPE_DICTIONARY)) { 151 if (!request->IsDictionary()) {
152 NOTREACHED(); // Broken protocol :( 152 NOTREACHED(); // Broken protocol :(
153 return; 153 return;
154 } 154 }
155 content = static_cast<DictionaryValue*>(request.get()); 155 content = static_cast<DictionaryValue*>(request.get());
156 if (!content->HasKey(kCommandKey)) { 156 if (!content->HasKey(kCommandKey)) {
157 NOTREACHED(); // Broken protocol :( 157 NOTREACHED(); // Broken protocol :(
158 return; 158 return;
159 } 159 }
160 std::string command; 160 std::string command;
161 DictionaryValue response; 161 DictionaryValue response;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 VLOG(1) << "unknown port: " << port_id; 376 VLOG(1) << "unknown port: " << port_id;
377 response->SetInteger(kResultKey, RESULT_UNKNOWN_PORT); 377 response->SetInteger(kResultKey, RESULT_UNKNOWN_PORT);
378 return; 378 return;
379 } 379 }
380 // Post the message through the ExtensionMessageService. 380 // Post the message through the ExtensionMessageService.
381 DCHECK(service_); 381 DCHECK(service_);
382 service_->PostMessageFromRenderer(port_id, message); 382 service_->PostMessageFromRenderer(port_id, message);
383 // Confirm to the external client that we sent its message. 383 // Confirm to the external client that we sent its message.
384 response->SetInteger(kResultKey, RESULT_OK); 384 response->SetInteger(kResultKey, RESULT_OK);
385 } 385 }
OLDNEW
« no previous file with comments | « chrome/browser/debugger/devtools_remote_service.cc ('k') | chrome/browser/extensions/execute_code_in_tab_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698