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

Side by Side Diff: chrome/browser/debugger/debugger_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 // 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"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 void DebuggerRemoteService::HandleMessage( 58 void DebuggerRemoteService::HandleMessage(
59 const DevToolsRemoteMessage& message) { 59 const DevToolsRemoteMessage& message) {
60 const std::string destination = message.destination(); 60 const std::string destination = message.destination();
61 scoped_ptr<Value> request(base::JSONReader::Read(message.content(), true)); 61 scoped_ptr<Value> request(base::JSONReader::Read(message.content(), true));
62 if (request.get() == NULL) { 62 if (request.get() == NULL) {
63 // Bad JSON 63 // Bad JSON
64 NOTREACHED(); 64 NOTREACHED();
65 return; 65 return;
66 } 66 }
67 DictionaryValue* content; 67 DictionaryValue* content;
68 if (!request->IsType(Value::TYPE_DICTIONARY)) { 68 if (!request->IsDictionary()) {
69 NOTREACHED(); // Broken protocol :( 69 NOTREACHED(); // Broken protocol :(
70 return; 70 return;
71 } 71 }
72 content = static_cast<DictionaryValue*>(request.get()); 72 content = static_cast<DictionaryValue*>(request.get());
73 if (!content->HasKey(kCommandKey)) { 73 if (!content->HasKey(kCommandKey)) {
74 NOTREACHED(); // Broken protocol :( 74 NOTREACHED(); // Broken protocol :(
75 return; 75 return;
76 } 76 }
77 std::string command; 77 std::string command;
78 DictionaryValue response; 78 DictionaryValue response;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // No RenderViewHost 328 // No RenderViewHost
329 response->SetInteger(kResultKey, RESULT_UNKNOWN_TAB); 329 response->SetInteger(kResultKey, RESULT_UNKNOWN_TAB);
330 return true; 330 return true;
331 } 331 }
332 std::string javascript; 332 std::string javascript;
333 content->GetString(kDataKey, &javascript); 333 content->GetString(kDataKey, &javascript);
334 render_view_host->ExecuteJavascriptInWebFrame(string16(), 334 render_view_host->ExecuteJavascriptInWebFrame(string16(),
335 UTF8ToUTF16(javascript)); 335 UTF8ToUTF16(javascript));
336 return false; 336 return false;
337 } 337 }
OLDNEW
« no previous file with comments | « chrome/browser/component_updater/component_unpacker.cc ('k') | chrome/browser/debugger/devtools_remote_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698