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 |
(...skipping 19 matching lines...) Expand all Loading... |
30 // It integrates specific service integration with OAuth2 stack | 30 // It integrates specific service integration with OAuth2 stack |
31 // (TokenService) and provides OAuth2 token refresh infrastructure. | 31 // (TokenService) and provides OAuth2 token refresh infrastructure. |
32 // All public functions must be called on UI thread. | 32 // All public functions must be called on UI thread. |
33 class AuthService : public AuthServiceInterface, | 33 class AuthService : public AuthServiceInterface, |
34 public content::NotificationObserver { | 34 public content::NotificationObserver { |
35 public: | 35 public: |
36 // |url_request_context_getter| is used to perform authentication with | 36 // |url_request_context_getter| is used to perform authentication with |
37 // URLFetcher. | 37 // URLFetcher. |
38 // | 38 // |
39 // |scopes| specifies OAuth2 scopes. | 39 // |scopes| specifies OAuth2 scopes. |
40 AuthService(net::URLRequestContextGetter* url_request_context_getter, | 40 AuthService(Profile* profile, |
| 41 net::URLRequestContextGetter* url_request_context_getter, |
41 const std::vector<std::string>& scopes); | 42 const std::vector<std::string>& scopes); |
42 virtual ~AuthService(); | 43 virtual ~AuthService(); |
43 | 44 |
44 // Overriden from AuthServiceInterface: | 45 // Overriden from AuthServiceInterface: |
45 virtual void AddObserver(AuthServiceObserver* observer) OVERRIDE; | 46 virtual void AddObserver(AuthServiceObserver* observer) OVERRIDE; |
46 virtual void RemoveObserver(AuthServiceObserver* observer) OVERRIDE; | 47 virtual void RemoveObserver(AuthServiceObserver* observer) OVERRIDE; |
47 virtual void Initialize(Profile* profile) OVERRIDE; | |
48 virtual void StartAuthentication(const AuthStatusCallback& callback) OVERRIDE; | 48 virtual void StartAuthentication(const AuthStatusCallback& callback) OVERRIDE; |
49 virtual bool HasAccessToken() const OVERRIDE; | 49 virtual bool HasAccessToken() const OVERRIDE; |
50 virtual bool HasRefreshToken() const OVERRIDE; | 50 virtual bool HasRefreshToken() const OVERRIDE; |
51 virtual const std::string& access_token() const OVERRIDE; | 51 virtual const std::string& access_token() const OVERRIDE; |
52 virtual void ClearAccessToken() OVERRIDE; | 52 virtual void ClearAccessToken() OVERRIDE; |
53 virtual void ClearRefreshToken() OVERRIDE; | 53 virtual void ClearRefreshToken() OVERRIDE; |
54 | 54 |
55 // Overridden from content::NotificationObserver: | 55 // Overridden from content::NotificationObserver: |
56 virtual void Observe(int type, | 56 virtual void Observe(int type, |
57 const content::NotificationSource& source, | 57 const content::NotificationSource& source, |
(...skipping 29 matching lines...) Expand all Loading... |
87 // Note: This should remain the last member so it'll be destroyed and | 87 // Note: This should remain the last member so it'll be destroyed and |
88 // invalidate its weak pointers before any other members are destroyed. | 88 // invalidate its weak pointers before any other members are destroyed. |
89 base::WeakPtrFactory<AuthService> weak_ptr_factory_; | 89 base::WeakPtrFactory<AuthService> weak_ptr_factory_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(AuthService); | 91 DISALLOW_COPY_AND_ASSIGN(AuthService); |
92 }; | 92 }; |
93 | 93 |
94 } // namespace google_apis | 94 } // namespace google_apis |
95 | 95 |
96 #endif // CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_H_ | 96 #endif // CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_H_ |
OLD | NEW |