Reland "Mash cleanup: message center part 4."

This relands commit 243f71cb511ba566fcc64af909597cfd0de3a9ff.

Difference to original: SetQuietMode remains a part of the
                        interface for now.

    Original change's description:
    > Mash cleanup: message center part 4.
    >
    > This pulls all notifier related code out of AshMessageCenterController
    > and AshMessageCenterClient into new C++ interfaces
    > NotifierSettingsController and NotifierSettingsObserver.
    >
    > [email protected],[email protected]
    >
    > Bug: 958191
    > Change-Id: Ice561f2f1f4e90979847c5f410779a34691926a6
    > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1653858
    > Reviewed-by: Evan Stade <[email protected]>
    > Reviewed-by: Steven Bennetts <[email protected]>
    > Reviewed-by: Xiyuan Xia <[email protected]>
    > Commit-Queue: Evan Stade <[email protected]>
    > Cr-Commit-Position: refs/heads/master@{#669417}

[email protected]

Change-Id: I63dd4a2d46e39609573debd4268436d163b896df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1662596
Reviewed-by: Evan Stade <[email protected]>
Reviewed-by: Tom Sepez <[email protected]>
Reviewed-by: Steven Bennetts <[email protected]>
Reviewed-by: Xiyuan Xia <[email protected]>
Commit-Queue: Evan Stade <[email protected]>
Cr-Commit-Position: refs/heads/master@{#669844}
diff --git a/chrome/browser/notifications/arc_application_notifier_controller.cc b/chrome/browser/notifications/arc_application_notifier_controller.cc
index dbedc12..e483c3a 100644
--- a/chrome/browser/notifications/arc_application_notifier_controller.cc
+++ b/chrome/browser/notifications/arc_application_notifier_controller.cc
@@ -6,6 +6,7 @@
 
 #include <set>
 
+#include "ash/public/cpp/notifier_metadata.h"
 #include "base/bind.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/profiles/profile.h"
@@ -52,21 +53,21 @@
   StopObserving();
 }
 
-std::vector<ash::mojom::NotifierUiDataPtr>
+std::vector<ash::NotifierMetadata>
 ArcApplicationNotifierController::GetNotifierList(Profile* profile) {
   // In Guest mode, it can be called but there's no ARC apps to return.
   if (profile->IsOffTheRecord())
-    return std::vector<ash::mojom::NotifierUiDataPtr>();
+    return std::vector<ash::NotifierMetadata>();
 
   package_to_app_ids_.clear();
   icons_.clear();
   StopObserving();
 
   ArcAppListPrefs* const app_list = ArcAppListPrefs::Get(profile);
-  std::vector<ash::mojom::NotifierUiDataPtr> results;
+  std::vector<ash::NotifierMetadata> notifiers;
   // The app list can be null in unit tests.
   if (!app_list)
-    return results;
+    return notifiers;
   const std::vector<std::string>& app_ids = app_list->GetAppIds();
 
   last_profile_ = profile;
@@ -96,14 +97,13 @@
     package_to_app_ids_.insert(std::make_pair(app->package_name, app_id));
     message_center::NotifierId notifier_id(
         message_center::NotifierType::ARC_APPLICATION, app_id);
-    auto ui_data = ash::mojom::NotifierUiData::New(
-        notifier_id, base::UTF8ToUTF16(app->name), app->notifications_enabled,
-        false /* enforced */, icon->image_skia());
+    notifiers.emplace_back(notifier_id, base::UTF8ToUTF16(app->name),
+                           app->notifications_enabled, false /* enforced */,
+                           icon->image_skia());
     icons_.push_back(std::move(icon));
-    results.push_back(std::move(ui_data));
   }
 
-  return results;
+  return notifiers;
 }
 
 void ArcApplicationNotifierController::SetNotifierEnabled(
diff --git a/chrome/browser/notifications/arc_application_notifier_controller.h b/chrome/browser/notifications/arc_application_notifier_controller.h
index 59d8b19..e9569b5 100644
--- a/chrome/browser/notifications/arc_application_notifier_controller.h
+++ b/chrome/browser/notifications/arc_application_notifier_controller.h
@@ -31,8 +31,7 @@
   ~ArcApplicationNotifierController() override;
 
   // TODO(hirono): Rewrite the function with new API to fetch package list.
-  std::vector<ash::mojom::NotifierUiDataPtr> GetNotifierList(
-      Profile* profile) override;
+  std::vector<ash::NotifierMetadata> GetNotifierList(Profile* profile) override;
   void SetNotifierEnabled(Profile* profile,
                           const message_center::NotifierId& notifier_id,
                           bool enabled) override;
diff --git a/chrome/browser/notifications/chrome_ash_message_center_client.cc b/chrome/browser/notifications/chrome_ash_message_center_client.cc
index f2c8e3a..93e7231a 100644
--- a/chrome/browser/notifications/chrome_ash_message_center_client.cc
+++ b/chrome/browser/notifications/chrome_ash_message_center_client.cc
@@ -4,6 +4,8 @@
 
 #include "chrome/browser/notifications/chrome_ash_message_center_client.h"
 
+#include "ash/public/cpp/notifier_metadata.h"
+#include "ash/public/cpp/notifier_settings_observer.h"
 #include "ash/public/interfaces/constants.mojom.h"
 #include "base/i18n/string_compare.h"
 #include "base/stl_util.h"
@@ -24,7 +26,6 @@
 #include "ui/message_center/message_center.h"
 #include "ui/message_center/public/cpp/notifier_id.h"
 
-using ash::mojom::NotifierUiDataPtr;
 using message_center::MessageCenter;
 using message_center::NotifierId;
 
@@ -44,15 +45,16 @@
  public:
   explicit NotifierComparator(icu::Collator* collator) : collator_(collator) {}
 
-  bool operator()(const NotifierUiDataPtr& n1, const NotifierUiDataPtr& n2) {
-    if (n1->notifier_id.type != n2->notifier_id.type)
-      return n1->notifier_id.type < n2->notifier_id.type;
+  bool operator()(const ash::NotifierMetadata& n1,
+                  const ash::NotifierMetadata& n2) {
+    if (n1.notifier_id.type != n2.notifier_id.type)
+      return n1.notifier_id.type < n2.notifier_id.type;
 
     if (collator_) {
-      return base::i18n::CompareString16WithCollator(*collator_, n1->name,
-                                                     n2->name) == UCOL_LESS;
+      return base::i18n::CompareString16WithCollator(*collator_, n1.name,
+                                                     n2.name) == UCOL_LESS;
     }
-    return n1->name < n2->name;
+    return n1.name < n2.name;
   }
 
  private:
@@ -138,10 +140,6 @@
 ChromeAshMessageCenterClient::~ChromeAshMessageCenterClient() {
   DCHECK_EQ(this, g_chrome_ash_message_center_client);
   g_chrome_ash_message_center_client = nullptr;
-  if (deferred_notifier_list_callback_) {
-    std::move(deferred_notifier_list_callback_)
-        .Run(std::vector<ash::mojom::NotifierUiDataPtr>());
-  }
 }
 
 void ChromeAshMessageCenterClient::Display(
@@ -163,6 +161,30 @@
   }
 }
 
+void ChromeAshMessageCenterClient::GetNotifiers() {
+  Profile* profile = GetProfileForNotifiers();
+  if (!profile) {
+    LOG(ERROR) << "GetNotifiers called before profile fully loaded, see "
+                  "https://crbug.com/968825";
+    return;
+  }
+
+  std::vector<ash::NotifierMetadata> notifiers;
+  for (auto& source : sources_) {
+    auto source_notifiers = source.second->GetNotifierList(profile);
+    for (auto& notifier : source_notifiers)
+      notifiers.push_back(std::move(notifier));
+  }
+
+  UErrorCode error = U_ZERO_ERROR;
+  std::unique_ptr<icu::Collator> collator(icu::Collator::createInstance(error));
+  NotifierComparator comparator(U_SUCCESS(error) ? collator.get() : nullptr);
+  std::sort(notifiers.begin(), notifiers.end(), comparator);
+
+  for (auto& observer : notifier_observers_)
+    observer.OnNotifiersUpdated(notifiers);
+}
+
 void ChromeAshMessageCenterClient::SetNotifierEnabled(
     const NotifierId& notifier_id,
     bool enabled) {
@@ -171,63 +193,14 @@
   sources_[notifier_id.type]->SetNotifierEnabled(profile, notifier_id, enabled);
 }
 
-void ChromeAshMessageCenterClient::GetNotifierList(
-    GetNotifierListCallback callback) {
-  if (deferred_notifier_list_callback_) {
-    std::move(deferred_notifier_list_callback_)
-        .Run(std::vector<ash::mojom::NotifierUiDataPtr>());
-    registrar_.RemoveAll();
-  }
-  Profile* profile = GetProfileForNotifiers();
-  if (profile) {
-    RespondWithNotifierList(profile, std::move(callback));
-  } else {
-    LOG(ERROR) << "GetNotifierList called before profile fully loaded, see "
-                  "https://crbug.com/968825";
-    deferred_notifier_list_callback_ = std::move(callback);
-    registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED,
-                   content::NotificationService::AllSources());
-  }
+void ChromeAshMessageCenterClient::AddNotifierSettingsObserver(
+    ash::NotifierSettingsObserver* observer) {
+  notifier_observers_.AddObserver(observer);
 }
 
-void ChromeAshMessageCenterClient::RespondWithNotifierList(
-    Profile* profile,
-    GetNotifierListCallback callback) const {
-  CHECK(profile);
-  std::vector<ash::mojom::NotifierUiDataPtr> notifiers;
-  for (auto& source : sources_) {
-    auto source_notifiers = source.second->GetNotifierList(profile);
-    for (auto& notifier : source_notifiers) {
-      notifiers.push_back(std::move(notifier));
-    }
-  }
-
-  UErrorCode error = U_ZERO_ERROR;
-  std::unique_ptr<icu::Collator> collator(icu::Collator::createInstance(error));
-  NotifierComparator comparator(U_SUCCESS(error) ? collator.get() : nullptr);
-  std::sort(notifiers.begin(), notifiers.end(), comparator);
-
-  std::move(callback).Run(std::move(notifiers));
-}
-
-void ChromeAshMessageCenterClient::Observe(
-    int type,
-    const content::NotificationSource& source,
-    const content::NotificationDetails& details) {
-  switch (type) {
-    case chrome::NOTIFICATION_PROFILE_ADDED: {
-      Profile* profile = GetProfileForNotifiers();
-      if (profile) {
-        CHECK(deferred_notifier_list_callback_);
-        RespondWithNotifierList(profile,
-                                std::move(deferred_notifier_list_callback_));
-        registrar_.RemoveAll();
-      }
-      break;
-    }
-    default:
-      NOTREACHED();
-  }
+void ChromeAshMessageCenterClient::RemoveNotifierSettingsObserver(
+    ash::NotifierSettingsObserver* observer) {
+  notifier_observers_.RemoveObserver(observer);
 }
 
 void ChromeAshMessageCenterClient::GetArcAppIdByPackageName(
@@ -241,20 +214,36 @@
 void ChromeAshMessageCenterClient::OnIconImageUpdated(
     const NotifierId& notifier_id,
     const gfx::ImageSkia& image) {
-  // |controller_| may be null in unit tests.
-  if (!image.isNull() && controller_)
-    controller_->UpdateNotifierIcon(notifier_id, image);
+  for (auto& observer : notifier_observers_)
+    observer.OnNotifierIconUpdated(notifier_id, image);
 }
 
 void ChromeAshMessageCenterClient::OnNotifierEnabledChanged(
     const NotifierId& notifier_id,
     bool enabled) {
-  // May be null in unit tests.
-  if (controller_)
-    controller_->NotifierEnabledChanged(notifier_id, enabled);
+  if (!enabled)
+    MessageCenter::Get()->RemoveNotificationsForNotifierId(notifier_id);
 }
 
 // static
 void ChromeAshMessageCenterClient::FlushForTesting() {
   g_chrome_ash_message_center_client->binding_.FlushForTesting();
 }
+
+void ChromeAshMessageCenterClient::Observe(
+    int type,
+    const content::NotificationSource& source,
+    const content::NotificationDetails& details) {
+  switch (type) {
+    case chrome::NOTIFICATION_PROFILE_ADDED: {
+      Profile* profile = GetProfileForNotifiers();
+      if (profile) {
+        GetNotifiers();
+        registrar_.RemoveAll();
+      }
+      break;
+    }
+    default:
+      NOTREACHED();
+  }
+}
diff --git a/chrome/browser/notifications/chrome_ash_message_center_client.h b/chrome/browser/notifications/chrome_ash_message_center_client.h
index 90f118e..afdb52f 100644
--- a/chrome/browser/notifications/chrome_ash_message_center_client.h
+++ b/chrome/browser/notifications/chrome_ash_message_center_client.h
@@ -5,6 +5,7 @@
 #ifndef CHROME_BROWSER_NOTIFICATIONS_CHROME_ASH_MESSAGE_CENTER_CLIENT_H_
 #define CHROME_BROWSER_NOTIFICATIONS_CHROME_ASH_MESSAGE_CENTER_CLIENT_H_
 
+#include "ash/public/cpp/notifier_settings_controller.h"
 #include "ash/public/interfaces/ash_message_center_controller.mojom.h"
 #include "chrome/browser/notifications/notification_platform_bridge.h"
 #include "chrome/browser/notifications/notification_platform_bridge_chromeos.h"
@@ -19,7 +20,8 @@
 // and handles interactions with those notifications, plus it keeps track of
 // NotifierControllers to provide notifier settings information to Ash (visible
 // in NotifierSettingsView).
-class ChromeAshMessageCenterClient : public ash::mojom::AshMessageCenterClient,
+class ChromeAshMessageCenterClient : public ash::NotifierSettingsController,
+                                     public ash::mojom::AshMessageCenterClient,
                                      public NotifierController::Observer,
                                      public content::NotificationObserver {
  public:
@@ -31,10 +33,16 @@
   void Display(const message_center::Notification& notification);
   void Close(const std::string& notification_id);
 
-  // ash::mojom::AshMessageCenterClient:
+  // ash::NotifierSettingsController:
+  void GetNotifiers() override;
   void SetNotifierEnabled(const message_center::NotifierId& notifier_id,
                           bool enabled) override;
-  void GetNotifierList(GetNotifierListCallback callback) override;
+  void AddNotifierSettingsObserver(
+      ash::NotifierSettingsObserver* observer) override;
+  void RemoveNotifierSettingsObserver(
+      ash::NotifierSettingsObserver* observer) override;
+
+  // ash::mojom::AshMessageCenterClient:
   void GetArcAppIdByPackageName(
       const std::string& package_name,
       GetArcAppIdByPackageNameCallback callback) override;
@@ -49,9 +57,6 @@
   static void FlushForTesting();
 
  private:
-  void RespondWithNotifierList(Profile* profile,
-                               GetNotifierListCallback callback) const;
-
   // content::NotificationObserver override.
   void Observe(int type,
                const content::NotificationSource& source,
@@ -63,10 +68,11 @@
   std::map<message_center::NotifierType, std::unique_ptr<NotifierController>>
       sources_;
 
+  base::ObserverList<ash::NotifierSettingsObserver> notifier_observers_;
+
   ash::mojom::AshMessageCenterControllerPtr controller_;
   mojo::AssociatedBinding<ash::mojom::AshMessageCenterClient> binding_;
   content::NotificationRegistrar registrar_;
-  GetNotifierListCallback deferred_notifier_list_callback_;
 
   DISALLOW_COPY_AND_ASSIGN(ChromeAshMessageCenterClient);
 };
diff --git a/chrome/browser/notifications/chrome_ash_message_center_client_unittest.cc b/chrome/browser/notifications/chrome_ash_message_center_client_unittest.cc
index 1391939..d083784 100644
--- a/chrome/browser/notifications/chrome_ash_message_center_client_unittest.cc
+++ b/chrome/browser/notifications/chrome_ash_message_center_client_unittest.cc
@@ -7,6 +7,8 @@
 #include <string>
 #include <utility>
 
+#include "ash/public/cpp/notifier_metadata.h"
+#include "ash/public/cpp/notifier_settings_observer.h"
 #include "base/bind.h"
 #include "base/command_line.h"
 #include "base/macros.h"
@@ -28,25 +30,39 @@
 #include "extensions/common/extension.h"
 #include "extensions/common/extension_builder.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "ui/message_center/message_center.h"
 #include "ui/message_center/public/cpp/notifier_id.h"
 
 namespace {
 
-class ChromeAshMessageCenterClientTest : public testing::Test {
+class ChromeAshMessageCenterClientTest : public testing::Test,
+                                         public ash::NotifierSettingsObserver {
  protected:
   ChromeAshMessageCenterClientTest()
       : testing_profile_manager_(TestingBrowserProcess::GetGlobal()) {}
   ~ChromeAshMessageCenterClientTest() override {}
 
+  // testing::Test:
   void SetUp() override {
     ASSERT_TRUE(testing_profile_manager_.SetUp());
 
     // Initialize the UserManager singleton to a fresh FakeUserManager instance.
     user_manager_enabler_ = std::make_unique<user_manager::ScopedUserManager>(
         std::make_unique<chromeos::FakeChromeUserManager>());
+
+    message_center::MessageCenter::Initialize();
   }
 
-  void TearDown() override { client_.reset(); }
+  void TearDown() override {
+    client_.reset();
+    message_center::MessageCenter::Shutdown();
+  }
+
+  // ash::NotifierSettingsObserver:
+  void OnNotifiersUpdated(
+      const std::vector<ash::NotifierMetadata>& notifiers) override {
+    notifiers_ = notifiers;
+  }
 
   TestingProfile* CreateProfile(const std::string& name) {
     TestingProfile* profile =
@@ -69,6 +85,7 @@
 
   void CreateClient() {
     client_.reset(new ChromeAshMessageCenterClient(nullptr));
+    client_->AddNotifierSettingsObserver(this);
   }
 
   ChromeAshMessageCenterClient* message_center_client() {
@@ -76,13 +93,9 @@
   }
 
  protected:
-  void RefreshNotifierList() {
-    message_center_client()->GetNotifierList(
-        base::BindOnce(&ChromeAshMessageCenterClientTest::SetNotifierUiData,
-                       base::Unretained(this)));
-  }
+  void RefreshNotifierList() { message_center_client()->GetNotifiers(); }
 
-  std::vector<ash::mojom::NotifierUiDataPtr> notifiers_;
+  std::vector<ash::NotifierMetadata> notifiers_;
 
  private:
   chromeos::FakeChromeUserManager* GetFakeUserManager() {
@@ -90,10 +103,6 @@
         user_manager::UserManager::Get());
   }
 
-  void SetNotifierUiData(std::vector<ash::mojom::NotifierUiDataPtr> notifiers) {
-    notifiers_ = std::move(notifiers);
-  }
-
   content::TestBrowserThreadBundle thread_bundle_;
   TestingProfileManager testing_profile_manager_;
   std::unique_ptr<ChromeAshMessageCenterClient> client_;
@@ -215,8 +224,8 @@
 
   RefreshNotifierList();
   ASSERT_EQ(2u, notifiers_.size());
-  EXPECT_EQ(kBarId, notifiers_[0]->notifier_id.id);
-  EXPECT_EQ(kFooId, notifiers_[1]->notifier_id.id);
+  EXPECT_EQ(kBarId, notifiers_[0].notifier_id.id);
+  EXPECT_EQ(kFooId, notifiers_[1].notifier_id.id);
 }
 
 TEST_F(ChromeAshMessageCenterClientTest, SetWebPageNotifierEnabled) {
diff --git a/chrome/browser/notifications/extension_notifier_controller.cc b/chrome/browser/notifications/extension_notifier_controller.cc
index 9c0e575..6b1b9a748 100644
--- a/chrome/browser/notifications/extension_notifier_controller.cc
+++ b/chrome/browser/notifications/extension_notifier_controller.cc
@@ -4,6 +4,7 @@
 
 #include "chrome/browser/notifications/extension_notifier_controller.h"
 
+#include "ash/public/cpp/notifier_metadata.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/extensions/chrome_app_icon_loader.h"
 #include "chrome/browser/notifications/notifier_state_tracker.h"
@@ -22,9 +23,9 @@
 
 ExtensionNotifierController::~ExtensionNotifierController() {}
 
-std::vector<ash::mojom::NotifierUiDataPtr>
-ExtensionNotifierController::GetNotifierList(Profile* profile) {
-  std::vector<ash::mojom::NotifierUiDataPtr> ui_data;
+std::vector<ash::NotifierMetadata> ExtensionNotifierController::GetNotifierList(
+    Profile* profile) {
+  std::vector<ash::NotifierMetadata> notifiers;
   const extensions::ExtensionSet& extension_set =
       extensions::ExtensionRegistry::Get(profile)->enabled_extensions();
   // The extension icon size has to be 32x32 at least to load bigger icons if
@@ -53,14 +54,14 @@
         message_center::NotifierType::APPLICATION, extension->id());
     NotifierStateTracker* const notifier_state_tracker =
         NotifierStateTrackerFactory::GetForProfile(profile);
-    ui_data.push_back(ash::mojom::NotifierUiData::New(
+    notifiers.emplace_back(
         notifier_id, base::UTF8ToUTF16(extension->name()),
         notifier_state_tracker->IsNotifierEnabled(notifier_id),
-        false /* enforced */, gfx::ImageSkia()));
+        false /* enforced */, gfx::ImageSkia());
     app_icon_loader_->FetchImage(extension->id());
   }
 
-  return ui_data;
+  return notifiers;
 }
 
 void ExtensionNotifierController::SetNotifierEnabled(
diff --git a/chrome/browser/notifications/extension_notifier_controller.h b/chrome/browser/notifications/extension_notifier_controller.h
index 179cc8d..e7f7b20 100644
--- a/chrome/browser/notifications/extension_notifier_controller.h
+++ b/chrome/browser/notifications/extension_notifier_controller.h
@@ -19,8 +19,7 @@
   ~ExtensionNotifierController() override;
 
   // NotifierController:
-  std::vector<ash::mojom::NotifierUiDataPtr> GetNotifierList(
-      Profile* profile) override;
+  std::vector<ash::NotifierMetadata> GetNotifierList(Profile* profile) override;
   void SetNotifierEnabled(Profile* profile,
                           const message_center::NotifierId& notifier_id,
                           bool enabled) override;
diff --git a/chrome/browser/notifications/notifier_controller.h b/chrome/browser/notifications/notifier_controller.h
index fce6a31a..b23375a6 100644
--- a/chrome/browser/notifications/notifier_controller.h
+++ b/chrome/browser/notifications/notifier_controller.h
@@ -8,12 +8,15 @@
 #include <memory>
 #include <vector>
 
-#include "ash/public/interfaces/ash_message_center_controller.mojom.h"
+#include "ash/public/cpp/notifier_metadata.h"
 #include "base/macros.h"
-#include "ui/message_center/public/cpp/notifier_id.h"
 
 class Profile;
 
+namespace message_center {
+struct NotifierId;
+}
+
 // An interface to control Notifiers, grouped by NotifierType. Controllers are
 // responsible for both collating display data and toggling settings in response
 // to user inputs.
@@ -33,7 +36,7 @@
   // Returns notifiers to display in the settings UI. Not all notifiers appear
   // in settings. If the source starts loading for icon images, it needs to call
   // Observer::OnIconImageUpdated after the icon is loaded.
-  virtual std::vector<ash::mojom::NotifierUiDataPtr> GetNotifierList(
+  virtual std::vector<ash::NotifierMetadata> GetNotifierList(
       Profile* profile) = 0;
 
   // Set notifier enabled. |notifier_id| must have notifier type that can be
diff --git a/chrome/browser/notifications/web_page_notifier_controller.cc b/chrome/browser/notifications/web_page_notifier_controller.cc
index 4eeb877..1c07723e 100644
--- a/chrome/browser/notifications/web_page_notifier_controller.cc
+++ b/chrome/browser/notifications/web_page_notifier_controller.cc
@@ -4,6 +4,7 @@
 
 #include "chrome/browser/notifications/web_page_notifier_controller.h"
 
+#include "ash/public/cpp/notifier_metadata.h"
 #include "base/bind.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/task/cancelable_task_tracker.h"
@@ -21,9 +22,9 @@
 
 WebPageNotifierController::~WebPageNotifierController() {}
 
-std::vector<ash::mojom::NotifierUiDataPtr>
-WebPageNotifierController::GetNotifierList(Profile* profile) {
-  std::vector<ash::mojom::NotifierUiDataPtr> notifiers;
+std::vector<ash::NotifierMetadata> WebPageNotifierController::GetNotifierList(
+    Profile* profile) {
+  std::vector<ash::NotifierMetadata> notifiers;
 
   ContentSettingsForOneType settings;
   HostContentSettingsMapFactory::GetForProfile(profile)->GetSettingsForOneType(
@@ -52,11 +53,11 @@
     content_settings::SettingInfo info;
     HostContentSettingsMapFactory::GetForProfile(profile)->GetWebsiteSetting(
         url, GURL(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string(), &info);
-    notifiers.push_back(ash::mojom::NotifierUiData::New(
+    notifiers.emplace_back(
         notifier_id, name,
         notifier_state_tracker->IsNotifierEnabled(notifier_id),
         info.source == content_settings::SETTING_SOURCE_POLICY,
-        gfx::ImageSkia()));
+        gfx::ImageSkia());
     patterns_[url_pattern] = iter->primary_pattern;
     // Note that favicon service obtains the favicon from history. This means
     // that it will fail to obtain the image if there are no history data for
diff --git a/chrome/browser/notifications/web_page_notifier_controller.h b/chrome/browser/notifications/web_page_notifier_controller.h
index 239a71f..69d378c 100644
--- a/chrome/browser/notifications/web_page_notifier_controller.h
+++ b/chrome/browser/notifications/web_page_notifier_controller.h
@@ -21,8 +21,7 @@
   explicit WebPageNotifierController(Observer* observer);
   ~WebPageNotifierController() override;
 
-  std::vector<ash::mojom::NotifierUiDataPtr> GetNotifierList(
-      Profile* profile) override;
+  std::vector<ash::NotifierMetadata> GetNotifierList(Profile* profile) override;
 
   void SetNotifierEnabled(Profile* profile,
                           const message_center::NotifierId& notifier_id,