| 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_AUTH_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_AUTH_SERVICE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_AUTH_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_AUTH_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" | 14 #include "chrome/browser/chromeos/gdata/drive_errorcode.h" |
| 15 #include "chrome/browser/chromeos/gdata/operations_base.h" | 15 #include "chrome/browser/chromeos/gdata/operations_base.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 OperationRegistry; | 24 class OperationRegistry; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 // Returns OAuth2 access token. | 66 // Returns OAuth2 access token. |
| 67 const std::string& access_token() const { return access_token_; } | 67 const std::string& access_token() const { return access_token_; } |
| 68 | 68 |
| 69 // Clears OAuth2 access token. | 69 // Clears OAuth2 access token. |
| 70 void ClearAccessToken() { access_token_.clear(); } | 70 void ClearAccessToken() { access_token_.clear(); } |
| 71 | 71 |
| 72 // Callback for AuthOperation (InternalAuthStatusCallback). | 72 // Callback for AuthOperation (InternalAuthStatusCallback). |
| 73 void OnAuthCompleted(scoped_refptr<base::MessageLoopProxy> relay_proxy, | 73 void OnAuthCompleted(scoped_refptr<base::MessageLoopProxy> relay_proxy, |
| 74 const AuthStatusCallback& callback, | 74 const AuthStatusCallback& callback, |
| 75 GDataErrorCode error, | 75 DriveErrorCode error, |
| 76 const std::string& access_token); | 76 const std::string& access_token); |
| 77 | 77 |
| 78 // Overridden from content::NotificationObserver: | 78 // Overridden from content::NotificationObserver: |
| 79 virtual void Observe(int type, | 79 virtual void Observe(int type, |
| 80 const content::NotificationSource& source, | 80 const content::NotificationSource& source, |
| 81 const content::NotificationDetails& details) OVERRIDE; | 81 const content::NotificationDetails& details) OVERRIDE; |
| 82 | 82 |
| 83 // Sets the access_token as specified. This should be used only for testing. | 83 // Sets the access_token as specified. This should be used only for testing. |
| 84 void set_access_token_for_testing(const std::string& token) { | 84 void set_access_token_for_testing(const std::string& token) { |
| 85 access_token_ = token; | 85 access_token_ = token; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 102 // Note: This should remain the last member so it'll be destroyed and | 102 // Note: This should remain the last member so it'll be destroyed and |
| 103 // invalidate its weak pointers before any other members are destroyed. | 103 // invalidate its weak pointers before any other members are destroyed. |
| 104 base::WeakPtrFactory<AuthService> weak_ptr_factory_; | 104 base::WeakPtrFactory<AuthService> weak_ptr_factory_; |
| 105 | 105 |
| 106 DISALLOW_COPY_AND_ASSIGN(AuthService); | 106 DISALLOW_COPY_AND_ASSIGN(AuthService); |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 } // namespace gdata | 109 } // namespace gdata |
| 110 | 110 |
| 111 #endif // CHROME_BROWSER_CHROMEOS_GDATA_AUTH_SERVICE_H_ | 111 #endif // CHROME_BROWSER_CHROMEOS_GDATA_AUTH_SERVICE_H_ |
| OLD | NEW |