From a93e63f51978209ca3bef8e92c3ec11ce162153f Mon Sep 17 00:00:00 2001 From: "dimich@chromium.org" Date: Tue, 18 Dec 2012 04:26:40 +0000 Subject: Add initial plumbing to route Notifications to MessageCenter on Windows. NotificationUIManager interface now does not expose BallonCollection and any Balloon-related data. Also it splits the existing NotificationUIManagerImpl into 2 classes: 1. NotificationUIManagerImpl - contains 'wait_queue', where incoming notifications sit while screen is locked or in fullscreen etc, waiting for display. 2. BalloonNotificationUIManager (subclass of NotificationUIManagerImpl) - the BalloonCollection-based display manager, supporting Balloons and related logic. Still used on Win/Mac/Linux and ChromeOS (temporarily). Also, introduces a new class, MessageCenterBridge (subclass of NotificationUIManager), which is empty in this CL, in next it will delegate the work to MessageCenter instance. Tests that expect to see BalloonCollection now use BalloonNotificationUIManager::GetInstanceForTest() which logs an error and returns NULL if MessageCenter is used. This should not happen on bots as new code is under a flag. R=stevenjb@chromium.org TBR=ben@chromium.org (gypi changes) Review URL: https://chromiumcodereview.appspot.com/11543011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173645 0039d316-1c4b-4281-b951-d872f2087c98 --- .../task_manager_notification_resource_provider.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'chrome/browser/task_manager') diff --git a/chrome/browser/task_manager/task_manager_notification_resource_provider.cc b/chrome/browser/task_manager/task_manager_notification_resource_provider.cc index db61f13..8fbbce0 100644 --- a/chrome/browser/task_manager/task_manager_notification_resource_provider.cc +++ b/chrome/browser/task_manager/task_manager_notification_resource_provider.cc @@ -11,6 +11,7 @@ #include "chrome/browser/notifications/balloon.h" #include "chrome/browser/notifications/balloon_collection.h" #include "chrome/browser/notifications/balloon_host.h" +#include "chrome/browser/notifications/balloon_notification_ui_manager.h" #include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/common/chrome_notification_types.h" #include "content/public/browser/notification_service.h" @@ -114,20 +115,26 @@ TaskManager::Resource* TaskManagerNotificationResourceProvider::GetResource( } void TaskManagerNotificationResourceProvider::StartUpdating() { + // MessageCenter does not use Balloons. + if (NotificationUIManager::DelegatesToMessageCenter()) + return; + DCHECK(!updating_); updating_ = true; // Add all the existing BalloonHosts. - BalloonCollection* collection = - g_browser_process->notification_ui_manager()->balloon_collection(); - const BalloonCollection::Balloons& balloons = collection->GetActiveBalloons(); + BalloonNotificationUIManager* balloon_manager = + static_cast( + g_browser_process->notification_ui_manager()); + BalloonCollection* collection = balloon_manager->balloon_collection(); + const BalloonCollection::Balloons& balloons = + collection->GetActiveBalloons(); for (BalloonCollection::Balloons::const_iterator it = balloons.begin(); it != balloons.end(); ++it) { BalloonHost* balloon_host = (*it)->balloon_view()->GetHost(); if (balloon_host) AddToTaskManager(balloon_host); } - // Register for notifications about extension process changes. registrar_.Add(this, chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED, content::NotificationService::AllSources()); @@ -136,6 +143,10 @@ void TaskManagerNotificationResourceProvider::StartUpdating() { } void TaskManagerNotificationResourceProvider::StopUpdating() { + // MessageCenter does not use Balloons. + if (NotificationUIManager::DelegatesToMessageCenter()) + return; + DCHECK(updating_); updating_ = false; -- cgit v1.1