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 #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 |
(...skipping 10 matching lines...) Expand all Loading... | |
21 namespace gdata { | 21 namespace gdata { |
22 | 22 |
23 //================================ AuthOperation =============================== | 23 //================================ AuthOperation =============================== |
24 | 24 |
25 // OAuth2 authorization token retrieval operation. | 25 // OAuth2 authorization token retrieval operation. |
26 class AuthOperation : public GDataOperationRegistry::Operation, | 26 class AuthOperation : public GDataOperationRegistry::Operation, |
27 public OAuth2AccessTokenConsumer { | 27 public OAuth2AccessTokenConsumer { |
28 public: | 28 public: |
29 AuthOperation(GDataOperationRegistry* registry, | 29 AuthOperation(GDataOperationRegistry* registry, |
30 Profile* profile, | 30 Profile* profile, |
31 const AuthStatusCallback& callback, | 31 const AuthStatusCallback& callback, |
hashimoto
2012/07/19 03:57:57
nit: Fix indent
yoshiki
2012/07/19 04:58:45
Done.
| |
32 const std::string& refresh_token); | 32 const std::string& refresh_token); |
33 virtual ~AuthOperation(); | 33 virtual ~AuthOperation(); |
34 void Start(); | 34 void Start(); |
35 | 35 |
36 // Overridden from OAuth2AccessTokenConsumer: | 36 // Overridden from OAuth2AccessTokenConsumer: |
37 virtual void OnGetTokenSuccess(const std::string& access_token) OVERRIDE; | 37 virtual void OnGetTokenSuccess(const std::string& access_token) OVERRIDE; |
38 virtual void OnGetTokenFailure(const GoogleServiceAuthError& error) OVERRIDE; | 38 virtual void OnGetTokenFailure(const GoogleServiceAuthError& error) OVERRIDE; |
39 | 39 |
40 // Overridden from GDataOpertionRegistry::Operation | 40 // Overridden from GDataOpertionRegistry::Operation |
41 virtual void DoCancel() OVERRIDE; | 41 virtual void DoCancel() OVERRIDE; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 | 178 |
179 // This class performs the operation for fetching and parsing JSON data content. | 179 // This class performs the operation for fetching and parsing JSON data content. |
180 class GetDataOperation : public UrlFetchOperationBase { | 180 class GetDataOperation : public UrlFetchOperationBase { |
181 public: | 181 public: |
182 GetDataOperation(GDataOperationRegistry* registry, | 182 GetDataOperation(GDataOperationRegistry* registry, |
183 Profile* profile, | 183 Profile* profile, |
184 const GetDataCallback& callback); | 184 const GetDataCallback& callback); |
185 virtual ~GetDataOperation(); | 185 virtual ~GetDataOperation(); |
186 | 186 |
187 // Parse GData JSON response. | 187 // Parse GData JSON response. |
188 virtual base::Value* ParseResponse(const std::string& data); | 188 virtual bool ParseResponse(GDataErrorCode fetch_error_code, |
189 const std::string& data); | |
189 | 190 |
190 protected: | 191 protected: |
191 // Overridden from UrlFetchOperationBase. | 192 // Overridden from UrlFetchOperationBase. |
192 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | 193 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; |
193 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | 194 virtual void RunCallbackOnPrematureFailure( |
195 GDataErrorCode fetch_error_code) OVERRIDE; | |
196 void RunCallback(GDataErrorCode fetch_error_code, | |
197 scoped_ptr<base::Value> value); | |
194 | 198 |
195 private: | 199 private: |
200 void OnDataParsed(GDataErrorCode fetch_error_code, | |
201 scoped_ptr<base::Value>* value); | |
202 | |
196 GetDataCallback callback_; | 203 GetDataCallback callback_; |
204 base::WeakPtrFactory<GetDataOperation> weak_ptr_factory_; | |
205 | |
197 DISALLOW_COPY_AND_ASSIGN(GetDataOperation); | 206 DISALLOW_COPY_AND_ASSIGN(GetDataOperation); |
198 }; | 207 }; |
199 | 208 |
200 } // namespace gdata | 209 } // namespace gdata |
201 | 210 |
202 #endif // CHROME_BROWSER_CHROMEOS_GDATA_OPERATIONS_BASE_H_ | 211 #endif // CHROME_BROWSER_CHROMEOS_GDATA_OPERATIONS_BASE_H_ |
OLD | NEW |