| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 75 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 76 // No-op if Profile was destroyed or GCMClient is disabled. | 76 // No-op if Profile was destroyed or GCMClient is disabled. |
| 77 if (!g_browser_process->profile_manager()->IsValidProfile(profile_)) | 77 if (!g_browser_process->profile_manager()->IsValidProfile(profile_)) |
| 78 return; | 78 return; |
| 79 | 79 |
| 80 gcm::GCMProfileService* gcm_profile_service = | 80 gcm::GCMProfileService* gcm_profile_service = |
| 81 gcm::GCMProfileServiceFactory::GetForProfile(profile_); | 81 gcm::GCMProfileServiceFactory::GetForProfile(profile_); |
| 82 if (gcm_profile_service == NULL) | 82 if (gcm_profile_service == NULL) |
| 83 return; | 83 return; |
| 84 | 84 |
| 85 std::vector<std::string> sender_ids; | |
| 86 sender_ids.push_back(kInvalidationsSenderId); | |
| 87 gcm_profile_service->Register( | 85 gcm_profile_service->Register( |
| 88 kInvalidationsAppId, | 86 kInvalidationsAppId, |
| 89 sender_ids, | 87 kInvalidationsSenderId, |
| 90 kInvalidationsCert, | 88 kInvalidationsCert, |
| 91 base::Bind(&RegisterCall::RegisterFinishedOnUIThread, this)); | 89 base::Bind(&RegisterCall::RegisterFinishedOnUIThread, this)); |
| 92 } | 90 } |
| 93 | 91 |
| 94 void RegisterCall::RegisterFinishedOnUIThread( | 92 void RegisterCall::RegisterFinishedOnUIThread( |
| 95 const std::string& registration_id, | 93 const std::string& registration_id, |
| 96 gcm::GCMClient::Result result) { | 94 gcm::GCMClient::Result result) { |
| 97 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 95 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 98 origin_thread_task_runner_->PostTask( | 96 origin_thread_task_runner_->PostTask( |
| 99 FROM_HERE, | 97 FROM_HERE, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 180 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
| 183 SigninManagerBase* signin_manager = | 181 SigninManagerBase* signin_manager = |
| 184 SigninManagerFactory::GetForProfile(profile); | 182 SigninManagerFactory::GetForProfile(profile); |
| 185 std::string account_id = signin_manager->GetAuthenticatedAccountId(); | 183 std::string account_id = signin_manager->GetAuthenticatedAccountId(); |
| 186 OAuth2TokenService::ScopeSet scopes; | 184 OAuth2TokenService::ScopeSet scopes; |
| 187 scopes.insert(GaiaConstants::kGoogleTalkOAuth2Scope); | 185 scopes.insert(GaiaConstants::kGoogleTalkOAuth2Scope); |
| 188 oauth2_token_service->InvalidateToken(account_id, scopes, token); | 186 oauth2_token_service->InvalidateToken(account_id, scopes, token); |
| 189 } | 187 } |
| 190 | 188 |
| 191 } // namespace invalidation | 189 } // namespace invalidation |
| OLD | NEW |