| 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_GDATA_AUTH_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_AUTH_SERVICE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_AUTH_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_AUTH_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" |
| 10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "base/message_loop_proxy.h" | 13 #include "base/message_loop_proxy.h" |
| 13 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 14 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" | 15 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" |
| 15 #include "chrome/browser/chromeos/gdata/gdata_params.h" | |
| 16 #include "chrome/common/net/gaia/oauth2_access_token_fetcher.h" | 16 #include "chrome/common/net/gaia/oauth2_access_token_fetcher.h" |
| 17 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
| 19 | 19 |
| 20 class Profile; | 20 class Profile; |
| 21 | 21 |
| 22 namespace gdata { | 22 namespace gdata { |
| 23 | 23 |
| 24 class GDataOperationRegistry; | 24 class GDataOperationRegistry; |
| 25 | 25 |
| 26 // Callback type for authentication related DocumentService calls. |
| 27 typedef base::Callback<void(GDataErrorCode error, |
| 28 const std::string& token)> AuthStatusCallback; |
| 29 |
| 26 // This class provides authentication for GData based services. | 30 // This class provides authentication for GData based services. |
| 27 // It integrates specific service integration with OAuth2 stack | 31 // It integrates specific service integration with OAuth2 stack |
| 28 // (TokenService) and provides OAuth2 token refresh infrastructure. | 32 // (TokenService) and provides OAuth2 token refresh infrastructure. |
| 29 // All public functions must be called on UI thread. | 33 // All public functions must be called on UI thread. |
| 30 class GDataAuthService : public content::NotificationObserver { | 34 class GDataAuthService : public content::NotificationObserver { |
| 31 public: | 35 public: |
| 32 class Observer { | 36 class Observer { |
| 33 public: | 37 public: |
| 34 // Triggered when a new OAuth2 refresh token is received from TokenService. | 38 // Triggered when a new OAuth2 refresh token is received from TokenService. |
| 35 virtual void OnOAuth2RefreshTokenChanged() = 0; | 39 virtual void OnOAuth2RefreshTokenChanged() = 0; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // Note: This should remain the last member so it'll be destroyed and | 106 // Note: This should remain the last member so it'll be destroyed and |
| 103 // invalidate its weak pointers before any other members are destroyed. | 107 // invalidate its weak pointers before any other members are destroyed. |
| 104 base::WeakPtrFactory<GDataAuthService> weak_ptr_factory_; | 108 base::WeakPtrFactory<GDataAuthService> weak_ptr_factory_; |
| 105 | 109 |
| 106 DISALLOW_COPY_AND_ASSIGN(GDataAuthService); | 110 DISALLOW_COPY_AND_ASSIGN(GDataAuthService); |
| 107 }; | 111 }; |
| 108 | 112 |
| 109 } // namespace gdata | 113 } // namespace gdata |
| 110 | 114 |
| 111 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_AUTH_SERVICE_H_ | 115 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_AUTH_SERVICE_H_ |
| OLD | NEW |