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 #include "chrome/browser/chromeos/gdata/gdata_auth_service.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_auth_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 base::Bind(callback, gdata::HTTP_UNAUTHORIZED, std::string())); | 74 base::Bind(callback, gdata::HTTP_UNAUTHORIZED, std::string())); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 void GDataAuthService::StartAuthenticationOnUIThread( | 78 void GDataAuthService::StartAuthenticationOnUIThread( |
79 GDataOperationRegistry* registry, | 79 GDataOperationRegistry* registry, |
80 scoped_refptr<base::MessageLoopProxy> relay_proxy, | 80 scoped_refptr<base::MessageLoopProxy> relay_proxy, |
81 const AuthStatusCallback& callback) { | 81 const AuthStatusCallback& callback) { |
82 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 82 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
83 // We have refresh token, let's gets authenticated. | 83 // We have refresh token, let's gets authenticated. |
84 (new AuthOperation(registry, profile_, | 84 (new AuthOperation(registry, callback, refresh_token_))->Start(); |
85 callback, refresh_token_))->Start(); | |
86 } | 85 } |
87 | 86 |
88 void GDataAuthService::OnAuthCompleted( | 87 void GDataAuthService::OnAuthCompleted( |
89 scoped_refptr<base::MessageLoopProxy> relay_proxy, | 88 scoped_refptr<base::MessageLoopProxy> relay_proxy, |
90 const AuthStatusCallback& callback, | 89 const AuthStatusCallback& callback, |
91 GDataErrorCode error, | 90 GDataErrorCode error, |
92 const std::string& access_token) { | 91 const std::string& access_token) { |
93 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
94 | 93 |
95 if (error == HTTP_SUCCESS) | 94 if (error == HTTP_SUCCESS) |
(...skipping 27 matching lines...) Expand all Loading... |
123 if (type == chrome::NOTIFICATION_TOKEN_AVAILABLE) { | 122 if (type == chrome::NOTIFICATION_TOKEN_AVAILABLE) { |
124 TokenService* service = TokenServiceFactory::GetForProfile(profile_); | 123 TokenService* service = TokenServiceFactory::GetForProfile(profile_); |
125 refresh_token_ = service->GetOAuth2LoginRefreshToken(); | 124 refresh_token_ = service->GetOAuth2LoginRefreshToken(); |
126 } else { | 125 } else { |
127 refresh_token_.clear(); | 126 refresh_token_.clear(); |
128 } | 127 } |
129 FOR_EACH_OBSERVER(Observer, observers_, OnOAuth2RefreshTokenChanged()); | 128 FOR_EACH_OBSERVER(Observer, observers_, OnOAuth2RefreshTokenChanged()); |
130 } | 129 } |
131 | 130 |
132 } // namespace gdata | 131 } // namespace gdata |
OLD | NEW |