Commit 2465a549 authored by Dmitry Gozman's avatar Dmitry Gozman Committed by Commit Bot

Revert "Message center cleanup: rename some classes to better reflect roles."

This reverts commit c7497956.

Reason for revert: suspected to consistently break Linux Tests (dbg). Example: https://uberchromegw.corp.google.com/i/chromium.linux/builders/Linux%20Tests%20%28dbg%29%281%29%2832%29/builds/45886

Original change's description:
> Message center cleanup: rename some classes to better reflect roles.
> All mentions of "tray" should now be confined to ash.
> 
> - MessageCenterTray => UiController
> - MessageCenterTrayDelegate => UiDelegate
> - (Chrome's) WebNotificationTray => MessageCenterUiDelegate
> 
> Also remove some unnecessary includes.
> 
> TBR=atwilson@chromium.org
> 
> Bug: 755413
> Change-Id: Ic7774387ad313ed3ce356e5122a97dd9427699a9
> Reviewed-on: https://chromium-review.googlesource.com/758931
> Commit-Queue: Evan Stade <estade@chromium.org>
> Reviewed-by: Evan Stade <estade@chromium.org>
> Reviewed-by: Robert Sesek <rsesek@chromium.org>
> Reviewed-by: Drew Wilson <atwilson@chromium.org>
> Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#516028}

TBR=stevenjb@chromium.org,atwilson@chromium.org,dewittj@chromium.org,estade@chromium.org,rsesek@chromium.org

Change-Id: Iaf1fe86a8a5e06e47dd35e3ed32ad1fa114bb260
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 755413
Reviewed-on: https://chromium-review.googlesource.com/767828Reviewed-by: 's avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516121}
parent 8c25a456
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
using message_center::MessageCenter; using message_center::MessageCenter;
using message_center::MessageCenterTray;
namespace ash { namespace ash {
...@@ -64,11 +65,10 @@ void ContentsView::ChildPreferredSizeChanged(View* child) { ...@@ -64,11 +65,10 @@ void ContentsView::ChildPreferredSizeChanged(View* child) {
// MessageCenterBubble ///////////////////////////////////////////////////////// // MessageCenterBubble /////////////////////////////////////////////////////////
MessageCenterBubble::MessageCenterBubble( MessageCenterBubble::MessageCenterBubble(MessageCenter* message_center,
MessageCenter* message_center, MessageCenterTray* tray)
message_center::UiController* ui_controller)
: message_center_(message_center), : message_center_(message_center),
ui_controller_(ui_controller), tray_(tray),
max_height_(kDefaultMaxHeight) {} max_height_(kDefaultMaxHeight) {}
MessageCenterBubble::~MessageCenterBubble() { MessageCenterBubble::~MessageCenterBubble() {
...@@ -108,9 +108,8 @@ void MessageCenterBubble::InitializeContents( ...@@ -108,9 +108,8 @@ void MessageCenterBubble::InitializeContents(
views::TrayBubbleView* new_bubble_view) { views::TrayBubbleView* new_bubble_view) {
bubble_view_ = new_bubble_view; bubble_view_ = new_bubble_view;
bubble_view_->GetWidget()->AddObserver(this); bubble_view_->GetWidget()->AddObserver(this);
message_center_view_ = message_center_view_ = new MessageCenterView(
new MessageCenterView(message_center_, ui_controller_, max_height_, message_center_, tray_, max_height_, initially_settings_visible_);
initially_settings_visible_);
bubble_view_->AddChildView(new ContentsView(this, message_center_view_)); bubble_view_->AddChildView(new ContentsView(this, message_center_view_));
message_center_view_->Init(); message_center_view_->Init();
// Resize the content of the bubble view to the given bubble size. This is // Resize the content of the bubble view to the given bubble size. This is
......
...@@ -18,7 +18,7 @@ class TrayBubbleView; ...@@ -18,7 +18,7 @@ class TrayBubbleView;
namespace message_center { namespace message_center {
class MessageCenter; class MessageCenter;
class UiController; class MessageCenterTray;
} // namespace message_center } // namespace message_center
namespace ash { namespace ash {
...@@ -30,7 +30,7 @@ class MessageCenterBubble : public views::WidgetObserver, ...@@ -30,7 +30,7 @@ class MessageCenterBubble : public views::WidgetObserver,
public base::SupportsWeakPtr<MessageCenterBubble> { public base::SupportsWeakPtr<MessageCenterBubble> {
public: public:
MessageCenterBubble(message_center::MessageCenter* message_center, MessageCenterBubble(message_center::MessageCenter* message_center,
message_center::UiController* ui_controller); message_center::MessageCenterTray* tray);
~MessageCenterBubble() override; ~MessageCenterBubble() override;
// Gets called when the bubble view associated with this bubble is // Gets called when the bubble view associated with this bubble is
...@@ -62,7 +62,7 @@ class MessageCenterBubble : public views::WidgetObserver, ...@@ -62,7 +62,7 @@ class MessageCenterBubble : public views::WidgetObserver,
void UpdateBubbleView(); void UpdateBubbleView();
message_center::MessageCenter* message_center_; message_center::MessageCenter* message_center_;
message_center::UiController* ui_controller_; message_center::MessageCenterTray* tray_;
views::TrayBubbleView* bubble_view_ = nullptr; views::TrayBubbleView* bubble_view_ = nullptr;
MessageCenterView* message_center_view_ = nullptr; MessageCenterView* message_center_view_ = nullptr;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/insets.h"
#include "ui/gfx/text_constants.h" #include "ui/gfx/text_constants.h"
#include "ui/message_center/message_center.h" #include "ui/message_center/message_center.h"
#include "ui/message_center/message_center_tray.h"
#include "ui/message_center/notifier_id.h" #include "ui/message_center/notifier_id.h"
#include "ui/message_center/public/cpp/message_center_constants.h" #include "ui/message_center/public/cpp/message_center_constants.h"
#include "ui/resources/grit/ui_resources.h" #include "ui/resources/grit/ui_resources.h"
......
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
#include "ui/message_center/message_center.h" #include "ui/message_center/message_center.h"
#include "ui/message_center/message_center_tray.h"
#include "ui/message_center/message_center_types.h" #include "ui/message_center/message_center_types.h"
#include "ui/message_center/public/cpp/message_center_constants.h" #include "ui/message_center/public/cpp/message_center_constants.h"
#include "ui/message_center/ui_controller.h"
#include "ui/message_center/views/message_view.h" #include "ui/message_center/views/message_view.h"
#include "ui/message_center/views/message_view_factory.h" #include "ui/message_center/views/message_view_factory.h"
#include "ui/message_center/views/notification_control_buttons_view.h" #include "ui/message_center/views/notification_control_buttons_view.h"
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
using message_center::MessageCenter; using message_center::MessageCenter;
using message_center::MessageCenterTray;
using message_center::MessageView; using message_center::MessageView;
using message_center::Notification; using message_center::Notification;
using message_center::NotificationList; using message_center::NotificationList;
...@@ -112,13 +113,11 @@ class EmptyNotificationView : public views::View { ...@@ -112,13 +113,11 @@ class EmptyNotificationView : public views::View {
// MessageCenterView /////////////////////////////////////////////////////////// // MessageCenterView ///////////////////////////////////////////////////////////
MessageCenterView::MessageCenterView( MessageCenterView::MessageCenterView(MessageCenter* message_center,
MessageCenter* message_center, MessageCenterTray* tray,
message_center::UiController* ui_controller, int max_height,
int max_height, bool initially_settings_visible)
bool initially_settings_visible)
: message_center_(message_center), : message_center_(message_center),
ui_controller_(ui_controller),
settings_visible_(initially_settings_visible), settings_visible_(initially_settings_visible),
is_locked_(Shell::Get()->session_controller()->IsScreenLocked()) { is_locked_(Shell::Get()->session_controller()->IsScreenLocked()) {
if (is_locked_) if (is_locked_)
...@@ -454,7 +453,7 @@ void MessageCenterView::RemoveNotification(const std::string& notification_id, ...@@ -454,7 +453,7 @@ void MessageCenterView::RemoveNotification(const std::string& notification_id,
std::unique_ptr<ui::MenuModel> MessageCenterView::CreateMenuModel( std::unique_ptr<ui::MenuModel> MessageCenterView::CreateMenuModel(
const message_center::Notification& notification) { const message_center::Notification& notification) {
return ui_controller_->CreateNotificationMenuModel(notification); return tray_->CreateNotificationMenuModel(notification);
} }
void MessageCenterView::ClickOnNotificationButton( void MessageCenterView::ClickOnNotificationButton(
......
...@@ -26,7 +26,7 @@ class SlideAnimation; ...@@ -26,7 +26,7 @@ class SlideAnimation;
namespace message_center { namespace message_center {
class MessageCenter; class MessageCenter;
class UiController; class MessageCenterTray;
class MessageView; class MessageView;
} // namespace message_center } // namespace message_center
...@@ -50,7 +50,7 @@ class ASH_EXPORT MessageCenterView ...@@ -50,7 +50,7 @@ class ASH_EXPORT MessageCenterView
public views::FocusChangeListener { public views::FocusChangeListener {
public: public:
MessageCenterView(message_center::MessageCenter* message_center, MessageCenterView(message_center::MessageCenter* message_center,
message_center::UiController* ui_controller, message_center::MessageCenterTray* tray,
int max_height, int max_height,
bool initially_settings_visible); bool initially_settings_visible);
~MessageCenterView() override; ~MessageCenterView() override;
...@@ -67,7 +67,7 @@ class ASH_EXPORT MessageCenterView ...@@ -67,7 +67,7 @@ class ASH_EXPORT MessageCenterView
void SetSettingsVisible(bool visible); void SetSettingsVisible(bool visible);
void OnSettingsChanged(); void OnSettingsChanged();
bool settings_visible() const { return settings_visible_; } bool settings_visible() const { return settings_visible_; }
message_center::UiController* ui_controller() { return ui_controller_; } message_center::MessageCenterTray* tray() { return tray_; }
void SetIsClosing(bool is_closing); void SetIsClosing(bool is_closing);
...@@ -152,7 +152,7 @@ class ASH_EXPORT MessageCenterView ...@@ -152,7 +152,7 @@ class ASH_EXPORT MessageCenterView
int GetContentHeightDuringAnimation(int width) const; int GetContentHeightDuringAnimation(int width) const;
message_center::MessageCenter* message_center_; message_center::MessageCenter* message_center_;
message_center::UiController* ui_controller_; message_center::MessageCenterTray* tray_;
// Child views. // Child views.
views::ScrollView* scroller_ = nullptr; views::ScrollView* scroller_ = nullptr;
......
...@@ -32,7 +32,7 @@ namespace ash { ...@@ -32,7 +32,7 @@ namespace ash {
using message_center::FakeMessageCenter; using message_center::FakeMessageCenter;
using message_center::MessageCenter; using message_center::MessageCenter;
using message_center::MessageViewDelegate; using message_center::MessageViewDelegate;
using message_center::UiController; using message_center::MessageCenterTray;
using message_center::MessageView; using message_center::MessageView;
using message_center::Notification; using message_center::Notification;
using message_center::NotificationList; using message_center::NotificationList;
...@@ -125,7 +125,7 @@ class FakeMessageCenterImpl : public FakeMessageCenter { ...@@ -125,7 +125,7 @@ class FakeMessageCenterImpl : public FakeMessageCenter {
class MockMessageCenterView : public MessageCenterView { class MockMessageCenterView : public MessageCenterView {
public: public:
MockMessageCenterView(MessageCenter* message_center, MockMessageCenterView(MessageCenter* message_center,
UiController* ui_controller, MessageCenterTray* tray,
int max_height, int max_height,
bool initially_settings_visible); bool initially_settings_visible);
...@@ -138,11 +138,11 @@ class MockMessageCenterView : public MessageCenterView { ...@@ -138,11 +138,11 @@ class MockMessageCenterView : public MessageCenterView {
}; };
MockMessageCenterView::MockMessageCenterView(MessageCenter* message_center, MockMessageCenterView::MockMessageCenterView(MessageCenter* message_center,
UiController* ui_controller, MessageCenterTray* tray,
int max_height, int max_height,
bool initially_settings_visible) bool initially_settings_visible)
: MessageCenterView(message_center, : MessageCenterView(message_center,
ui_controller, tray,
max_height, max_height,
initially_settings_visible) {} initially_settings_visible) {}
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/paint_vector_icon.h"
#include "ui/message_center/message_center.h" #include "ui/message_center/message_center.h"
#include "ui/message_center/message_center_tray_delegate.h"
#include "ui/message_center/public/cpp/message_center_constants.h" #include "ui/message_center/public/cpp/message_center_constants.h"
#include "ui/message_center/ui_controller.h"
#include "ui/message_center/views/message_popup_collection.h" #include "ui/message_center/views/message_popup_collection.h"
#include "ui/strings/grit/ui_strings.h" #include "ui/strings/grit/ui_strings.h"
#include "ui/views/bubble/tray_bubble_view.h" #include "ui/views/bubble/tray_bubble_view.h"
...@@ -294,15 +294,16 @@ WebNotificationTray::WebNotificationTray(Shelf* shelf, ...@@ -294,15 +294,16 @@ WebNotificationTray::WebNotificationTray(Shelf* shelf,
counter_.reset(new WebNotificationLabel(animation_container_.get(), this)); counter_.reset(new WebNotificationLabel(animation_container_.get(), this));
tray_container()->AddChildView(counter_.get()); tray_container()->AddChildView(counter_.get());
message_center_ui_controller_.reset(new message_center::UiController(this)); message_center_tray_.reset(new message_center::MessageCenterTray(
this, message_center::MessageCenter::Get()));
popup_alignment_delegate_.reset(new AshPopupAlignmentDelegate(shelf)); popup_alignment_delegate_.reset(new AshPopupAlignmentDelegate(shelf));
popup_collection_.reset(new message_center::MessagePopupCollection( popup_collection_.reset(new message_center::MessagePopupCollection(
message_center(), message_center_ui_controller_.get(), message_center(), message_center_tray_.get(),
popup_alignment_delegate_.get())); popup_alignment_delegate_.get()));
display::Screen* screen = display::Screen::GetScreen(); display::Screen* screen = display::Screen::GetScreen();
popup_alignment_delegate_->StartObserving( popup_alignment_delegate_->StartObserving(
screen, screen->GetDisplayNearestWindow(status_area_window_)); screen, screen->GetDisplayNearestWindow(status_area_window_));
OnMessageCenterContentsChanged(); OnMessageCenterTrayChanged();
tray_container()->SetMargin(kTrayMainAxisInset, kTrayCrossAxisInset); tray_container()->SetMargin(kTrayMainAxisInset, kTrayCrossAxisInset);
} }
...@@ -326,8 +327,8 @@ bool WebNotificationTray::ShowMessageCenterInternal(bool show_settings, ...@@ -326,8 +327,8 @@ bool WebNotificationTray::ShowMessageCenterInternal(bool show_settings,
if (!ShouldShowMessageCenter()) if (!ShouldShowMessageCenter())
return false; return false;
MessageCenterBubble* message_center_bubble = new MessageCenterBubble( MessageCenterBubble* message_center_bubble =
message_center(), message_center_ui_controller_.get()); new MessageCenterBubble(message_center(), message_center_tray_.get());
// In the horizontal case, message center starts from the top of the shelf. // In the horizontal case, message center starts from the top of the shelf.
// In the vertical case, it starts from the bottom of WebNotificationTray. // In the vertical case, it starts from the bottom of WebNotificationTray.
...@@ -404,8 +405,8 @@ bool WebNotificationTray::IsMessageCenterBubbleVisible() const { ...@@ -404,8 +405,8 @@ bool WebNotificationTray::IsMessageCenterBubbleVisible() const {
void WebNotificationTray::UpdateAfterShelfAlignmentChange() { void WebNotificationTray::UpdateAfterShelfAlignmentChange() {
TrayBackgroundView::UpdateAfterShelfAlignmentChange(); TrayBackgroundView::UpdateAfterShelfAlignmentChange();
// Destroy any existing bubble so that it will be rebuilt correctly. // Destroy any existing bubble so that it will be rebuilt correctly.
message_center_ui_controller_->HideMessageCenterBubble(); message_center_tray_->HideMessageCenterBubble();
message_center_ui_controller_->HidePopupBubble(); message_center_tray_->HidePopupBubble();
} }
void WebNotificationTray::AnchorUpdated() { void WebNotificationTray::AnchorUpdated() {
...@@ -426,17 +427,17 @@ void WebNotificationTray::AnchorUpdated() { ...@@ -426,17 +427,17 @@ void WebNotificationTray::AnchorUpdated() {
base::string16 WebNotificationTray::GetAccessibleNameForTray() { base::string16 WebNotificationTray::GetAccessibleNameForTray() {
return l10n_util::GetStringFUTF16Int( return l10n_util::GetStringFUTF16Int(
IDS_MESSAGE_CENTER_ACCESSIBLE_NAME, IDS_MESSAGE_CENTER_ACCESSIBLE_NAME,
static_cast<int>(message_center_ui_controller_->message_center() static_cast<int>(
->NotificationCount())); message_center_tray_->message_center()->NotificationCount()));
} }
void WebNotificationTray::HideBubbleWithView( void WebNotificationTray::HideBubbleWithView(
const views::TrayBubbleView* bubble_view) { const views::TrayBubbleView* bubble_view) {
if (message_center_bubble() && if (message_center_bubble() &&
bubble_view == message_center_bubble()->bubble_view()) { bubble_view == message_center_bubble()->bubble_view()) {
message_center_ui_controller_->HideMessageCenterBubble(); message_center_tray_->HideMessageCenterBubble();
} else if (popup_collection_.get()) { } else if (popup_collection_.get()) {
message_center_ui_controller_->HidePopupBubble(); message_center_tray_->HidePopupBubble();
} }
} }
...@@ -493,7 +494,7 @@ void WebNotificationTray::ExecuteCommand(int command_id, int event_flags) { ...@@ -493,7 +494,7 @@ void WebNotificationTray::ExecuteCommand(int command_id, int event_flags) {
message_center()->EnterQuietModeWithExpire(expires_in); message_center()->EnterQuietModeWithExpire(expires_in);
} }
void WebNotificationTray::OnMessageCenterContentsChanged() { void WebNotificationTray::OnMessageCenterTrayChanged() {
// Do not update the tray contents directly. Multiple change events can happen // Do not update the tray contents directly. Multiple change events can happen
// consecutively, and calling Update in the middle of those events will show // consecutively, and calling Update in the middle of those events will show
// intermediate unread counts for a moment. // intermediate unread counts for a moment.
...@@ -514,7 +515,7 @@ void WebNotificationTray::UpdateTrayContent() { ...@@ -514,7 +515,7 @@ void WebNotificationTray::UpdateTrayContent() {
// Add small icons (up to kMaximumSmallIconCount = 3). // Add small icons (up to kMaximumSmallIconCount = 3).
message_center::MessageCenter* message_center = message_center::MessageCenter* message_center =
message_center_ui_controller_->message_center(); message_center_tray_->message_center();
size_t visible_small_icon_count = 0; size_t visible_small_icon_count = 0;
for (const auto* notification : message_center->GetVisibleNotifications()) { for (const auto* notification : message_center->GetVisibleNotifications()) {
gfx::Image image = notification->GenerateMaskedSmallIcon( gfx::Image image = notification->GenerateMaskedSmallIcon(
...@@ -574,7 +575,7 @@ void WebNotificationTray::ClickedOutsideBubble() { ...@@ -574,7 +575,7 @@ void WebNotificationTray::ClickedOutsideBubble() {
if (!message_center_bubble()) if (!message_center_bubble())
return; return;
message_center_ui_controller_->HideMessageCenterBubble(); message_center_tray_->HideMessageCenterBubble();
} }
bool WebNotificationTray::PerformAction(const ui::Event& event) { bool WebNotificationTray::PerformAction(const ui::Event& event) {
...@@ -588,12 +589,12 @@ bool WebNotificationTray::PerformAction(const ui::Event& event) { ...@@ -588,12 +589,12 @@ bool WebNotificationTray::PerformAction(const ui::Event& event) {
} }
void WebNotificationTray::CloseBubble() { void WebNotificationTray::CloseBubble() {
message_center_ui_controller_->HideMessageCenterBubble(); message_center_tray_->HideMessageCenterBubble();
} }
void WebNotificationTray::ShowBubble(bool show_by_click) { void WebNotificationTray::ShowBubble(bool show_by_click) {
if (!IsMessageCenterBubbleVisible()) if (!IsMessageCenterBubbleVisible())
message_center_ui_controller_->ShowMessageCenterBubble(show_by_click); message_center_tray_->ShowMessageCenterBubble(show_by_click);
} }
views::TrayBubbleView* WebNotificationTray::GetBubbleView() { views::TrayBubbleView* WebNotificationTray::GetBubbleView() {
...@@ -602,13 +603,13 @@ views::TrayBubbleView* WebNotificationTray::GetBubbleView() { ...@@ -602,13 +603,13 @@ views::TrayBubbleView* WebNotificationTray::GetBubbleView() {
} }
message_center::MessageCenter* WebNotificationTray::message_center() const { message_center::MessageCenter* WebNotificationTray::message_center() const {
return message_center_ui_controller_->message_center(); return message_center_tray_->message_center();
} }
// Methods for testing // Methods for testing
bool WebNotificationTray::IsPopupVisible() const { bool WebNotificationTray::IsPopupVisible() const {
return message_center_ui_controller_->popups_visible(); return message_center_tray_->popups_visible();
} }
MessageCenterBubble* WebNotificationTray::GetMessageCenterBubbleForTest() { MessageCenterBubble* WebNotificationTray::GetMessageCenterBubbleForTest() {
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "ui/base/models/simple_menu_model.h" #include "ui/base/models/simple_menu_model.h"
#include "ui/gfx/animation/animation_container.h" #include "ui/gfx/animation/animation_container.h"
#include "ui/message_center/ui_delegate.h" #include "ui/message_center/message_center_tray.h"
#include "ui/message_center/message_center_tray_delegate.h"
#include "ui/views/bubble/tray_bubble_view.h" #include "ui/views/bubble/tray_bubble_view.h"
namespace aura { namespace aura {
...@@ -25,7 +26,6 @@ class Window; ...@@ -25,7 +26,6 @@ class Window;
namespace message_center { namespace message_center {
class MessageCenter; class MessageCenter;
class MessagePopupCollection; class MessagePopupCollection;
class UiController;
} }
namespace ash { namespace ash {
...@@ -45,7 +45,7 @@ class WebNotificationLabel; ...@@ -45,7 +45,7 @@ class WebNotificationLabel;
// is controlled by StatusAreaWidget. // is controlled by StatusAreaWidget.
class ASH_EXPORT WebNotificationTray class ASH_EXPORT WebNotificationTray
: public TrayBackgroundView, : public TrayBackgroundView,
public message_center::UiDelegate, public message_center::MessageCenterTrayDelegate,
public base::SupportsWeakPtr<WebNotificationTray>, public base::SupportsWeakPtr<WebNotificationTray>,
public ui::SimpleMenuModel::Delegate { public ui::SimpleMenuModel::Delegate {
public: public:
...@@ -89,8 +89,8 @@ class ASH_EXPORT WebNotificationTray ...@@ -89,8 +89,8 @@ class ASH_EXPORT WebNotificationTray
bool ShouldEnableExtraKeyboardAccessibility() override; bool ShouldEnableExtraKeyboardAccessibility() override;
void HideBubble(const views::TrayBubbleView* bubble_view) override; void HideBubble(const views::TrayBubbleView* bubble_view) override;
// Overridden from message_center::UiDelegate. // Overridden from MessageCenterTrayDelegate.
void OnMessageCenterContentsChanged() override; void OnMessageCenterTrayChanged() override;
bool ShowMessageCenter(bool show_by_click) override; bool ShowMessageCenter(bool show_by_click) override;
void HideMessageCenter() override; void HideMessageCenter() override;
bool ShowPopups() override; bool ShowPopups() override;
...@@ -149,7 +149,7 @@ class ASH_EXPORT WebNotificationTray ...@@ -149,7 +149,7 @@ class ASH_EXPORT WebNotificationTray
aura::Window* status_area_window_; aura::Window* status_area_window_;
SystemTray* system_tray_; SystemTray* system_tray_;
std::unique_ptr<message_center::UiController> message_center_ui_controller_; std::unique_ptr<message_center::MessageCenterTray> message_center_tray_;
std::unique_ptr<WebNotificationBubbleWrapper> message_center_bubble_; std::unique_ptr<WebNotificationBubbleWrapper> message_center_bubble_;
std::unique_ptr<message_center::MessagePopupCollection> popup_collection_; std::unique_ptr<message_center::MessagePopupCollection> popup_collection_;
std::unique_ptr<WebNotificationImage> bell_icon_; std::unique_ptr<WebNotificationImage> bell_icon_;
......
...@@ -35,10 +35,10 @@ ...@@ -35,10 +35,10 @@
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/gfx/image/image_unittest_util.h" #include "ui/gfx/image/image_unittest_util.h"
#include "ui/message_center/message_center.h" #include "ui/message_center/message_center.h"
#include "ui/message_center/message_center_tray.h"
#include "ui/message_center/notification_list.h" #include "ui/message_center/notification_list.h"
#include "ui/message_center/notification_types.h" #include "ui/message_center/notification_types.h"
#include "ui/message_center/public/cpp/message_center_constants.h" #include "ui/message_center/public/cpp/message_center_constants.h"
#include "ui/message_center/ui_controller.h"
#include "ui/message_center/views/message_popup_collection.h" #include "ui/message_center/views/message_popup_collection.h"
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
#include "ui/views/layout/fill_layout.h" #include "ui/views/layout/fill_layout.h"
...@@ -204,9 +204,9 @@ TEST_F(WebNotificationTrayTest, WebNotificationPopupBubble) { ...@@ -204,9 +204,9 @@ TEST_F(WebNotificationTrayTest, WebNotificationPopupBubble) {
AddNotification("test_id5"); AddNotification("test_id5");
EXPECT_TRUE(GetTray()->IsPopupVisible()); EXPECT_TRUE(GetTray()->IsPopupVisible());
GetTray()->message_center_ui_controller_->ShowMessageCenterBubble( GetTray()->message_center_tray_->ShowMessageCenterBubble(
false /* show_by_click */); false /* show_by_click */);
GetTray()->message_center_ui_controller_->HideMessageCenterBubble(); GetTray()->message_center_tray_->HideMessageCenterBubble();
EXPECT_FALSE(GetTray()->IsPopupVisible()); EXPECT_FALSE(GetTray()->IsPopupVisible());
} }
...@@ -220,9 +220,8 @@ TEST_F(WebNotificationTrayTest, ManyMessageCenterNotifications) { ...@@ -220,9 +220,8 @@ TEST_F(WebNotificationTrayTest, ManyMessageCenterNotifications) {
std::string id = base::StringPrintf("test_id%d", static_cast<int>(i)); std::string id = base::StringPrintf("test_id%d", static_cast<int>(i));
AddNotification(id); AddNotification(id);
} }
bool shown = bool shown = GetTray()->message_center_tray_->ShowMessageCenterBubble(
GetTray()->message_center_ui_controller_->ShowMessageCenterBubble( false /* show_by_click */);
false /* show_by_click */);
EXPECT_TRUE(shown); EXPECT_TRUE(shown);
RunAllPendingInMessageLoop(); RunAllPendingInMessageLoop();
EXPECT_TRUE(GetTray()->message_center_bubble() != NULL); EXPECT_TRUE(GetTray()->message_center_bubble() != NULL);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h" #include "testing/platform_test.h"
#include "ui/message_center/fake_ui_delegate.h" #include "ui/message_center/fake_message_center_tray_delegate.h"
#include "ui/message_center/message_center.h" #include "ui/message_center/message_center.h"
#include "ui/message_center/message_center_observer.h" #include "ui/message_center/message_center_observer.h"
#include "ui/message_center/notification.h" #include "ui/message_center/notification.h"
...@@ -187,7 +187,9 @@ class BackgroundContentsServiceNotificationTest ...@@ -187,7 +187,9 @@ class BackgroundContentsServiceNotificationTest
MessageCenterNotificationManager* manager = MessageCenterNotificationManager* manager =
static_cast<MessageCenterNotificationManager*>( static_cast<MessageCenterNotificationManager*>(
g_browser_process->notification_ui_manager()); g_browser_process->notification_ui_manager());
manager->SetUiDelegateForTest(new message_center::FakeUiDelegate()); manager->SetMessageCenterTrayDelegateForTest(
new message_center::FakeMessageCenterTrayDelegate(
message_center::MessageCenter::Get()));
} }
void TearDown() override { void TearDown() override {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/message_center/fake_ui_delegate.h" #include "ui/message_center/fake_message_center_tray_delegate.h"
#include "ui/message_center/message_center.h" #include "ui/message_center/message_center.h"
#include "ui/message_center/notification.h" #include "ui/message_center/notification.h"
...@@ -51,7 +51,9 @@ class HatsNotificationControllerTest : public BrowserWithTestWindowTest { ...@@ -51,7 +51,9 @@ class HatsNotificationControllerTest : public BrowserWithTestWindowTest {
MessageCenterNotificationManager* manager = MessageCenterNotificationManager* manager =
static_cast<MessageCenterNotificationManager*>( static_cast<MessageCenterNotificationManager*>(
g_browser_process->notification_ui_manager()); g_browser_process->notification_ui_manager());
manager->SetUiDelegateForTest(new message_center::FakeUiDelegate()); manager->SetMessageCenterTrayDelegateForTest(
new message_center::FakeMessageCenterTrayDelegate(
message_center::MessageCenter::Get()));
network_portal_detector::InitializeForTesting( network_portal_detector::InitializeForTesting(
&mock_network_portal_detector_); &mock_network_portal_detector_);
......
...@@ -18,11 +18,11 @@ ...@@ -18,11 +18,11 @@
#include "extensions/common/extension_set.h" #include "extensions/common/extension_set.h"
#include "extensions/common/permissions/permissions_data.h" #include "extensions/common/permissions/permissions_data.h"
#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
#include "ui/message_center/message_center_tray.h"
#include "ui/message_center/message_center_types.h" #include "ui/message_center/message_center_types.h"
#include "ui/message_center/notification.h" #include "ui/message_center/notification.h"
#include "ui/message_center/notifier_id.h" #include "ui/message_center/notifier_id.h"
#include "ui/message_center/public/cpp/message_center_constants.h" #include "ui/message_center/public/cpp/message_center_constants.h"
#include "ui/message_center/ui_controller.h"
#if !defined(OS_CHROMEOS) #if !defined(OS_CHROMEOS)
#include "chrome/browser/notifications/fullscreen_notification_blocker.h" #include "chrome/browser/notifications/fullscreen_notification_blocker.h"
...@@ -49,7 +49,7 @@ MessageCenterNotificationManager::MessageCenterNotificationManager( ...@@ -49,7 +49,7 @@ MessageCenterNotificationManager::MessageCenterNotificationManager(
|| (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
// On Windows, Linux and Mac, the notification manager owns the tray icon and // On Windows, Linux and Mac, the notification manager owns the tray icon and
// views.Other platforms have global ownership and Create will return NULL. // views.Other platforms have global ownership and Create will return NULL.
tray_.reset(CreateUiDelegate()); tray_.reset(CreateMessageCenterTrayDelegate());
#endif #endif
} }
...@@ -232,8 +232,8 @@ void MessageCenterNotificationManager::OnNotificationRemoved( ...@@ -232,8 +232,8 @@ void MessageCenterNotificationManager::OnNotificationRemoved(
RemoveProfileNotification(id); RemoveProfileNotification(id);
} }
void MessageCenterNotificationManager::SetUiDelegateForTest( void MessageCenterNotificationManager::SetMessageCenterTrayDelegateForTest(
message_center::UiDelegate* delegate) { message_center::MessageCenterTrayDelegate* delegate) {
tray_.reset(delegate); tray_.reset(delegate);
} }
......
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
#include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/browser/notifications/notification_ui_manager.h"
#include "ui/message_center/message_center.h"