OLD | NEW |
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 #include "chrome/service/cloud_print/cloud_print_helpers.h" | 5 #include "chrome/service/cloud_print/cloud_print_helpers.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/md5.h" | 8 #include "base/md5.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 | 164 |
165 | 165 |
166 bool CloudPrintHelpers::ParseResponseJSON( | 166 bool CloudPrintHelpers::ParseResponseJSON( |
167 const std::string& response_data, bool* succeeded, | 167 const std::string& response_data, bool* succeeded, |
168 DictionaryValue** response_dict) { | 168 DictionaryValue** response_dict) { |
169 scoped_ptr<Value> message_value(base::JSONReader::Read(response_data, false)); | 169 scoped_ptr<Value> message_value(base::JSONReader::Read(response_data, false)); |
170 if (!message_value.get()) | 170 if (!message_value.get()) |
171 return false; | 171 return false; |
172 | 172 |
173 if (!message_value->IsType(Value::TYPE_DICTIONARY)) | 173 if (!message_value->IsDictionary()) |
174 return false; | 174 return false; |
175 | 175 |
176 scoped_ptr<DictionaryValue> response_dict_local( | 176 scoped_ptr<DictionaryValue> response_dict_local( |
177 static_cast<DictionaryValue*>(message_value.release())); | 177 static_cast<DictionaryValue*>(message_value.release())); |
178 if (succeeded) { | 178 if (succeeded) { |
179 if (!response_dict_local->GetBoolean(kSuccessValue, succeeded)) | 179 if (!response_dict_local->GetBoolean(kSuccessValue, succeeded)) |
180 *succeeded = false; | 180 *succeeded = false; |
181 } | 181 } |
182 if (response_dict) | 182 if (response_dict) |
183 *response_dict = response_dict_local.release(); | 183 *response_dict = response_dict_local.release(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 260 } |
261 | 261 |
262 bool CloudPrintHelpers::IsDryRunJob(const std::vector<std::string>& tags) { | 262 bool CloudPrintHelpers::IsDryRunJob(const std::vector<std::string>& tags) { |
263 std::vector<std::string>::const_iterator it; | 263 std::vector<std::string>::const_iterator it; |
264 for (it = tags.begin(); it != tags.end(); ++it) { | 264 for (it = tags.begin(); it != tags.end(); ++it) { |
265 if (*it == kTagDryRunFlag) | 265 if (*it == kTagDryRunFlag) |
266 return true; | 266 return true; |
267 } | 267 } |
268 return false; | 268 return false; |
269 } | 269 } |
OLD | NEW |