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

Side by Side Diff: content/browser/devtools/devtools_protocol.cc

Issue 14081010: Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix some gtk issues Created 7 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/devtools/devtools_protocol.h" 5 #include "content/browser/devtools/devtools_protocol.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 domain_ = method.substr(0, pos); 47 domain_ = method.substr(0, pos);
48 } 48 }
49 49
50 DevToolsProtocol::Command::~Command() { 50 DevToolsProtocol::Command::~Command() {
51 } 51 }
52 52
53 std::string DevToolsProtocol::Command::Serialize() { 53 std::string DevToolsProtocol::Command::Serialize() {
54 DictionaryValue command; 54 DictionaryValue command;
55 command.SetInteger(kIdParam, id_); 55 command.SetInteger(kIdParam, id_);
56 command.SetString(kMethodParam, method_); 56 command.SetString(kMethodParam, method_);
57 if (params_.get()) 57 if (params_)
58 command.Set(kParamsParam, params_->DeepCopy()); 58 command.Set(kParamsParam, params_->DeepCopy());
59 59
60 std::string json_command; 60 std::string json_command;
61 base::JSONWriter::Write(&command, &json_command); 61 base::JSONWriter::Write(&command, &json_command);
62 return json_command; 62 return json_command;
63 } 63 }
64 64
65 scoped_ptr<DevToolsProtocol::Response> 65 scoped_ptr<DevToolsProtocol::Response>
66 DevToolsProtocol::Command::SuccessResponse(DictionaryValue* result) { 66 DevToolsProtocol::Command::SuccessResponse(DictionaryValue* result) {
67 return scoped_ptr<DevToolsProtocol::Response>( 67 return scoped_ptr<DevToolsProtocol::Response>(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 if (id_ != kNoId) 101 if (id_ != kNoId)
102 response.SetInteger(kIdParam, id_); 102 response.SetInteger(kIdParam, id_);
103 103
104 if (error_code_) { 104 if (error_code_) {
105 DictionaryValue* error_object = new DictionaryValue(); 105 DictionaryValue* error_object = new DictionaryValue();
106 response.Set(kErrorParam, error_object); 106 response.Set(kErrorParam, error_object);
107 error_object->SetInteger(kErrorCodeParam, error_code_); 107 error_object->SetInteger(kErrorCodeParam, error_code_);
108 if (!error_message_.empty()) 108 if (!error_message_.empty())
109 error_object->SetString(kErrorMessageParam, error_message_); 109 error_object->SetString(kErrorMessageParam, error_message_);
110 } else if (result_.get()) { 110 } else if (result_) {
111 response.Set(kResultParam, result_->DeepCopy()); 111 response.Set(kResultParam, result_->DeepCopy());
112 } 112 }
113 113
114 std::string json_response; 114 std::string json_response;
115 base::JSONWriter::Write(&response, &json_response); 115 base::JSONWriter::Write(&response, &json_response);
116 return json_response; 116 return json_response;
117 } 117 }
118 118
119 DevToolsProtocol::Response::Response(int id, DictionaryValue* result) 119 DevToolsProtocol::Response::Response(int id, DictionaryValue* result)
120 : id_(id), 120 : id_(id),
(...skipping 17 matching lines...) Expand all
138 DictionaryValue* params) 138 DictionaryValue* params)
139 : Message(method, params) { 139 : Message(method, params) {
140 } 140 }
141 141
142 DevToolsProtocol::Notification::~Notification() { 142 DevToolsProtocol::Notification::~Notification() {
143 } 143 }
144 144
145 std::string DevToolsProtocol::Notification::Serialize() { 145 std::string DevToolsProtocol::Notification::Serialize() {
146 DictionaryValue notification; 146 DictionaryValue notification;
147 notification.SetString(kMethodParam, method_); 147 notification.SetString(kMethodParam, method_);
148 if (params_.get()) 148 if (params_)
149 notification.Set(kParamsParam, params_->DeepCopy()); 149 notification.Set(kParamsParam, params_->DeepCopy());
150 150
151 std::string json_notification; 151 std::string json_notification;
152 base::JSONWriter::Write(&notification, &json_notification); 152 base::JSONWriter::Write(&notification, &json_notification);
153 return json_notification; 153 return json_notification;
154 } 154 }
155 155
156 DevToolsProtocol::Handler::~Handler() { 156 DevToolsProtocol::Handler::~Handler() {
157 } 157 }
158 158
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 Response response(0, kErrorParseError, error_message); 257 Response response(0, kErrorParseError, error_message);
258 if (error_response) 258 if (error_response)
259 *error_response = response.Serialize(); 259 *error_response = response.Serialize();
260 return NULL; 260 return NULL;
261 } 261 }
262 262
263 return static_cast<DictionaryValue*>(message.release()); 263 return static_cast<DictionaryValue*>(message.release());
264 } 264 }
265 265
266 } // namespace content 266 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/devtools_http_handler_impl.cc ('k') | content/browser/download/base_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698