| OLD | NEW |
| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 void ExtensionGCMAppHandler::OnSendError( | 87 void ExtensionGCMAppHandler::OnSendError( |
| 88 const std::string& app_id, | 88 const std::string& app_id, |
| 89 const gcm::GCMClient::SendErrorDetails& send_error_details) { | 89 const gcm::GCMClient::SendErrorDetails& send_error_details) { |
| 90 #if !defined(OS_ANDROID) | 90 #if !defined(OS_ANDROID) |
| 91 js_event_router_->OnSendError(app_id, send_error_details); | 91 js_event_router_->OnSendError(app_id, send_error_details); |
| 92 #endif | 92 #endif |
| 93 } | 93 } |
| 94 | 94 |
| 95 void ExtensionGCMAppHandler::OnSendAcknowledged( |
| 96 const std::string& app_id, |
| 97 const std::string& message_id) { |
| 98 // This event is not exposed to JS API. It terminates here. |
| 99 } |
| 100 |
| 95 void ExtensionGCMAppHandler::OnExtensionLoaded( | 101 void ExtensionGCMAppHandler::OnExtensionLoaded( |
| 96 content::BrowserContext* browser_context, | 102 content::BrowserContext* browser_context, |
| 97 const Extension* extension) { | 103 const Extension* extension) { |
| 98 if (IsGCMPermissionEnabled(extension)) | 104 if (IsGCMPermissionEnabled(extension)) |
| 99 AddAppHandler(extension->id()); | 105 AddAppHandler(extension->id()); |
| 100 } | 106 } |
| 101 | 107 |
| 102 void ExtensionGCMAppHandler::OnExtensionUnloaded( | 108 void ExtensionGCMAppHandler::OnExtensionUnloaded( |
| 103 content::BrowserContext* browser_context, | 109 content::BrowserContext* browser_context, |
| 104 const Extension* extension, | 110 const Extension* extension, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 168 |
| 163 void ExtensionGCMAppHandler::AddAppHandler(const std::string& app_id) { | 169 void ExtensionGCMAppHandler::AddAppHandler(const std::string& app_id) { |
| 164 GetGCMDriver()->AddAppHandler(app_id, this); | 170 GetGCMDriver()->AddAppHandler(app_id, this); |
| 165 } | 171 } |
| 166 | 172 |
| 167 void ExtensionGCMAppHandler::RemoveAppHandler(const std::string& app_id) { | 173 void ExtensionGCMAppHandler::RemoveAppHandler(const std::string& app_id) { |
| 168 GetGCMDriver()->RemoveAppHandler(app_id); | 174 GetGCMDriver()->RemoveAppHandler(app_id); |
| 169 } | 175 } |
| 170 | 176 |
| 171 } // namespace extensions | 177 } // namespace extensions |
| OLD | NEW |