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

Side by Side Diff: chrome/browser/extensions/api/gcm/gcm_api.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/api/gcm/gcm_api.h" 5 #include "chrome/browser/extensions/api/gcm/gcm_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 EXTENSION_FUNCTION_VALIDATE(params.get()); 122 EXTENSION_FUNCTION_VALIDATE(params.get());
123 123
124 if (GetExtension()->public_key().empty()) { 124 if (GetExtension()->public_key().empty()) {
125 CompleteFunctionWithResult(std::string(), 125 CompleteFunctionWithResult(std::string(),
126 gcm::GCMClient::CERTIFICATE_MISSING); 126 gcm::GCMClient::CERTIFICATE_MISSING);
127 return false; 127 return false;
128 } 128 }
129 129
130 GCMProfileService()->Register( 130 GCMProfileService()->Register(
131 GetExtension()->id(), 131 GetExtension()->id(),
132 params->sender_ids, 132 params->sender_id,
jianli 2014/03/03 21:29:31 Do we want to validate if the sender ID is empty h
fgorski 2014/03/03 23:14:16 This is already done by the gcm.json, and covered
133 SHA1HashHexString(GetExtension()->public_key()), 133 SHA1HashHexString(GetExtension()->public_key()),
134 base::Bind(&GcmRegisterFunction::CompleteFunctionWithResult, this)); 134 base::Bind(&GcmRegisterFunction::CompleteFunctionWithResult, this));
135 135
136 return true; 136 return true;
137 } 137 }
138 138
139 void GcmRegisterFunction::CompleteFunctionWithResult( 139 void GcmRegisterFunction::CompleteFunctionWithResult(
140 const std::string& registration_id, 140 const std::string& registration_id,
141 gcm::GCMClient::Result result) { 141 gcm::GCMClient::Result result) {
142 SetResult(base::Value::CreateStringValue(registration_id)); 142 SetResult(base::Value::CreateStringValue(registration_id));
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 scoped_ptr<Event> event(new Event( 232 scoped_ptr<Event> event(new Event(
233 api::gcm::OnSendError::kEventName, 233 api::gcm::OnSendError::kEventName,
234 api::gcm::OnSendError::Create(error).Pass(), 234 api::gcm::OnSendError::Create(error).Pass(),
235 profile_)); 235 profile_));
236 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension( 236 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension(
237 app_id, event.Pass()); 237 app_id, event.Pass());
238 } 238 }
239 239
240 } // namespace extensions 240 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/gcm/gcm_apitest.cc » ('j') | chrome/browser/services/gcm/gcm_client_mock.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698