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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_operations.h

Issue 10749015: gdrive: Get JSON feeds parsing off the UI thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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) 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 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 private: 177 private:
178 EntryActionCallback callback_; 178 EntryActionCallback callback_;
179 GURL document_url_; 179 GURL document_url_;
180 180
181 DISALLOW_COPY_AND_ASSIGN(EntryActionOperation); 181 DISALLOW_COPY_AND_ASSIGN(EntryActionOperation);
182 }; 182 };
183 183
184 //============================== GetDataOperation ============================== 184 //============================== GetDataOperation ==============================
185 185
186 // This class performs the operation for fetching and parsing JSON data content. 186 // This class performs the operation for fetching and parsing JSON data content.
187 class GetDataOperation : public UrlFetchOperationBase { 187 class GetDataOperation : public UrlFetchOperationBase,
188 public base::SupportsWeakPtr<GetDataOperation> {
hashimoto 2012/07/10 03:48:39 SupportsWeakPtr exposes AsWeakPtr() for public. In
yoshiki 2012/07/11 00:47:14 Done.
188 public: 189 public:
189 GetDataOperation(GDataOperationRegistry* registry, 190 GetDataOperation(GDataOperationRegistry* registry,
190 Profile* profile, 191 Profile* profile,
191 const GetDataCallback& callback); 192 const GetDataCallback& callback);
192 virtual ~GetDataOperation(); 193 virtual ~GetDataOperation();
193 194
194 // Parse GData JSON response. 195 // Parse GData JSON response.
195 virtual base::Value* ParseResponse(const std::string& data); 196 virtual bool ParseResponse(GDataErrorCode code, const std::string& data);
hashimoto 2012/07/10 03:48:39 |code| is too ambiguous, please rename this to mor
yoshiki 2012/07/11 00:47:14 Done.
196 197
197 protected: 198 protected:
198 // Overridden from UrlFetchOperationBase. 199 // Overridden from UrlFetchOperationBase.
199 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) 200 virtual bool ProcessURLFetchResults(const net::URLFetcher* source)
200 OVERRIDE; 201 OVERRIDE;
201 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; 202 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE;
202 203
204 void RunCallback(GDataErrorCode code, scoped_ptr<base::Value> value);
hashimoto 2012/07/10 03:48:39 ditto as ParseResponse().
yoshiki 2012/07/11 00:47:14 Done.
205
203 private: 206 private:
207 void OnDataParsed(GDataErrorCode code, scoped_ptr<base::Value>* value);
hashimoto 2012/07/10 03:48:39 ditto as ParseResponse().
yoshiki 2012/07/11 00:47:14 Done.
208
204 GetDataCallback callback_; 209 GetDataCallback callback_;
205 DISALLOW_COPY_AND_ASSIGN(GetDataOperation); 210 DISALLOW_COPY_AND_ASSIGN(GetDataOperation);
206 }; 211 };
207 212
208 //============================ GetDocumentsOperation =========================== 213 //============================ GetDocumentsOperation ===========================
209 214
210 // This class performs the operation for fetching a document list. 215 // This class performs the operation for fetching a document list.
211 class GetDocumentsOperation : public GetDataOperation { 216 class GetDocumentsOperation : public GetDataOperation {
212 public: 217 public:
213 GetDocumentsOperation(GDataOperationRegistry* registry, 218 GetDocumentsOperation(GDataOperationRegistry* registry,
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 virtual bool GetContentData(std::string* upload_content_type, 441 virtual bool GetContentData(std::string* upload_content_type,
437 std::string* upload_content) OVERRIDE; 442 std::string* upload_content) OVERRIDE;
438 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; 443 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE;
439 444
440 // Overridden from GetDataOperation. 445 // Overridden from GetDataOperation.
441 virtual GURL GetURL() const OVERRIDE; 446 virtual GURL GetURL() const OVERRIDE;
442 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; 447 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE;
443 448
444 // Must override GetDataOperation's ParseResponse because the response is XML 449 // Must override GetDataOperation's ParseResponse because the response is XML
445 // not JSON. 450 // not JSON.
446 virtual base::Value* ParseResponse(const std::string& data) OVERRIDE; 451 virtual bool ParseResponse(GDataErrorCode code,
452 const std::string& data) OVERRIDE;
447 private: 453 private:
448 std::string app_id_; 454 std::string app_id_;
449 GURL document_url_; 455 GURL document_url_;
450 456
451 DISALLOW_COPY_AND_ASSIGN(AuthorizeAppsOperation); 457 DISALLOW_COPY_AND_ASSIGN(AuthorizeAppsOperation);
452 }; 458 };
453 459
454 //======================= AddResourceToDirectoryOperation ====================== 460 //======================= AddResourceToDirectoryOperation ======================
455 461
456 // This class performs the operation for adding a document/file/directory 462 // This class performs the operation for adding a document/file/directory
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 ResumeUploadCallback callback_; 581 ResumeUploadCallback callback_;
576 ResumeUploadParams params_; 582 ResumeUploadParams params_;
577 bool last_chunk_completed_; 583 bool last_chunk_completed_;
578 584
579 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); 585 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation);
580 }; 586 };
581 587
582 } // namespace gdata 588 } // namespace gdata
583 589
584 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ 590 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698