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

Side by Side Diff: chrome/browser/extensions/extension_gcm_app_handler.cc

Issue 242613004: Replace NOTIFICATION_EXTENSION_LOADED to NOTIFICATION_EXTENSION_LOADED_DEPRECATED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/extension_gcm_app_handler.h" 5 #include "chrome/browser/extensions/extension_gcm_app_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 29 matching lines...) Expand all
40 BrowserContextKeyedAPIFactory<ExtensionGCMAppHandler>* 40 BrowserContextKeyedAPIFactory<ExtensionGCMAppHandler>*
41 ExtensionGCMAppHandler::GetFactoryInstance() { 41 ExtensionGCMAppHandler::GetFactoryInstance() {
42 return g_factory.Pointer(); 42 return g_factory.Pointer();
43 } 43 }
44 44
45 ExtensionGCMAppHandler::ExtensionGCMAppHandler(content::BrowserContext* context) 45 ExtensionGCMAppHandler::ExtensionGCMAppHandler(content::BrowserContext* context)
46 : profile_(Profile::FromBrowserContext(context)), 46 : profile_(Profile::FromBrowserContext(context)),
47 weak_factory_(this) { 47 weak_factory_(this) {
48 // Listen to various extension related notifications. 48 // Listen to various extension related notifications.
49 registrar_.Add(this, 49 registrar_.Add(this,
50 chrome::NOTIFICATION_EXTENSION_LOADED, 50 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
51 content::Source<Profile>(profile_)); 51 content::Source<Profile>(profile_));
52 registrar_.Add(this, 52 registrar_.Add(this,
53 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, 53 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
54 content::Source<Profile>(profile_)); 54 content::Source<Profile>(profile_));
55 registrar_.Add(this, 55 registrar_.Add(this,
56 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, 56 chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
57 content::Source<Profile>(profile_)); 57 content::Source<Profile>(profile_));
58 58
59 #if !defined(OS_ANDROID) 59 #if !defined(OS_ANDROID)
60 js_event_router_.reset(new extensions::GcmJsEventRouter(profile_)); 60 js_event_router_.reset(new extensions::GcmJsEventRouter(profile_));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 #if !defined(OS_ANDROID) 98 #if !defined(OS_ANDROID)
99 js_event_router_->OnSendError(app_id, send_error_details); 99 js_event_router_->OnSendError(app_id, send_error_details);
100 #endif 100 #endif
101 } 101 }
102 102
103 void ExtensionGCMAppHandler::Observe( 103 void ExtensionGCMAppHandler::Observe(
104 int type, 104 int type,
105 const content::NotificationSource& source, 105 const content::NotificationSource& source,
106 const content::NotificationDetails& details) { 106 const content::NotificationDetails& details) {
107 switch (type) { 107 switch (type) {
108 case chrome:: NOTIFICATION_EXTENSION_LOADED: { 108 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: {
109 const Extension* extension = content::Details<Extension>(details).ptr(); 109 const Extension* extension = content::Details<Extension>(details).ptr();
110 if (IsGCMPermissionEnabled(extension)) 110 if (IsGCMPermissionEnabled(extension))
111 GetGCMProfileService()->AddAppHandler(extension->id(), this); 111 GetGCMProfileService()->AddAppHandler(extension->id(), this);
112 break; 112 break;
113 } 113 }
114 case chrome:: NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { 114 case chrome:: NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
115 const Extension* extension = 115 const Extension* extension =
116 content::Details<UnloadedExtensionInfo>(details)->extension; 116 content::Details<UnloadedExtensionInfo>(details)->extension;
117 if (IsGCMPermissionEnabled(extension)) 117 if (IsGCMPermissionEnabled(extension))
118 GetGCMProfileService()->RemoveAppHandler(extension->id()); 118 GetGCMProfileService()->RemoveAppHandler(extension->id());
(...skipping 19 matching lines...) Expand all
138 gcm::GCMProfileService* ExtensionGCMAppHandler::GetGCMProfileService() const { 138 gcm::GCMProfileService* ExtensionGCMAppHandler::GetGCMProfileService() const {
139 return gcm::GCMProfileServiceFactory::GetForProfile(profile_); 139 return gcm::GCMProfileServiceFactory::GetForProfile(profile_);
140 } 140 }
141 141
142 void ExtensionGCMAppHandler::OnUnregisterCompleted( 142 void ExtensionGCMAppHandler::OnUnregisterCompleted(
143 const std::string& app_id, gcm::GCMClient::Result result) { 143 const std::string& app_id, gcm::GCMClient::Result result) {
144 // Nothing to do. 144 // Nothing to do.
145 } 145 }
146 146
147 } // namespace extensions 147 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698