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

Side by Side Diff: chrome/browser/extensions/api/gcm/gcm_api.cc

Issue 130473002: [GCM] Make GCM API not work in incognito mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch to land Created 6 years, 11 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 | chrome/browser/extensions/api/gcm/gcm_apitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 namespace extensions { 78 namespace extensions {
79 79
80 bool GcmApiFunction::RunImpl() { 80 bool GcmApiFunction::RunImpl() {
81 if (!IsGcmApiEnabled()) 81 if (!IsGcmApiEnabled())
82 return false; 82 return false;
83 83
84 return DoWork(); 84 return DoWork();
85 } 85 }
86 86
87 bool GcmApiFunction::IsGcmApiEnabled() const { 87 bool GcmApiFunction::IsGcmApiEnabled() const {
88 return gcm::GCMProfileService::IsGCMEnabled() && 88 return gcm::GCMProfileService::IsGCMEnabled(
89 !GetExtension()->public_key().empty(); 89 Profile::FromBrowserContext(context())) &&
90 !GetExtension()->public_key().empty();
90 } 91 }
91 92
92 gcm::GCMProfileService* GcmApiFunction::GCMProfileService() const { 93 gcm::GCMProfileService* GcmApiFunction::GCMProfileService() const {
93 return gcm::GCMProfileServiceFactory::GetForProfile( 94 return gcm::GCMProfileServiceFactory::GetForProfile(
94 Profile::FromBrowserContext(context())); 95 Profile::FromBrowserContext(context()));
95 } 96 }
96 97
97 GcmRegisterFunction::GcmRegisterFunction() {} 98 GcmRegisterFunction::GcmRegisterFunction() {}
98 99
99 GcmRegisterFunction::~GcmRegisterFunction() {} 100 GcmRegisterFunction::~GcmRegisterFunction() {}
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 213
213 scoped_ptr<Event> event(new Event( 214 scoped_ptr<Event> event(new Event(
214 api::gcm::OnSendError::kEventName, 215 api::gcm::OnSendError::kEventName,
215 api::gcm::OnSendError::Create(error).Pass(), 216 api::gcm::OnSendError::Create(error).Pass(),
216 profile_)); 217 profile_));
217 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension( 218 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension(
218 app_id, event.Pass()); 219 app_id, event.Pass());
219 } 220 }
220 221
221 } // namespace extensions 222 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/gcm/gcm_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698