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

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: 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 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,
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 scoped_ptr<Event> event(new Event( 234 scoped_ptr<Event> event(new Event(
235 api::gcm::OnSendError::kEventName, 235 api::gcm::OnSendError::kEventName,
236 api::gcm::OnSendError::Create(error).Pass(), 236 api::gcm::OnSendError::Create(error).Pass(),
237 profile_)); 237 profile_));
238 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension( 238 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension(
239 app_id, event.Pass()); 239 app_id, event.Pass());
240 } 240 }
241 241
242 } // namespace extensions 242 } // 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_profile_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698