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

Unified Diff: trunk/src/google_apis/drive/gdata_wapi_requests.cc

Issue 449323002: Revert 288017 "Parse Drive API responses all at once in the bloc..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/google_apis/drive/gdata_wapi_requests.cc
===================================================================
--- trunk/src/google_apis/drive/gdata_wapi_requests.cc (revision 288215)
+++ trunk/src/google_apis/drive/gdata_wapi_requests.cc (working copy)
@@ -4,37 +4,22 @@
#include "google_apis/drive/gdata_wapi_requests.h"
-#include "base/location.h"
-#include "base/sequenced_task_runner.h"
-#include "base/task_runner_util.h"
-#include "base/values.h"
-#include "google_apis/drive/gdata_wapi_parser.h"
#include "google_apis/drive/gdata_wapi_url_generator.h"
namespace google_apis {
-namespace {
+//============================ GetResourceEntryRequest =======================
-scoped_ptr<ResourceEntry> ParseResourceEntry(const std::string& json) {
- scoped_ptr<base::Value> value = ParseJson(json);
- return value ? ResourceEntry::ExtractAndParse(*value) :
- scoped_ptr<ResourceEntry>();
-}
-
-} // namespace
-
GetResourceEntryRequest::GetResourceEntryRequest(
RequestSender* sender,
const GDataWapiUrlGenerator& url_generator,
const std::string& resource_id,
const GURL& embed_origin,
- const GetResourceEntryCallback& callback)
- : UrlFetchRequestBase(sender),
+ const GetDataCallback& callback)
+ : GetDataRequest(sender, callback),
url_generator_(url_generator),
resource_id_(resource_id),
- embed_origin_(embed_origin),
- callback_(callback),
- weak_ptr_factory_(this) {
+ embed_origin_(embed_origin) {
DCHECK(!callback.is_null());
}
@@ -45,35 +30,4 @@
resource_id_, embed_origin_);
}
-void GetResourceEntryRequest::ProcessURLFetchResults(
- const net::URLFetcher* source) {
- GDataErrorCode error = GetErrorCode();
- switch (error) {
- case HTTP_SUCCESS:
- case HTTP_CREATED:
- base::PostTaskAndReplyWithResult(
- blocking_task_runner(),
- FROM_HERE,
- base::Bind(&ParseResourceEntry, response_writer()->data()),
- base::Bind(&GetResourceEntryRequest::OnDataParsed,
- weak_ptr_factory_.GetWeakPtr(), error));
- break;
- default:
- RunCallbackOnPrematureFailure(error);
- OnProcessURLFetchResultsComplete();
- break;
- }
-}
-
-void GetResourceEntryRequest::RunCallbackOnPrematureFailure(
- GDataErrorCode error) {
- callback_.Run(error, scoped_ptr<ResourceEntry>());
-}
-
-void GetResourceEntryRequest::OnDataParsed(GDataErrorCode error,
- scoped_ptr<ResourceEntry> entry) {
- callback_.Run(entry ? error : GDATA_PARSE_ERROR, entry.Pass());
- OnProcessURLFetchResultsComplete();
-}
-
} // namespace google_apis
« no previous file with comments | « trunk/src/google_apis/drive/gdata_wapi_requests.h ('k') | trunk/src/google_apis/drive/gdata_wapi_requests_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698