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

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

Issue 14238037: Made it possible to tell whether an extension is being installed or updated. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added extra check. Created 7 years, 7 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
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/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 return; 309 return;
310 310
311 if (!event_router_) 311 if (!event_router_)
312 event_router_.reset(new PushMessagingEventRouter(profile_)); 312 event_router_.reset(new PushMessagingEventRouter(profile_));
313 if (!handler_) { 313 if (!handler_) {
314 handler_.reset(new PushMessagingInvalidationHandler( 314 handler_.reset(new PushMessagingInvalidationHandler(
315 pss, event_router_.get())); 315 pss, event_router_.get()));
316 } 316 }
317 switch (type) { 317 switch (type) {
318 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { 318 case chrome::NOTIFICATION_EXTENSION_INSTALLED: {
319 const Extension* extension = content::Details<Extension>(details).ptr(); 319 const Extension* extension =
320 content::Details<const InstalledExtensionInfo>(details)->extension;
320 if (extension->HasAPIPermission(APIPermission::kPushMessaging)) { 321 if (extension->HasAPIPermission(APIPermission::kPushMessaging)) {
321 handler_->SuppressInitialInvalidationsForExtension(extension->id()); 322 handler_->SuppressInitialInvalidationsForExtension(extension->id());
322 } 323 }
323 break; 324 break;
324 } 325 }
325 case chrome::NOTIFICATION_EXTENSION_LOADED: { 326 case chrome::NOTIFICATION_EXTENSION_LOADED: {
326 const Extension* extension = content::Details<Extension>(details).ptr(); 327 const Extension* extension = content::Details<Extension>(details).ptr();
327 if (extension->HasAPIPermission(APIPermission::kPushMessaging)) { 328 if (extension->HasAPIPermission(APIPermission::kPushMessaging)) {
328 handler_->RegisterExtension(extension->id()); 329 handler_->RegisterExtension(extension->id());
329 } 330 }
(...skipping 17 matching lines...) Expand all
347 handler_ = mapper.Pass(); 348 handler_ = mapper.Pass();
348 } 349 }
349 350
350 template <> 351 template <>
351 void ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() { 352 void ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() {
352 DependsOn(ExtensionSystemFactory::GetInstance()); 353 DependsOn(ExtensionSystemFactory::GetInstance());
353 DependsOn(ProfileSyncServiceFactory::GetInstance()); 354 DependsOn(ProfileSyncServiceFactory::GetInstance());
354 } 355 }
355 356
356 } // namespace extensions 357 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/management/management_api.cc ('k') | chrome/browser/extensions/convert_web_app_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698