OLD | NEW |
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 "chrome/browser/chromeos/gdata/gdata_operations.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_operations.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 FROM_HERE, | 406 FROM_HERE, |
407 base::Bind(callback_, code, base::Passed(&root_value))); | 407 base::Bind(callback_, code, base::Passed(&root_value))); |
408 } | 408 } |
409 } | 409 } |
410 | 410 |
411 // static | 411 // static |
412 base::Value* GetDataOperation::ParseResponse(const std::string& data) { | 412 base::Value* GetDataOperation::ParseResponse(const std::string& data) { |
413 int error_code = -1; | 413 int error_code = -1; |
414 std::string error_message; | 414 std::string error_message; |
415 scoped_ptr<base::Value> root_value(base::JSONReader::ReadAndReturnError( | 415 scoped_ptr<base::Value> root_value(base::JSONReader::ReadAndReturnError( |
416 data, false, &error_code, &error_message)); | 416 data, base::JSON_PARSE_RFC, &error_code, &error_message)); |
417 if (!root_value.get()) { | 417 if (!root_value.get()) { |
418 LOG(ERROR) << "Error while parsing entry response: " | 418 LOG(ERROR) << "Error while parsing entry response: " |
419 << error_message | 419 << error_message |
420 << ", code: " | 420 << ", code: " |
421 << error_code | 421 << error_code |
422 << ", data:\n" | 422 << ", data:\n" |
423 << data; | 423 << data; |
424 return NULL; | 424 return NULL; |
425 } | 425 } |
426 return root_value.release(); | 426 return root_value.release(); |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 return true; | 995 return true; |
996 } | 996 } |
997 | 997 |
998 void ResumeUploadOperation::OnURLFetchUploadProgress( | 998 void ResumeUploadOperation::OnURLFetchUploadProgress( |
999 const content::URLFetcher* source, int64 current, int64 total) { | 999 const content::URLFetcher* source, int64 current, int64 total) { |
1000 // Adjust the progress values according to the range currently uploaded. | 1000 // Adjust the progress values according to the range currently uploaded. |
1001 NotifyProgress(params_.start_range + current, params_.content_length); | 1001 NotifyProgress(params_.start_range + current, params_.content_length); |
1002 } | 1002 } |
1003 | 1003 |
1004 } // namespace gdata | 1004 } // namespace gdata |
OLD | NEW |