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

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: 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 73 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
74 // No-op if Profile was destroyed or GCMClient is disabled. 74 // No-op if Profile was destroyed or GCMClient is disabled.
75 if (!g_browser_process->profile_manager()->IsValidProfile(profile_)) 75 if (!g_browser_process->profile_manager()->IsValidProfile(profile_))
76 return; 76 return;
77 77
78 gcm::GCMProfileService* gcm_profile_service = 78 gcm::GCMProfileService* gcm_profile_service =
79 gcm::GCMProfileServiceFactory::GetForProfile(profile_); 79 gcm::GCMProfileServiceFactory::GetForProfile(profile_);
80 if (gcm_profile_service == NULL) 80 if (gcm_profile_service == NULL)
81 return; 81 return;
82 82
83 std::vector<std::string> sender_ids;
84 sender_ids.push_back(kInvalidationsSenderId);
85 gcm_profile_service->Register( 83 gcm_profile_service->Register(
86 kInvalidationsAppId, 84 kInvalidationsAppId,
87 sender_ids, 85 kInvalidationsSenderId,
88 kInvalidationsCert, 86 kInvalidationsCert,
89 base::Bind(&RegisterCall::RegisterFinishedOnUIThread, this)); 87 base::Bind(&RegisterCall::RegisterFinishedOnUIThread, this));
90 } 88 }
91 89
92 void RegisterCall::RegisterFinishedOnUIThread( 90 void RegisterCall::RegisterFinishedOnUIThread(
93 const std::string& registration_id, 91 const std::string& registration_id,
94 gcm::GCMClient::Result result) { 92 gcm::GCMClient::Result result) {
95 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 93 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
96 origin_thread_task_runner_->PostTask( 94 origin_thread_task_runner_->PostTask(
97 FROM_HERE, 95 FROM_HERE,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 176
179 ProfileOAuth2TokenService* oauth2_token_service = 177 ProfileOAuth2TokenService* oauth2_token_service =
180 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 178 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
181 std::string account_id = oauth2_token_service->GetPrimaryAccountId(); 179 std::string account_id = oauth2_token_service->GetPrimaryAccountId();
182 OAuth2TokenService::ScopeSet scopes; 180 OAuth2TokenService::ScopeSet scopes;
183 scopes.insert(GaiaConstants::kGoogleTalkOAuth2Scope); 181 scopes.insert(GaiaConstants::kGoogleTalkOAuth2Scope);
184 oauth2_token_service->InvalidateToken(account_id, scopes, token); 182 oauth2_token_service->InvalidateToken(account_id, scopes, token);
185 } 183 }
186 184
187 } // namespace invalidation 185 } // namespace invalidation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698