Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: chrome/browser/invalidation/gcm_network_channel_delegate_impl.cc

Issue 183923006: [GCM] API update to allow only a single sender in registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updates based on CR. Changing how the senders/reg_ids are stored to avoid upgrade to multiple sedne… Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698