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 // This file provides base classes used to implement operations for Google APIs. | 5 // This file provides base classes used to implement operations for Google APIs. |
6 | 6 |
7 #ifndef CHROME_BROWSER_GOOGLE_APIS_BASE_OPERATIONS_H_ | 7 #ifndef CHROME_BROWSER_GOOGLE_APIS_BASE_OPERATIONS_H_ |
8 #define CHROME_BROWSER_GOOGLE_APIS_BASE_OPERATIONS_H_ | 8 #define CHROME_BROWSER_GOOGLE_APIS_BASE_OPERATIONS_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 13 matching lines...) Expand all Loading... |
24 namespace base { | 24 namespace base { |
25 class Value; | 25 class Value; |
26 } // namespace base | 26 } // namespace base |
27 | 27 |
28 namespace net { | 28 namespace net { |
29 class URLRequestContextGetter; | 29 class URLRequestContextGetter; |
30 } // namespace net | 30 } // namespace net |
31 | 31 |
32 namespace google_apis { | 32 namespace google_apis { |
33 | 33 |
| 34 // Callback used to pass parsed JSON from ParseJson(). If parsing error occures, |
| 35 // then the passed argument is null. |
| 36 typedef base::Callback<void(scoped_ptr<base::Value> value)> ParseJsonCallback; |
| 37 |
| 38 // Parses JSON passed in |json| on blocking pool. Runs |callback| on the calling |
| 39 // thread when finished with either success or failure. |
| 40 // The callback must not be null. |
| 41 void ParseJson(const std::string& json, const ParseJsonCallback& callback); |
| 42 |
34 //======================= AuthenticatedOperationInterface ====================== | 43 //======================= AuthenticatedOperationInterface ====================== |
35 | 44 |
36 // An interface class for implementing an operation which requires OAuth2 | 45 // An interface class for implementing an operation which requires OAuth2 |
37 // authentication. | 46 // authentication. |
38 class AuthenticatedOperationInterface { | 47 class AuthenticatedOperationInterface { |
39 public: | 48 public: |
40 // Called when re-authentication is required. See Start() for details. | 49 // Called when re-authentication is required. See Start() for details. |
41 typedef base::Callback<void(AuthenticatedOperationInterface* operation)> | 50 typedef base::Callback<void(AuthenticatedOperationInterface* operation)> |
42 ReAuthenticateCallback; | 51 ReAuthenticateCallback; |
43 | 52 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 254 |
246 // Note: This should remain the last member so it'll be destroyed and | 255 // Note: This should remain the last member so it'll be destroyed and |
247 // invalidate its weak pointers before any other members are destroyed. | 256 // invalidate its weak pointers before any other members are destroyed. |
248 base::WeakPtrFactory<GetDataOperation> weak_ptr_factory_; | 257 base::WeakPtrFactory<GetDataOperation> weak_ptr_factory_; |
249 DISALLOW_COPY_AND_ASSIGN(GetDataOperation); | 258 DISALLOW_COPY_AND_ASSIGN(GetDataOperation); |
250 }; | 259 }; |
251 | 260 |
252 } // namespace google_apis | 261 } // namespace google_apis |
253 | 262 |
254 #endif // CHROME_BROWSER_GOOGLE_APIS_BASE_OPERATIONS_H_ | 263 #endif // CHROME_BROWSER_GOOGLE_APIS_BASE_OPERATIONS_H_ |
OLD | NEW |