Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 30 matching lines...) Expand all Loading... | |
| 41 namespace extensions { | 41 namespace extensions { |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 const char kChannelIdSeparator[] = "/"; | 44 const char kChannelIdSeparator[] = "/"; |
| 45 const char kUserNotSignedIn[] = "The user is not signed in."; | 45 const char kUserNotSignedIn[] = "The user is not signed in."; |
| 46 const char kUserAccessTokenFailure[] = | 46 const char kUserAccessTokenFailure[] = |
| 47 "Cannot obtain access token for the user."; | 47 "Cannot obtain access token for the user."; |
| 48 const char kAPINotAvailableForUser[] = | 48 const char kAPINotAvailableForUser[] = |
| 49 "The API is not available for this user."; | 49 "The API is not available for this user."; |
| 50 const int kObfuscatedGaiaIdTimeoutInDays = 30; | 50 const int kObfuscatedGaiaIdTimeoutInDays = 30; |
| 51 } | 51 const char kDeprecationMessage[] = |
| 52 "The chrome.pushMessaging API is deprecated. Use chrome.gcm API instead."; | |
| 53 } // namespace | |
| 52 | 54 |
| 53 namespace glue = api::push_messaging; | 55 namespace glue = api::push_messaging; |
| 54 | 56 |
| 55 PushMessagingEventRouter::PushMessagingEventRouter( | 57 PushMessagingEventRouter::PushMessagingEventRouter( |
| 56 content::BrowserContext* context) | 58 content::BrowserContext* context) |
| 57 : browser_context_(context) { | 59 : browser_context_(context) { |
| 58 } | 60 } |
| 59 | 61 |
| 60 PushMessagingEventRouter::~PushMessagingEventRouter() {} | 62 PushMessagingEventRouter::~PushMessagingEventRouter() {} |
| 61 | 63 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 87 | 89 |
| 88 // GetChannelId class functions | 90 // GetChannelId class functions |
| 89 | 91 |
| 90 PushMessagingGetChannelIdFunction::PushMessagingGetChannelIdFunction() | 92 PushMessagingGetChannelIdFunction::PushMessagingGetChannelIdFunction() |
| 91 : OAuth2TokenService::Consumer("push_messaging"), | 93 : OAuth2TokenService::Consumer("push_messaging"), |
| 92 interactive_(false) {} | 94 interactive_(false) {} |
| 93 | 95 |
| 94 PushMessagingGetChannelIdFunction::~PushMessagingGetChannelIdFunction() {} | 96 PushMessagingGetChannelIdFunction::~PushMessagingGetChannelIdFunction() {} |
| 95 | 97 |
| 96 bool PushMessagingGetChannelIdFunction::RunAsync() { | 98 bool PushMessagingGetChannelIdFunction::RunAsync() { |
| 99 // Issue a deprecation message. | |
| 100 WriteToConsole(content::CONSOLE_MESSAGE_LEVEL_WARNING, kDeprecationMessage); | |
|
not at google - send to devlin
2014/08/14 22:16:08
How often do apps call this method? Because if it'
fgorski
2014/08/20 22:46:47
I am seeing it used very rarely (2 other APIs).
ap
| |
| 101 | |
|
not at google - send to devlin
2014/08/14 22:16:08
Also: we should add an install warning for when th
Yoyo Zhou
2014/08/15 01:40:13
chrome_api_permissions?
I'm not sure I follow "in
not at google - send to devlin
2014/08/15 15:54:17
I mean the same warning that shows up if you reque
Yoyo Zhou
2014/08/15 19:25:31
I dunno, I would just try calling extension->AddIn
fgorski
2014/08/20 22:46:46
We could add a check for deprecated permissions in
not at google - send to devlin
2014/08/21 00:36:33
I've wanted this actually, a feature file annotati
| |
| 97 // Fetch the function arguments. | 102 // Fetch the function arguments. |
| 98 scoped_ptr<glue::GetChannelId::Params> params( | 103 scoped_ptr<glue::GetChannelId::Params> params( |
| 99 glue::GetChannelId::Params::Create(*args_)); | 104 glue::GetChannelId::Params::Create(*args_)); |
| 100 EXTENSION_FUNCTION_VALIDATE(params.get()); | 105 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 101 | 106 |
| 102 if (params && params->interactive) { | 107 if (params && params->interactive) { |
| 103 interactive_ = *params->interactive; | 108 interactive_ = *params->interactive; |
| 104 } | 109 } |
| 105 | 110 |
| 106 // Balanced in ReportResult() | 111 // Balanced in ReportResult() |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 | 387 |
| 383 template <> | 388 template <> |
| 384 void | 389 void |
| 385 BrowserContextKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() { | 390 BrowserContextKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() { |
| 386 DependsOn(ExtensionRegistryFactory::GetInstance()); | 391 DependsOn(ExtensionRegistryFactory::GetInstance()); |
| 387 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); | 392 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
| 388 DependsOn(invalidation::ProfileInvalidationProviderFactory::GetInstance()); | 393 DependsOn(invalidation::ProfileInvalidationProviderFactory::GetInstance()); |
| 389 } | 394 } |
| 390 | 395 |
| 391 } // namespace extensions | 396 } // namespace extensions |
| OLD | NEW |