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

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

Issue 10855034: Drive: Remove gdata_params.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review (#14) fix Created 8 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 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_OPERATIONS_BASE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_OPERATIONS_BASE_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_OPERATIONS_BASE_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_OPERATIONS_BASE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h"
12 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h"
11 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" 13 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h"
12 #include "chrome/browser/chromeos/gdata/gdata_params.h"
13 #include "chrome/common/net/gaia/oauth2_access_token_consumer.h" 14 #include "chrome/common/net/gaia/oauth2_access_token_consumer.h"
15 #include "googleurl/src/gurl.h"
14 #include "net/http/http_response_headers.h" 16 #include "net/http/http_response_headers.h"
15 #include "net/url_request/url_fetcher.h" 17 #include "net/url_request/url_fetcher.h"
16 #include "net/url_request/url_fetcher_delegate.h" 18 #include "net/url_request/url_fetcher_delegate.h"
17 19
18 class OAuth2AccessTokenFetcher; 20 class OAuth2AccessTokenFetcher;
19 21
20 namespace gdata { 22 namespace gdata {
21 23
22 //================================ AuthOperation =============================== 24 //================================ AuthOperation ===============================
23 25
26 // Callback type for authentication related DocumentService calls.
27 typedef base::Callback<void(GDataErrorCode error,
28 const std::string& token)> AuthStatusCallback;
29
24 // OAuth2 authorization token retrieval operation. 30 // OAuth2 authorization token retrieval operation.
25 class AuthOperation : public GDataOperationRegistry::Operation, 31 class AuthOperation : public GDataOperationRegistry::Operation,
26 public OAuth2AccessTokenConsumer { 32 public OAuth2AccessTokenConsumer {
27 public: 33 public:
28 AuthOperation(GDataOperationRegistry* registry, 34 AuthOperation(GDataOperationRegistry* registry,
29 const AuthStatusCallback& callback, 35 const AuthStatusCallback& callback,
30 const std::string& refresh_token); 36 const std::string& refresh_token);
31 virtual ~AuthOperation(); 37 virtual ~AuthOperation();
32 void Start(); 38 void Start();
33 39
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 ReAuthenticateCallback re_authenticate_callback_; 148 ReAuthenticateCallback re_authenticate_callback_;
143 int re_authenticate_count_; 149 int re_authenticate_count_;
144 bool save_temp_file_; 150 bool save_temp_file_;
145 FilePath output_file_path_; 151 FilePath output_file_path_;
146 scoped_ptr<net::URLFetcher> url_fetcher_; 152 scoped_ptr<net::URLFetcher> url_fetcher_;
147 bool started_; 153 bool started_;
148 }; 154 };
149 155
150 //============================ EntryActionOperation ============================ 156 //============================ EntryActionOperation ============================
151 157
158 // Callback type for Delete/Move DocumentServiceInterface calls.
159 typedef base::Callback<void(GDataErrorCode error,
160 const GURL& document_url)> EntryActionCallback;
161
152 // This class performs a simple action over a given entry (document/file). 162 // This class performs a simple action over a given entry (document/file).
153 // It is meant to be used for operations that return no JSON blobs. 163 // It is meant to be used for operations that return no JSON blobs.
154 class EntryActionOperation : public UrlFetchOperationBase { 164 class EntryActionOperation : public UrlFetchOperationBase {
155 public: 165 public:
156 EntryActionOperation(GDataOperationRegistry* registry, 166 EntryActionOperation(GDataOperationRegistry* registry,
157 const EntryActionCallback& callback, 167 const EntryActionCallback& callback,
158 const GURL& document_url); 168 const GURL& document_url);
159 virtual ~EntryActionOperation(); 169 virtual ~EntryActionOperation();
160 170
161 protected: 171 protected:
162 // Overridden from UrlFetchOperationBase. 172 // Overridden from UrlFetchOperationBase.
163 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; 173 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE;
164 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; 174 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE;
165 175
166 const GURL& document_url() const { return document_url_; } 176 const GURL& document_url() const { return document_url_; }
167 177
168 private: 178 private:
169 EntryActionCallback callback_; 179 EntryActionCallback callback_;
170 GURL document_url_; 180 GURL document_url_;
171 181
172 DISALLOW_COPY_AND_ASSIGN(EntryActionOperation); 182 DISALLOW_COPY_AND_ASSIGN(EntryActionOperation);
173 }; 183 };
174 184
175 //============================== GetDataOperation ============================== 185 //============================== GetDataOperation ==============================
176 186
187 // Callback type for DocumentServiceInterface::GetDocuments.
188 // Note: feed_data argument should be passed using base::Passed(&feed_data), not
189 // feed_data.Pass().
190 typedef base::Callback<void(GDataErrorCode error,
191 scoped_ptr<base::Value> feed_data)> GetDataCallback;
192
177 // This class performs the operation for fetching and parsing JSON data content. 193 // This class performs the operation for fetching and parsing JSON data content.
178 class GetDataOperation : public UrlFetchOperationBase { 194 class GetDataOperation : public UrlFetchOperationBase {
179 public: 195 public:
180 GetDataOperation(GDataOperationRegistry* registry, 196 GetDataOperation(GDataOperationRegistry* registry,
181 const GetDataCallback& callback); 197 const GetDataCallback& callback);
182 virtual ~GetDataOperation(); 198 virtual ~GetDataOperation();
183 199
184 // Parse GData JSON response. 200 // Parse GData JSON response.
185 virtual void ParseResponse(GDataErrorCode fetch_error_code, 201 virtual void ParseResponse(GDataErrorCode fetch_error_code,
186 const std::string& data); 202 const std::string& data);
(...skipping 15 matching lines...) Expand all
202 218
203 // Note: This should remain the last member so it'll be destroyed and 219 // Note: This should remain the last member so it'll be destroyed and
204 // invalidate its weak pointers before any other members are destroyed. 220 // invalidate its weak pointers before any other members are destroyed.
205 base::WeakPtrFactory<GetDataOperation> weak_ptr_factory_; 221 base::WeakPtrFactory<GetDataOperation> weak_ptr_factory_;
206 DISALLOW_COPY_AND_ASSIGN(GetDataOperation); 222 DISALLOW_COPY_AND_ASSIGN(GetDataOperation);
207 }; 223 };
208 224
209 } // namespace gdata 225 } // namespace gdata
210 226
211 #endif // CHROME_BROWSER_CHROMEOS_GDATA_OPERATIONS_BASE_H_ 227 #endif // CHROME_BROWSER_CHROMEOS_GDATA_OPERATIONS_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698