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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 // This class performs the operation for fetching and parsing JSON data content. | 180 // This class performs the operation for fetching and parsing JSON data content. |
181 class GetDataOperation : public UrlFetchOperationBase { | 181 class GetDataOperation : public UrlFetchOperationBase { |
182 public: | 182 public: |
183 GetDataOperation(GDataOperationRegistry* registry, | 183 GetDataOperation(GDataOperationRegistry* registry, |
184 Profile* profile, | 184 Profile* profile, |
185 const GetDataCallback& callback); | 185 const GetDataCallback& callback); |
186 virtual ~GetDataOperation(); | 186 virtual ~GetDataOperation(); |
187 | 187 |
188 // Parse GData JSON response. | 188 // Parse GData JSON response. |
189 virtual bool ParseResponse(GDataErrorCode fetch_error_code, | 189 virtual base::Value* ParseResponse(const std::string& data); |
190 const std::string& data); | |
191 | 190 |
192 protected: | 191 protected: |
193 // Overridden from UrlFetchOperationBase. | 192 // Overridden from UrlFetchOperationBase. |
194 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | 193 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; |
195 virtual void RunCallbackOnPrematureFailure( | 194 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; |
196 GDataErrorCode fetch_error_code) OVERRIDE; | |
197 void RunCallback(GDataErrorCode fetch_error_code, | |
198 scoped_ptr<base::Value> value); | |
199 | 195 |
200 private: | 196 private: |
201 void OnDataParsed(GDataErrorCode fetch_error_code, | |
202 scoped_ptr<base::Value>* value); | |
203 | |
204 GetDataCallback callback_; | 197 GetDataCallback callback_; |
205 base::WeakPtrFactory<GetDataOperation> weak_ptr_factory_; | |
206 | |
207 DISALLOW_COPY_AND_ASSIGN(GetDataOperation); | 198 DISALLOW_COPY_AND_ASSIGN(GetDataOperation); |
208 }; | 199 }; |
209 | 200 |
210 } // namespace gdata | 201 } // namespace gdata |
211 | 202 |
212 #endif // CHROME_BROWSER_CHROMEOS_GDATA_OPERATIONS_BASE_H_ | 203 #endif // CHROME_BROWSER_CHROMEOS_GDATA_OPERATIONS_BASE_H_ |
OLD | NEW |