diff options
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r-- | chrome/browser/extensions/api/notification/notification_api.h | 92 | ||||
-rw-r--r-- | chrome/browser/extensions/api/notifications/notifications_api.cc (renamed from chrome/browser/extensions/api/notification/notification_api.cc) | 122 | ||||
-rw-r--r-- | chrome/browser/extensions/api/notifications/notifications_api.h | 94 | ||||
-rw-r--r-- | chrome/browser/extensions/api/notifications/notifications_api_unittest.cc | 48 | ||||
-rw-r--r-- | chrome/browser/extensions/api/notifications/notifications_apitest.cc (renamed from chrome/browser/extensions/api/notification/notification_apitest.cc) | 53 | ||||
-rw-r--r-- | chrome/browser/extensions/event_names.cc | 11 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_function_histogram_value.h | 6 |
7 files changed, 246 insertions, 180 deletions
diff --git a/chrome/browser/extensions/api/notification/notification_api.h b/chrome/browser/extensions/api/notification/notification_api.h deleted file mode 100644 index a685758..0000000 --- a/chrome/browser/extensions/api/notification/notification_api.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_API_H_ -#define CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_API_H_ - -#include <string> - -#include "base/memory/ref_counted.h" -#include "chrome/browser/extensions/api/api_function.h" -#include "chrome/browser/extensions/extension_function.h" -#include "chrome/common/extensions/api/experimental_notification.h" -#include "ui/message_center/notification_types.h" - -namespace extensions { - -class NotificationApiFunction : public ApiFunction { - protected: - NotificationApiFunction(); - virtual ~NotificationApiFunction(); - - void CreateNotification( - const std::string& id, - api::experimental_notification::NotificationOptions* options); - - bool IsNotificationApiEnabled(); - - // Called inside of RunImpl. - virtual bool RunNotificationApi() = 0; - - // UITHreadExtensionFunction: - virtual bool RunImpl() OVERRIDE; - - message_center::NotificationType MapApiTemplateTypeToType( - api::experimental_notification::TemplateType type); -}; - -class NotificationCreateFunction : public NotificationApiFunction { - public: - NotificationCreateFunction(); - - // UIThreadExtensionFunction: - virtual bool RunNotificationApi() OVERRIDE; - - protected: - virtual ~NotificationCreateFunction(); - - private: - scoped_ptr<api::experimental_notification::Create::Params> params_; - - DECLARE_EXTENSION_FUNCTION("experimental.notification.create", - EXPERIMENTAL_NOTIFICATION_CREATE) -}; - -class NotificationUpdateFunction : public NotificationApiFunction { - public: - NotificationUpdateFunction(); - - // UIThreadExtensionFunction: - virtual bool RunNotificationApi() OVERRIDE; - - protected: - virtual ~NotificationUpdateFunction(); - - private: - scoped_ptr<api::experimental_notification::Update::Params> params_; - - DECLARE_EXTENSION_FUNCTION("experimental.notification.update", - EXPERIMENTAL_NOTIFICATION_UPDATE) -}; - -class NotificationClearFunction : public NotificationApiFunction { - public: - NotificationClearFunction(); - - // UIThreadExtensionFunction: - virtual bool RunNotificationApi() OVERRIDE; - - protected: - virtual ~NotificationClearFunction(); - - private: - scoped_ptr<api::experimental_notification::Clear::Params> params_; - - DECLARE_EXTENSION_FUNCTION("experimental.notification.clear", - EXPERIMENTAL_NOTIFICATION_CLEAR) -}; - -} // namespace extensions - -#endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_API_H_ diff --git a/chrome/browser/extensions/api/notification/notification_api.cc b/chrome/browser/extensions/api/notifications/notifications_api.cc index b16ac91..3a96441 100644 --- a/chrome/browser/extensions/api/notification/notification_api.cc +++ b/chrome/browser/extensions/api/notifications/notifications_api.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/notification/notification_api.h" +#include "chrome/browser/extensions/api/notifications/notifications_api.h" #include "base/callback.h" #include "base/strings/string_number_conversions.h" @@ -15,7 +15,9 @@ #include "chrome/browser/notifications/desktop_notification_service_factory.h" #include "chrome/browser/notifications/notification.h" #include "chrome/browser/notifications/notification_ui_manager.h" +#include "chrome/common/chrome_version_info.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/features/feature.h" #include "googleurl/src/gurl.h" namespace extensions { @@ -24,9 +26,9 @@ namespace { const char kResultKey[] = "result"; -class NotificationApiDelegate : public NotificationDelegate { +class NotificationsApiDelegate : public NotificationDelegate { public: - NotificationApiDelegate(ApiFunction* api_function, + NotificationsApiDelegate(ApiFunction* api_function, Profile* profile, const std::string& extension_id, const std::string& id) @@ -85,7 +87,7 @@ class NotificationApiDelegate : public NotificationDelegate { } private: - virtual ~NotificationApiDelegate() {} + virtual ~NotificationsApiDelegate() {} void SendEvent(const std::string& name, scoped_ptr<ListValue> args) { scoped_ptr<Event> event(new Event(name, args.Pass())); @@ -105,43 +107,37 @@ class NotificationApiDelegate : public NotificationDelegate { const std::string id_; const std::string scoped_id_; - DISALLOW_COPY_AND_ASSIGN(NotificationApiDelegate); + DISALLOW_COPY_AND_ASSIGN(NotificationsApiDelegate); }; } // namespace -NotificationApiFunction::NotificationApiFunction() { +bool NotificationsApiFunction::IsNotificationsApiAvailable() { + // TODO(miket): remove/change this check when we leave dev. + if (chrome::VersionInfo::CHANNEL_DEV < Feature::GetCurrentChannel()) + return false; + + // We need to check this explicitly rather than letting + // _permission_features.json enforce it, because we're sharing the + // chrome.notifications permissions namespace with WebKit notifications. + if (!(GetExtension()->is_platform_app() || GetExtension()->is_extension())) + return false; + + return true; } -NotificationApiFunction::~NotificationApiFunction() { +NotificationsApiFunction::NotificationsApiFunction() { } -message_center::NotificationType -NotificationApiFunction::MapApiTemplateTypeToType( - api::experimental_notification::TemplateType type) { - switch (type) { - case api::experimental_notification::TEMPLATE_TYPE_NONE: - case api::experimental_notification::TEMPLATE_TYPE_SIMPLE: - return message_center::NOTIFICATION_TYPE_SIMPLE; - case api::experimental_notification::TEMPLATE_TYPE_BASIC: - return message_center::NOTIFICATION_TYPE_BASE_FORMAT; - case api::experimental_notification::TEMPLATE_TYPE_IMAGE: - return message_center::NOTIFICATION_TYPE_IMAGE; - case api::experimental_notification::TEMPLATE_TYPE_LIST: - return message_center::NOTIFICATION_TYPE_MULTIPLE; - default: - // Gracefully handle newer application code that is running on an older - // runtime that doesn't recognize the requested template. - return message_center::NOTIFICATION_TYPE_BASE_FORMAT; - } +NotificationsApiFunction::~NotificationsApiFunction() { } // If older notification runtime is used, MessageCenter is not built. // Use simpler bridge then, ignoring all options. #if !defined (ENABLE_MESSAGE_CENTER) -void NotificationApiFunction::CreateNotification( +void NotificationsApiFunction::CreateNotification( const std::string& id, - api::experimental_notification::NotificationOptions* options) { + api::notifications::NotificationOptions* options) { message_center::NotificationType type = MapApiTemplateTypeToType(options->template_type); GURL icon_url(UTF8ToUTF16(options->icon_url)); @@ -151,7 +147,7 @@ void NotificationApiFunction::CreateNotification( // Ignore options if running on the old notification runtime. scoped_ptr<DictionaryValue> optional_fields(new DictionaryValue()); - NotificationApiDelegate* api_delegate(new NotificationApiDelegate( + NotificationsApiDelegate* api_delegate(new NotificationsApiDelegate( this, profile(), extension_->id(), @@ -164,9 +160,9 @@ void NotificationApiFunction::CreateNotification( g_browser_process->notification_ui_manager()->Add(notification, profile()); } #else // defined(ENABLE_MESSAGE_CENTER) -void NotificationApiFunction::CreateNotification( +void NotificationsApiFunction::CreateNotification( const std::string& id, - api::experimental_notification::NotificationOptions* options) { + api::notifications::NotificationOptions* options) { message_center::NotificationType type = MapApiTemplateTypeToType(options->template_type); GURL icon_url(UTF8ToUTF16(options->icon_url)); @@ -184,7 +180,7 @@ void NotificationApiFunction::CreateNotification( *options->event_time); if (options->buttons.get()) { if (options->buttons->size() > 0) { - linked_ptr<api::experimental_notification::NotificationButton> button = + linked_ptr<api::notifications::NotificationButton> button = (*options->buttons)[0]; optional_fields->SetString(message_center::kButtonOneTitleKey, UTF8ToUTF16(button->title)); @@ -193,7 +189,7 @@ void NotificationApiFunction::CreateNotification( UTF8ToUTF16(*button->icon_url)); } if (options->buttons->size() > 1) { - linked_ptr<api::experimental_notification::NotificationButton> button = + linked_ptr<api::notifications::NotificationButton> button = (*options->buttons)[1]; optional_fields->SetString(message_center::kButtonTwoTitleKey, UTF8ToUTF16(button->title)); @@ -220,7 +216,7 @@ void NotificationApiFunction::CreateNotification( base::ListValue* items = new base::ListValue(); std::vector< linked_ptr< - api::experimental_notification::NotificationItem> >::iterator i; + api::notifications::NotificationItem> >::iterator i; for (i = options->items->begin(); i != options->items->end(); ++i) { base::DictionaryValue* item = new base::DictionaryValue(); item->SetString(message_center::kItemTitleKey, @@ -232,7 +228,7 @@ void NotificationApiFunction::CreateNotification( optional_fields->Set(message_center::kItemsKey, items); } - NotificationApiDelegate* api_delegate(new NotificationApiDelegate( + NotificationsApiDelegate* api_delegate(new NotificationsApiDelegate( this, profile(), extension_->id(), @@ -246,33 +242,53 @@ void NotificationApiFunction::CreateNotification( } #endif // !defined(ENABLE_MESSAGE_CENTER) -bool NotificationApiFunction::IsNotificationApiEnabled() { +bool NotificationsApiFunction::IsNotificationsApiEnabled() { DesktopNotificationService* service = DesktopNotificationServiceFactory::GetForProfile(profile()); return service->IsExtensionEnabled(extension_->id()); } -bool NotificationApiFunction::RunImpl() { - if (!IsNotificationApiEnabled()) { +bool NotificationsApiFunction::RunImpl() { + if (IsNotificationsApiAvailable() && IsNotificationsApiEnabled()) { + return RunNotificationsApi(); + } else { SendResponse(false); return true; } +} - return RunNotificationApi(); +message_center::NotificationType +NotificationsApiFunction::MapApiTemplateTypeToType( + api::notifications::TemplateType type) { + switch (type) { + case api::notifications::TEMPLATE_TYPE_NONE: + case api::notifications::TEMPLATE_TYPE_SIMPLE: + return message_center::NOTIFICATION_TYPE_SIMPLE; + case api::notifications::TEMPLATE_TYPE_BASIC: + return message_center::NOTIFICATION_TYPE_BASE_FORMAT; + case api::notifications::TEMPLATE_TYPE_IMAGE: + return message_center::NOTIFICATION_TYPE_IMAGE; + case api::notifications::TEMPLATE_TYPE_LIST: + return message_center::NOTIFICATION_TYPE_MULTIPLE; + default: + // Gracefully handle newer application code that is running on an older + // runtime that doesn't recognize the requested template. + return message_center::NOTIFICATION_TYPE_BASE_FORMAT; + } } -const char kNotificationPrefix[] = "extension.api."; +const char kNotificationPrefix[] = "extensions.api."; static uint64 next_id_ = 0; -NotificationCreateFunction::NotificationCreateFunction() { +NotificationsCreateFunction::NotificationsCreateFunction() { } -NotificationCreateFunction::~NotificationCreateFunction() { +NotificationsCreateFunction::~NotificationsCreateFunction() { } -bool NotificationCreateFunction::RunNotificationApi() { - params_ = api::experimental_notification::Create::Params::Create(*args_); +bool NotificationsCreateFunction::RunNotificationsApi() { + params_ = api::notifications::Create::Params::Create(*args_); EXTENSION_FUNCTION_VALIDATE(params_.get()); // If the caller provided a notificationId, use that. Otherwise, generate @@ -296,18 +312,18 @@ bool NotificationCreateFunction::RunNotificationApi() { return true; } -NotificationUpdateFunction::NotificationUpdateFunction() { +NotificationsUpdateFunction::NotificationsUpdateFunction() { } -NotificationUpdateFunction::~NotificationUpdateFunction() { +NotificationsUpdateFunction::~NotificationsUpdateFunction() { } -bool NotificationUpdateFunction::RunNotificationApi() { - params_ = api::experimental_notification::Update::Params::Create(*args_); +bool NotificationsUpdateFunction::RunNotificationsApi() { + params_ = api::notifications::Update::Params::Create(*args_); EXTENSION_FUNCTION_VALIDATE(params_.get()); if (g_browser_process->notification_ui_manager()-> - DoesIdExist(NotificationApiDelegate::CreateScopedIdentifier( + DoesIdExist(NotificationsApiDelegate::CreateScopedIdentifier( extension_->id(), params_->notification_id))) { CreateNotification(params_->notification_id, ¶ms_->options); SetResult(Value::CreateBooleanValue(true)); @@ -320,18 +336,18 @@ bool NotificationUpdateFunction::RunNotificationApi() { return true; } -NotificationClearFunction::NotificationClearFunction() { +NotificationsClearFunction::NotificationsClearFunction() { } -NotificationClearFunction::~NotificationClearFunction() { +NotificationsClearFunction::~NotificationsClearFunction() { } -bool NotificationClearFunction::RunNotificationApi() { - params_ = api::experimental_notification::Clear::Params::Create(*args_); +bool NotificationsClearFunction::RunNotificationsApi() { + params_ = api::notifications::Clear::Params::Create(*args_); EXTENSION_FUNCTION_VALIDATE(params_.get()); bool cancel_result = g_browser_process->notification_ui_manager()-> - CancelById(NotificationApiDelegate::CreateScopedIdentifier( + CancelById(NotificationsApiDelegate::CreateScopedIdentifier( extension_->id(), params_->notification_id)); SetResult(Value::CreateBooleanValue(cancel_result)); diff --git a/chrome/browser/extensions/api/notifications/notifications_api.h b/chrome/browser/extensions/api/notifications/notifications_api.h new file mode 100644 index 0000000..8635a39 --- /dev/null +++ b/chrome/browser/extensions/api/notifications/notifications_api.h @@ -0,0 +1,94 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_NOTIFICATIONS_API_H_ +#define CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_NOTIFICATIONS_API_H_ + +#include <string> + +#include "base/memory/ref_counted.h" +#include "chrome/browser/extensions/api/api_function.h" +#include "chrome/browser/extensions/extension_function.h" +#include "chrome/common/extensions/api/notifications.h" +#include "ui/message_center/notification_types.h" + +namespace extensions { + +class NotificationsApiFunction : public ApiFunction { + public: + // Whether the current extension and channel allow the API. Public for + // testing. + bool IsNotificationsApiAvailable(); + + protected: + NotificationsApiFunction(); + virtual ~NotificationsApiFunction(); + + void CreateNotification( + const std::string& id, + api::notifications::NotificationOptions* options); + + bool IsNotificationsApiEnabled(); + + // Called inside of RunImpl. + virtual bool RunNotificationsApi() = 0; + + // UITHreadExtensionFunction: + virtual bool RunImpl() OVERRIDE; + + message_center::NotificationType MapApiTemplateTypeToType( + api::notifications::TemplateType type); +}; + +class NotificationsCreateFunction : public NotificationsApiFunction { + public: + NotificationsCreateFunction(); + + // UIThreadExtensionFunction: + virtual bool RunNotificationsApi() OVERRIDE; + + protected: + virtual ~NotificationsCreateFunction(); + + private: + scoped_ptr<api::notifications::Create::Params> params_; + + DECLARE_EXTENSION_FUNCTION("notifications.create", NOTIFICATIONS_CREATE) +}; + +class NotificationsUpdateFunction : public NotificationsApiFunction { + public: + NotificationsUpdateFunction(); + + // UIThreadExtensionFunction: + virtual bool RunNotificationsApi() OVERRIDE; + + protected: + virtual ~NotificationsUpdateFunction(); + + private: + scoped_ptr<api::notifications::Update::Params> params_; + + DECLARE_EXTENSION_FUNCTION("notifications.update", NOTIFICATIONS_UPDATE) +}; + +class NotificationsClearFunction : public NotificationsApiFunction { + public: + NotificationsClearFunction(); + + // UIThreadExtensionFunction: + virtual bool RunNotificationsApi() OVERRIDE; + + protected: + virtual ~NotificationsClearFunction(); + + private: + scoped_ptr<api::notifications::Clear::Params> params_; + + DECLARE_EXTENSION_FUNCTION("notifications.clear", NOTIFICATIONS_CLEAR) +}; + +} // namespace extensions + +#endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_NOTIFICATIONS_API_H_ diff --git a/chrome/browser/extensions/api/notifications/notifications_api_unittest.cc b/chrome/browser/extensions/api/notifications/notifications_api_unittest.cc new file mode 100644 index 0000000..b1c32acf --- /dev/null +++ b/chrome/browser/extensions/api/notifications/notifications_api_unittest.cc @@ -0,0 +1,48 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/api/notifications/notifications_api.h" +#include "chrome/browser/extensions/extension_function.h" +#include "chrome/browser/extensions/extension_function_test_utils.h" +#include "chrome/common/extensions/features/feature.h" +#include "chrome/test/base/browser_with_test_window_test.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace utils = extension_function_test_utils; + +namespace extensions { + +class ExtensionNotificationsTest : public BrowserWithTestWindowTest { +}; + +TEST_F(ExtensionNotificationsTest, Channels) { + scoped_refptr<Extension> extension(utils::CreateEmptyExtensionWithLocation( + extensions::Manifest::UNPACKED)); + scoped_refptr<NotificationsClearFunction> notification_function( + new extensions::NotificationsClearFunction()); + notification_function->set_extension(extension.get()); + { + Feature::ScopedCurrentChannel channel_scope( + chrome::VersionInfo::CHANNEL_CANARY); + ASSERT_TRUE(notification_function->IsNotificationsApiAvailable()); + } + { + Feature::ScopedCurrentChannel channel_scope( + chrome::VersionInfo::CHANNEL_DEV); + ASSERT_TRUE(notification_function->IsNotificationsApiAvailable()); + } + { + Feature::ScopedCurrentChannel channel_scope( + chrome::VersionInfo::CHANNEL_BETA); + ASSERT_FALSE(notification_function->IsNotificationsApiAvailable()); + } + { + Feature::ScopedCurrentChannel channel_scope( + chrome::VersionInfo::CHANNEL_STABLE); + ASSERT_FALSE(notification_function->IsNotificationsApiAvailable()); + } +} + +} // namespace extensions diff --git a/chrome/browser/extensions/api/notification/notification_apitest.cc b/chrome/browser/extensions/api/notifications/notifications_apitest.cc index 21e1937..06c7625 100644 --- a/chrome/browser/extensions/api/notification/notification_apitest.cc +++ b/chrome/browser/extensions/api/notifications/notifications_apitest.cc @@ -3,11 +3,12 @@ // found in the LICENSE file. #include "chrome/browser/browser_process.h" -#include "chrome/browser/extensions/api/notification/notification_api.h" +#include "chrome/browser/extensions/api/notifications/notifications_api.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_function_test_utils.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/features/feature.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_utils.h" #include "ui/message_center/message_center.h" @@ -19,7 +20,7 @@ namespace utils = extension_function_test_utils; namespace { -class NotificationApiTest : public ExtensionApiTest { +class NotificationsApiTest : public ExtensionApiTest { public: virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { ExtensionApiTest::SetUpCommandLine(command_line); @@ -42,15 +43,15 @@ class NotificationApiTest : public ExtensionApiTest { } // namespace -IN_PROC_BROWSER_TEST_F(NotificationApiTest, TestIdUsage) { +IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestIdUsage) { // Create a new notification. A lingering output of this block is the - // notification ID, which we'll use in later parts of this test. + // notifications ID, which we'll use in later parts of this test. std::string notification_id; scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); { - scoped_refptr<extensions::NotificationCreateFunction> + scoped_refptr<extensions::NotificationsCreateFunction> notification_function( - new extensions::NotificationCreateFunction()); + new extensions::NotificationsCreateFunction()); notification_function->set_extension(empty_extension.get()); notification_function->set_has_callback(true); @@ -73,9 +74,9 @@ IN_PROC_BROWSER_TEST_F(NotificationApiTest, TestIdUsage) { // Update the existing notification. { - scoped_refptr<extensions::NotificationUpdateFunction> + scoped_refptr<extensions::NotificationsUpdateFunction> notification_function( - new extensions::NotificationUpdateFunction()); + new extensions::NotificationsUpdateFunction()); notification_function->set_extension(empty_extension.get()); notification_function->set_has_callback(true); @@ -105,9 +106,9 @@ IN_PROC_BROWSER_TEST_F(NotificationApiTest, TestIdUsage) { // Update a nonexistent notification. { - scoped_refptr<extensions::NotificationUpdateFunction> + scoped_refptr<extensions::NotificationsUpdateFunction> notification_function( - new extensions::NotificationUpdateFunction()); + new extensions::NotificationsUpdateFunction()); notification_function->set_extension(empty_extension.get()); notification_function->set_has_callback(true); @@ -131,9 +132,9 @@ IN_PROC_BROWSER_TEST_F(NotificationApiTest, TestIdUsage) { // Clear a nonexistent notification. { - scoped_refptr<extensions::NotificationClearFunction> + scoped_refptr<extensions::NotificationsClearFunction> notification_function( - new extensions::NotificationClearFunction()); + new extensions::NotificationsClearFunction()); notification_function->set_extension(empty_extension.get()); notification_function->set_has_callback(true); @@ -150,9 +151,9 @@ IN_PROC_BROWSER_TEST_F(NotificationApiTest, TestIdUsage) { // Clear the notification we created. { - scoped_refptr<extensions::NotificationClearFunction> + scoped_refptr<extensions::NotificationsClearFunction> notification_function( - new extensions::NotificationClearFunction()); + new extensions::NotificationsClearFunction()); notification_function->set_extension(empty_extension.get()); notification_function->set_has_callback(true); @@ -168,10 +169,10 @@ IN_PROC_BROWSER_TEST_F(NotificationApiTest, TestIdUsage) { } } -IN_PROC_BROWSER_TEST_F(NotificationApiTest, TestBaseFormatNotification) { - scoped_refptr<extensions::NotificationCreateFunction> +IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestBaseFormatNotification) { + scoped_refptr<extensions::NotificationsCreateFunction> notification_create_function( - new extensions::NotificationCreateFunction()); + new extensions::NotificationsCreateFunction()); scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); notification_create_function->set_extension(empty_extension.get()); @@ -207,10 +208,10 @@ IN_PROC_BROWSER_TEST_F(NotificationApiTest, TestBaseFormatNotification) { ASSERT_TRUE(notification_id.length() > 0); } -IN_PROC_BROWSER_TEST_F(NotificationApiTest, TestMultipleItemNotification) { - scoped_refptr<extensions::NotificationCreateFunction> +IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestMultipleItemNotification) { + scoped_refptr<extensions::NotificationsCreateFunction> notification_create_function( - new extensions::NotificationCreateFunction()); + new extensions::NotificationsCreateFunction()); scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); notification_create_function->set_extension(empty_extension.get()); @@ -248,23 +249,23 @@ IN_PROC_BROWSER_TEST_F(NotificationApiTest, TestMultipleItemNotification) { ASSERT_TRUE(notification_id.length() > 0); } -IN_PROC_BROWSER_TEST_F(NotificationApiTest, TestEvents) { - ASSERT_TRUE(RunExtensionTest("notification/api/events")) << message_; +IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestEvents) { + ASSERT_TRUE(RunExtensionTest("notifications/api/events")) << message_; } -IN_PROC_BROWSER_TEST_F(NotificationApiTest, TestCSP) { - ASSERT_TRUE(RunExtensionTest("notification/api/csp")) << message_; +IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestCSP) { + ASSERT_TRUE(RunExtensionTest("notifications/api/csp")) << message_; } #ifdef ENABLE_MESSAGE_CENTER #if !defined(OS_WIN) || !defined(USE_ASH) -IN_PROC_BROWSER_TEST_F(NotificationApiTest, TestByUser) { +IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestByUser) { if (!message_center::IsRichNotificationEnabled()) return; const extensions::Extension* extension = - LoadExtensionAndWait("notification/api/by_user"); + LoadExtensionAndWait("notifications/api/by_user"); ASSERT_TRUE(extension) << message_; { diff --git a/chrome/browser/extensions/event_names.cc b/chrome/browser/extensions/event_names.cc index 3db4f58..070238e 100644 --- a/chrome/browser/extensions/event_names.cc +++ b/chrome/browser/extensions/event_names.cc @@ -89,12 +89,11 @@ const char kOnDetachEventName[] = "mediaGalleriesPrivate.onDeviceDetached"; const char kOnGalleryChangedEventName[] = "mediaGalleriesPrivate.onGalleryChanged"; -const char kOnNotificationDisplayed[] = "experimental.notification.onDisplayed"; -const char kOnNotificationError[] = "experimental.notification.onError"; -const char kOnNotificationClosed[] = "experimental.notification.onClosed"; -const char kOnNotificationClicked[] = "experimental.notification.onClicked"; -const char kOnNotificationButtonClicked[] = - "experimental.notification.onButtonClicked"; +const char kOnNotificationDisplayed[] = "notifications.onDisplayed"; +const char kOnNotificationError[] = "notifications.onError"; +const char kOnNotificationClosed[] = "notifications.onClosed"; +const char kOnNotificationClicked[] = "notifications.onClicked"; +const char kOnNotificationButtonClicked[] = "notifications.onButtonClicked"; const char kOnNetworksChanged[] = "networkingPrivate.onNetworksChanged"; const char kOnNetworkListChanged[] = "networkingPrivate.onNetworkListChanged"; diff --git a/chrome/browser/extensions/extension_function_histogram_value.h b/chrome/browser/extensions/extension_function_histogram_value.h index f931baa..886f6a2c 100644 --- a/chrome/browser/extensions/extension_function_histogram_value.h +++ b/chrome/browser/extensions/extension_function_histogram_value.h @@ -337,7 +337,7 @@ enum HistogramValue { FILEBROWSERPRIVATE_REMOVEMOUNT, BLUETOOTH_CONNECT, TABCAPTURE_CAPTURE, - EXPERIMENTAL_NOTIFICATION_CREATE, + NOTIFICATIONS_CREATE, TABS_DUPLICATE, BLUETOOTH_WRITE, PAGEACTION_SHOW, @@ -458,8 +458,8 @@ enum HistogramValue { MEDIAGALLERIESPRIVATE_ADDGALLERYWATCH, MEDIAGALLERIESPRIVATE_REMOVEGALLERYWATCH, WEBVIEW_EXECUTESCRIPT, - EXPERIMENTAL_NOTIFICATION_UPDATE, - EXPERIMENTAL_NOTIFICATION_CLEAR, + NOTIFICATIONS_UPDATE, + NOTIFICATIONS_CLEAR, SESSIONRESTORE_GETRECENTLYCLOSED, SESSIONRESTORE_RESTORE, MANAGEMENT_UNINSTALLSELF, |