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

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

Issue 7826038: Get rid of some static initializers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 14 matching lines...) Expand all
25 25
26 namespace { 26 namespace {
27 27
28 // Constants for the "data", "result", and "command" JSON message fields. 28 // Constants for the "data", "result", and "command" JSON message fields.
29 const char kDataKey[] = "data"; 29 const char kDataKey[] = "data";
30 const char kResultKey[] = "result"; 30 const char kResultKey[] = "result";
31 const char kCommandKey[] = "command"; 31 const char kCommandKey[] = "command";
32 32
33 } // namespace 33 } // namespace
34 34
35 const std::string DebuggerRemoteServiceCommand::kAttach = "attach"; 35 const char* const DebuggerRemoteServiceCommand::kAttach = "attach";
36 const std::string DebuggerRemoteServiceCommand::kDetach = "detach"; 36 const char* const DebuggerRemoteServiceCommand::kDetach = "detach";
37 const std::string DebuggerRemoteServiceCommand::kDebuggerCommand = 37 const char* const DebuggerRemoteServiceCommand::kDebuggerCommand =
38 "debugger_command"; 38 "debugger_command";
39 const std::string DebuggerRemoteServiceCommand::kEvaluateJavascript = 39 const char* const DebuggerRemoteServiceCommand::kEvaluateJavascript =
40 "evaluate_javascript"; 40 "evaluate_javascript";
41 const std::string DebuggerRemoteServiceCommand::kFrameNavigate = 41 const char* const DebuggerRemoteServiceCommand::kFrameNavigate =
42 "navigated"; 42 "navigated";
43 const std::string DebuggerRemoteServiceCommand::kTabClosed = 43 const char* const DebuggerRemoteServiceCommand::kTabClosed =
44 "closed"; 44 "closed";
45 45
46 const std::string DebuggerRemoteService::kToolName = "V8Debugger"; 46 const std::string DebuggerRemoteService::kToolName = "V8Debugger";
47 47
48 DebuggerRemoteService::DebuggerRemoteService(DevToolsProtocolHandler* delegate) 48 DebuggerRemoteService::DebuggerRemoteService(DevToolsProtocolHandler* delegate)
49 : delegate_(delegate) {} 49 : delegate_(delegate) {}
50 50
51 DebuggerRemoteService::~DebuggerRemoteService() {} 51 DebuggerRemoteService::~DebuggerRemoteService() {}
52 52
53 // This method handles the V8Debugger tool commands which are 53 // This method handles the V8Debugger tool commands which are
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 150
151 // Gets invoked from a DevToolsClientHost callback whenever 151 // Gets invoked from a DevToolsClientHost callback whenever
152 // a message from the V8 VM debugger corresponding to |tab_id| is received. 152 // a message from the V8 VM debugger corresponding to |tab_id| is received.
153 // Composes a Chrome Developer Tools Protocol JSON response and sends it 153 // Composes a Chrome Developer Tools Protocol JSON response and sends it
154 // to the remote debugger. 154 // to the remote debugger.
155 void DebuggerRemoteService::DebuggerOutput(int32 tab_uid, 155 void DebuggerRemoteService::DebuggerOutput(int32 tab_uid,
156 const std::string& message) { 156 const std::string& message) {
157 std::string content = StringPrintf( 157 std::string content = StringPrintf(
158 "{\"command\":\"%s\",\"result\":%s,\"data\":%s}", 158 "{\"command\":\"%s\",\"result\":%s,\"data\":%s}",
159 DebuggerRemoteServiceCommand::kDebuggerCommand.c_str(), 159 DebuggerRemoteServiceCommand::kDebuggerCommand,
160 base::IntToString(RESULT_OK).c_str(), 160 base::IntToString(RESULT_OK).c_str(),
161 message.c_str()); 161 message.c_str());
162 scoped_ptr<DevToolsRemoteMessage> response_message( 162 scoped_ptr<DevToolsRemoteMessage> response_message(
163 DevToolsRemoteMessageBuilder::instance().Create( 163 DevToolsRemoteMessageBuilder::instance().Create(
164 kToolName, 164 kToolName,
165 base::IntToString(tab_uid), 165 base::IntToString(tab_uid),
166 content)); 166 content));
167 delegate_->Send(*(response_message.get())); 167 delegate_->Send(*(response_message.get()));
168 } 168 }
169 169
(...skipping 158 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/debugger/debugger_remote_service.h ('k') | chrome/common/extensions/url_pattern.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698