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

Unified Diff: chrome/browser/extensions/api/notifications/notifications_api.cc

Issue 15025002: Remove ENABLE_MESSAGE_CENTER (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing static initializer 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/notifications/notifications_api.cc
diff --git a/chrome/browser/extensions/api/notifications/notifications_api.cc b/chrome/browser/extensions/api/notifications/notifications_api.cc
index 19a66268f94affee63d9e018bc4824bb2edf9606..e45df6fe653d139f5444fe48f5e6f00d1586143b 100644
--- a/chrome/browser/extensions/api/notifications/notifications_api.cc
+++ b/chrome/browser/extensions/api/notifications/notifications_api.cc
@@ -21,6 +21,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "googleurl/src/gurl.h"
+#include "ui/message_center/message_center_util.h"
namespace extensions {
@@ -141,38 +142,35 @@ NotificationsApiFunction::NotificationsApiFunction() {
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 NotificationsApiFunction::CreateNotification(
const std::string& id,
api::notifications::NotificationOptions* options) {
- message_center::NotificationType type =
- MapApiTemplateTypeToType(options->type);
- GURL icon_url(UTF8ToUTF16(options->icon_url));
- string16 title(UTF8ToUTF16(options->title));
- string16 message(UTF8ToUTF16(options->message));
-
- // Ignore options if running on the old notification runtime.
- scoped_ptr<DictionaryValue> optional_fields(new DictionaryValue());
-
- NotificationsApiDelegate* api_delegate(new NotificationsApiDelegate(
- this,
- profile(),
- extension_->id(),
- id)); // ownership is passed to Notification
- Notification notification(type, extension_->url(), icon_url, title, message,
- WebKit::WebTextDirectionDefault,
- UTF8ToUTF16(extension_->name()),
- UTF8ToUTF16(api_delegate->id()),
- optional_fields.get(), api_delegate);
+ // If older notification runtime is used, use simpler bridge.
+ if (!message_center::IsRichNotificationEnabled()) {
+ message_center::NotificationType type =
+ MapApiTemplateTypeToType(options->type);
+ GURL icon_url(UTF8ToUTF16(options->icon_url));
+ string16 title(UTF8ToUTF16(options->title));
+ string16 message(UTF8ToUTF16(options->message));
+
+ // Ignore options if running on the old notification runtime.
+ scoped_ptr<DictionaryValue> optional_fields(new DictionaryValue());
+
+ NotificationsApiDelegate* api_delegate(new NotificationsApiDelegate(
+ this,
+ profile(),
+ extension_->id(),
+ id)); // ownership is passed to Notification
+ Notification notification(type, extension_->url(), icon_url, title, message,
+ WebKit::WebTextDirectionDefault,
+ UTF8ToUTF16(extension_->name()),
+ UTF8ToUTF16(api_delegate->id()),
+ optional_fields.get(), api_delegate);
+
+ g_browser_process->notification_ui_manager()->Add(notification, profile());
+ return;
+ }
- g_browser_process->notification_ui_manager()->Add(notification, profile());
-}
-#else // defined(ENABLE_MESSAGE_CENTER)
-void NotificationsApiFunction::CreateNotification(
- const std::string& id,
- api::notifications::NotificationOptions* options) {
message_center::NotificationType type =
MapApiTemplateTypeToType(options->type);
GURL icon_url(UTF8ToUTF16(options->icon_url));
@@ -251,7 +249,6 @@ void NotificationsApiFunction::CreateNotification(
g_browser_process->notification_ui_manager()->Add(notification, profile());
}
-#endif // !defined(ENABLE_MESSAGE_CENTER)
bool NotificationsApiFunction::IsNotificationsApiEnabled() {
DesktopNotificationService* service =
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/extensions/api/notifications/notifications_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698