| Index: ash/display/display_error_observer_chromeos.cc
|
| diff --git a/ash/display/display_error_observer_chromeos.cc b/ash/display/display_error_observer_chromeos.cc
|
| index e9231c3cd6106478ad00fec0ca47c98a70b9a3f7..5f21c68f436fb73c01e8bac7af33ff9e892146e3 100644
|
| --- a/ash/display/display_error_observer_chromeos.cc
|
| +++ b/ash/display/display_error_observer_chromeos.cc
|
| @@ -4,52 +4,11 @@
|
|
|
| #include "ash/display/display_error_observer_chromeos.h"
|
|
|
| -#include <cinttypes>
|
| -#include <memory>
|
| -#include <utility>
|
| -
|
| -#include "ash/new_window_delegate.h"
|
| -#include "ash/shell.h"
|
| -#include "ash/system/system_notifier.h"
|
| +#include "ash/display/display_util.h"
|
| #include "base/strings/string_number_conversions.h"
|
| -#include "grit/ash_resources.h"
|
| #include "grit/ash_strings.h"
|
| -#include "ui/base/l10n/l10n_util.h"
|
| -#include "ui/base/resource/resource_bundle.h"
|
| -#include "ui/message_center/message_center.h"
|
| -#include "ui/message_center/notification.h"
|
| -#include "ui/message_center/notification_delegate.h"
|
| -#include "ui/message_center/notification_list.h"
|
| -
|
| -using message_center::Notification;
|
|
|
| namespace ash {
|
| -namespace {
|
| -
|
| -const char kDisplayErrorNotificationId[] = "chrome://settings/display/error";
|
| -
|
| -// A notification delegate that will start the feedback app when the notication
|
| -// is clicked.
|
| -class DisplayErrorNotificationDelegate
|
| - : public message_center::NotificationDelegate {
|
| - public:
|
| - DisplayErrorNotificationDelegate() = default;
|
| -
|
| - // message_center::NotificationDelegate:
|
| - bool HasClickedListener() override { return true; }
|
| -
|
| - void Click() override {
|
| - ash::Shell::GetInstance()->new_window_delegate()->OpenFeedbackPage();
|
| - }
|
| -
|
| - private:
|
| - // Private destructor since NotificationDelegate is ref-counted.
|
| - ~DisplayErrorNotificationDelegate() override = default;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(DisplayErrorNotificationDelegate);
|
| -};
|
| -
|
| -} // namespace
|
|
|
| DisplayErrorObserver::DisplayErrorObserver() {
|
| }
|
| @@ -68,42 +27,10 @@ void DisplayErrorObserver::OnDisplayModeChangeFailed(
|
| << ".";
|
| }
|
|
|
| - // Always remove the notification to make sure the notification appears
|
| - // as a popup in any situation.
|
| - message_center::MessageCenter::Get()->RemoveNotification(
|
| - kDisplayErrorNotificationId, false /* by_user */);
|
| -
|
| - int message_id = (new_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR) ?
|
| - IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING :
|
| - IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING;
|
| -
|
| - ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
|
| - std::unique_ptr<Notification> notification(new Notification(
|
| - message_center::NOTIFICATION_TYPE_SIMPLE, kDisplayErrorNotificationId,
|
| - base::string16(), // title
|
| - l10n_util::GetStringUTF16(message_id),
|
| - bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY),
|
| - base::string16(), // display_source
|
| - GURL(),
|
| - message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT,
|
| - system_notifier::kNotifierDisplayError),
|
| - message_center::RichNotificationData(),
|
| - new DisplayErrorNotificationDelegate));
|
| - message_center::MessageCenter::Get()->AddNotification(
|
| - std::move(notification));
|
| -}
|
| -
|
| -base::string16
|
| -DisplayErrorObserver::GetDisplayErrorNotificationMessageForTest() {
|
| - message_center::NotificationList::Notifications notifications =
|
| - message_center::MessageCenter::Get()->GetVisibleNotifications();
|
| - for (message_center::NotificationList::Notifications::const_iterator iter =
|
| - notifications.begin(); iter != notifications.end(); ++iter) {
|
| - if ((*iter)->id() == kDisplayErrorNotificationId)
|
| - return (*iter)->message();
|
| - }
|
| -
|
| - return base::string16();
|
| + ShowDisplayErrorNotification(
|
| + (new_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR)
|
| + ? IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING
|
| + : IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING);
|
| }
|
|
|
| } // namespace ash
|
|
|