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/operations_base.h" | 5 #include "chrome/browser/chromeos/gdata/operations_base.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 callback_.Run(code, document_url_); | 359 callback_.Run(code, document_url_); |
360 } | 360 } |
361 | 361 |
362 //============================== GetDataOperation ============================== | 362 //============================== GetDataOperation ============================== |
363 | 363 |
364 GetDataOperation::GetDataOperation(GDataOperationRegistry* registry, | 364 GetDataOperation::GetDataOperation(GDataOperationRegistry* registry, |
365 Profile* profile, | 365 Profile* profile, |
366 const GetDataCallback& callback) | 366 const GetDataCallback& callback) |
367 : UrlFetchOperationBase(registry, profile), | 367 : UrlFetchOperationBase(registry, profile), |
368 callback_(callback), | 368 callback_(callback), |
369 weak_ptr_factory_(this) { | 369 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { |
370 } | 370 } |
371 | 371 |
372 GetDataOperation::~GetDataOperation() {} | 372 GetDataOperation::~GetDataOperation() {} |
373 | 373 |
374 void GetDataOperation::ProcessURLFetchResults(const URLFetcher* source) { | 374 void GetDataOperation::ProcessURLFetchResults(const URLFetcher* source) { |
375 std::string data; | 375 std::string data; |
376 source->GetResponseAsString(&data); | 376 source->GetResponseAsString(&data); |
377 scoped_ptr<base::Value> root_value; | 377 scoped_ptr<base::Value> root_value; |
378 GDataErrorCode fetch_error_code = GetErrorCode(source); | 378 GDataErrorCode fetch_error_code = GetErrorCode(source); |
379 | 379 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 } | 440 } |
441 | 441 |
442 void GetDataOperation::RunCallback(GDataErrorCode fetch_error_code, | 442 void GetDataOperation::RunCallback(GDataErrorCode fetch_error_code, |
443 scoped_ptr<base::Value> value) { | 443 scoped_ptr<base::Value> value) { |
444 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 444 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
445 if (!callback_.is_null()) | 445 if (!callback_.is_null()) |
446 callback_.Run(fetch_error_code, value.Pass()); | 446 callback_.Run(fetch_error_code, value.Pass()); |
447 } | 447 } |
448 | 448 |
449 } // namespace gdata | 449 } // namespace gdata |
OLD | NEW |