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_GOOGLE_APIS_AUTH_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_H_ |
6 #define CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "chrome/browser/google_apis/base_operations.h" | 13 #include "chrome/browser/google_apis/base_operations.h" |
14 #include "chrome/browser/google_apis/gdata_errorcode.h" | 14 #include "chrome/browser/google_apis/gdata_errorcode.h" |
15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
17 | 17 |
18 class Profile; | 18 class Profile; |
19 | 19 |
20 namespace google_apis { | 20 namespace google_apis { |
21 | 21 |
22 class OperationRegistry; | 22 class OperationRegistry; |
23 class AuthServiceObserver; | 23 class AuthServiceObserver; |
24 | 24 |
| 25 // Callback type for authentication related DriveServiceInterface calls. |
| 26 typedef base::Callback<void(GDataErrorCode error, |
| 27 const std::string& token)> AuthStatusCallback; |
| 28 |
25 // This class provides authentication for Google services. | 29 // This class provides authentication for Google services. |
26 // It integrates specific service integration with OAuth2 stack | 30 // It integrates specific service integration with OAuth2 stack |
27 // (TokenService) and provides OAuth2 token refresh infrastructure. | 31 // (TokenService) and provides OAuth2 token refresh infrastructure. |
28 // All public functions must be called on UI thread. | 32 // All public functions must be called on UI thread. |
29 class AuthService : public content::NotificationObserver { | 33 class AuthService : public content::NotificationObserver { |
30 public: | 34 public: |
31 explicit AuthService(const std::vector<std::string>& scopes); | 35 explicit AuthService(const std::vector<std::string>& scopes); |
32 virtual ~AuthService(); | 36 virtual ~AuthService(); |
33 | 37 |
34 // Adds and removes the observer. AddObserver() should be called before | 38 // Adds and removes the observer. AddObserver() should be called before |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // Note: This should remain the last member so it'll be destroyed and | 99 // Note: This should remain the last member so it'll be destroyed and |
96 // invalidate its weak pointers before any other members are destroyed. | 100 // invalidate its weak pointers before any other members are destroyed. |
97 base::WeakPtrFactory<AuthService> weak_ptr_factory_; | 101 base::WeakPtrFactory<AuthService> weak_ptr_factory_; |
98 | 102 |
99 DISALLOW_COPY_AND_ASSIGN(AuthService); | 103 DISALLOW_COPY_AND_ASSIGN(AuthService); |
100 }; | 104 }; |
101 | 105 |
102 } // namespace google_apis | 106 } // namespace google_apis |
103 | 107 |
104 #endif // CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_H_ | 108 #endif // CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_H_ |
OLD | NEW |