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

Side by Side Diff: chrome/browser/extensions/api/push_messaging/push_messaging_api.cc

Issue 10879082: Change the separator for chhanel id to a / for consistency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/push_messaging/push_messaging_api.h" 5 #include "chrome/browser/extensions/api/push_messaging/push_messaging_api.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 16 matching lines...) Expand all
27 #include "chrome/browser/profiles/profile_manager.h" 27 #include "chrome/browser/profiles/profile_manager.h"
28 #include "chrome/browser/signin/token_service.h" 28 #include "chrome/browser/signin/token_service.h"
29 #include "chrome/browser/signin/token_service_factory.h" 29 #include "chrome/browser/signin/token_service_factory.h"
30 #include "chrome/common/extensions/api/experimental_push_messaging.h" 30 #include "chrome/common/extensions/api/experimental_push_messaging.h"
31 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
32 #include "googleurl/src/gurl.h" 32 #include "googleurl/src/gurl.h"
33 #include "chrome/browser/extensions/api/push_messaging/obfuscated_gaia_id_fetche r.h" 33 #include "chrome/browser/extensions/api/push_messaging/obfuscated_gaia_id_fetche r.h"
34 34
35 using content::BrowserThread; 35 using content::BrowserThread;
36 36
37 namespace {
38 static const char kChannelIdSeparator[] = "/";
39 }
40
37 namespace extensions { 41 namespace extensions {
38 42
39 namespace glue = api::experimental_push_messaging; 43 namespace glue = api::experimental_push_messaging;
40 44
41 PushMessagingEventRouter::PushMessagingEventRouter(Profile* profile) 45 PushMessagingEventRouter::PushMessagingEventRouter(Profile* profile)
42 : profile_(profile) { 46 : profile_(profile) {
43 } 47 }
44 48
45 PushMessagingEventRouter::~PushMessagingEventRouter() {} 49 PushMessagingEventRouter::~PushMessagingEventRouter() {}
46 50
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return true; 162 return true;
159 } 163 }
160 164
161 void PushMessagingGetChannelIdFunction::ReportResult( 165 void PushMessagingGetChannelIdFunction::ReportResult(
162 const std::string& gaia_id, const std::string& error_string) { 166 const std::string& gaia_id, const std::string& error_string) {
163 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 167 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
164 // Unpack the status and GaiaId parameters, and use it to build the 168 // Unpack the status and GaiaId parameters, and use it to build the
165 // channel ID here. 169 // channel ID here.
166 std::string channel_id(gaia_id); 170 std::string channel_id(gaia_id);
167 if (!gaia_id.empty()) { 171 if (!gaia_id.empty()) {
168 channel_id += "."; 172 channel_id += kChannelIdSeparator;
169 channel_id += extension_id(); 173 channel_id += extension_id();
170 } 174 }
171 175
172 // TODO(petewil): It may be a good idea to further 176 // TODO(petewil): It may be a good idea to further
173 // obfuscate the channel ID to prevent the user's obfuscated GAIA ID 177 // obfuscate the channel ID to prevent the user's obfuscated GAIA ID
174 // from being readily obtained. Security review will tell us if we need to. 178 // from being readily obtained. Security review will tell us if we need to.
175 179
176 // Create a ChannelId results object and set the fields. 180 // Create a ChannelId results object and set the fields.
177 glue::ChannelIdResult result; 181 glue::ChannelIdResult result;
178 result.channel_id = channel_id; 182 result.channel_id = channel_id;
179 SetError(error_string); 183 SetError(error_string);
180 results_ = glue::GetChannelId::Results::Create(result); 184 results_ = glue::GetChannelId::Results::Create(result);
181 SendResponse(true); 185 SendResponse(true);
182 186
183 // Balanced in RunImpl 187 // Balanced in RunImpl
184 Release(); 188 Release();
185 } 189 }
186 190
187 void PushMessagingGetChannelIdFunction::OnObfuscatedGaiaIdFetchSuccess( 191 void PushMessagingGetChannelIdFunction::OnObfuscatedGaiaIdFetchSuccess(
188 const std::string& gaia_id) { 192 const std::string& gaia_id) {
189 ReportResult(gaia_id, std::string()); 193 ReportResult(gaia_id, std::string());
190 } 194 }
191 195
192 void PushMessagingGetChannelIdFunction::OnObfuscatedGaiaIdFetchFailure( 196 void PushMessagingGetChannelIdFunction::OnObfuscatedGaiaIdFetchFailure(
193 const GoogleServiceAuthError& error) { 197 const GoogleServiceAuthError& error) {
194 ReportResult(std::string(), error.error_message()); 198 ReportResult(std::string(), error.error_message());
195 } 199 }
196 200
197 } // namespace extensions 201 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698