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

Side by Side Diff: remoting/client/plugin/chromoting_instance.cc

Issue 9960077: Modify the base::JSONReader interface to take a set of options rather than a boolean flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/client/plugin/chromoting_instance.h" 5 #include "remoting/client/plugin/chromoting_instance.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 return true; 209 return true;
210 } 210 }
211 211
212 void ChromotingInstance::HandleMessage(const pp::Var& message) { 212 void ChromotingInstance::HandleMessage(const pp::Var& message) {
213 if (!message.is_string()) { 213 if (!message.is_string()) {
214 LOG(ERROR) << "Received a message that is not a string."; 214 LOG(ERROR) << "Received a message that is not a string.";
215 return; 215 return;
216 } 216 }
217 217
218 scoped_ptr<base::Value> json( 218 scoped_ptr<base::Value> json(
219 base::JSONReader::Read(message.AsString(), true)); 219 base::JSONReader::Read(message.AsString(),
220 base::JSON_ALLOW_TRAILING_COMMAS));
220 base::DictionaryValue* message_dict = NULL; 221 base::DictionaryValue* message_dict = NULL;
221 std::string method; 222 std::string method;
222 base::DictionaryValue* data = NULL; 223 base::DictionaryValue* data = NULL;
223 if (!json.get() || 224 if (!json.get() ||
224 !json->GetAsDictionary(&message_dict) || 225 !json->GetAsDictionary(&message_dict) ||
225 !message_dict->GetString("method", &method) || 226 !message_dict->GetString("method", &method) ||
226 !message_dict->GetDictionary("data", &data)) { 227 !message_dict->GetDictionary("data", &data)) {
227 LOG(ERROR) << "Received invalid message:" << message.AsString(); 228 LOG(ERROR) << "Received invalid message:" << message.AsString();
228 return; 229 return;
229 } 230 }
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); 628 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
628 data->SetString("message", message); 629 data->SetString("message", message);
629 PostChromotingMessage("logDebugMessage", data.Pass()); 630 PostChromotingMessage("logDebugMessage", data.Pass());
630 631
631 scriptable_object->LogDebugInfo(message); 632 scriptable_object->LogDebugInfo(message);
632 } 633 }
633 g_logging_to_plugin = false; 634 g_logging_to_plugin = false;
634 } 635 }
635 636
636 } // namespace remoting 637 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698