Commit a8018f70 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Remove some unnecessary arguments from ChromeAshMessageCenterClient fns.

Bug: 578868
Change-Id: I49cb32bffdddf770354268f1a32dff660e716a14
Reviewed-on: https://chromium-review.googlesource.com/1000021
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552073}
parent 8c0db936
......@@ -89,13 +89,8 @@ ChromeAshMessageCenterClient::~ChromeAshMessageCenterClient() {
g_chrome_ash_message_center_client = nullptr;
}
// The unused variables here will not be a part of the future
// NotificationPlatformBridge interface.
void ChromeAshMessageCenterClient::Display(
NotificationHandler::Type /*notification_type*/,
Profile* /* profile */,
const message_center::Notification& notification,
std::unique_ptr<NotificationCommon::Metadata> metadata) {
const message_center::Notification& notification) {
// Remove any previous mapping to |notification.id()| before inserting a new
// one.
base::EraseIf(
......@@ -110,29 +105,10 @@ void ChromeAshMessageCenterClient::Display(
controller_->ShowClientNotification(notification, token);
}
// The unused variable here will not be a part of the future
// NotificationPlatformBridge interface.
void ChromeAshMessageCenterClient::Close(Profile* /* profile */,
const std::string& notification_id) {
void ChromeAshMessageCenterClient::Close(const std::string& notification_id) {
controller_->CloseClientNotification(notification_id);
}
// The unused variables here will not be a part of the future
// NotificationPlatformBridge interface.
void ChromeAshMessageCenterClient::GetDisplayed(
Profile* /* profile */,
GetDisplayedNotificationsCallback callback) const {
// Right now, this is only used to get web notifications that were created by
// and have outlived a previous browser process. Ash itself doesn't outlive
// the browser process, so there's no need to implement.
std::move(callback).Run(std::make_unique<std::set<std::string>>(), false);
}
void ChromeAshMessageCenterClient::SetReadyCallback(
NotificationBridgeReadyCallback callback) {
std::move(callback).Run(true);
}
void ChromeAshMessageCenterClient::HandleNotificationClosed(
const base::UnguessableToken& display_token,
bool by_user) {
......
......@@ -18,8 +18,7 @@
// 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 NotificationPlatformBridge,
public ash::mojom::AshMessageCenterClient,
class ChromeAshMessageCenterClient : public ash::mojom::AshMessageCenterClient,
public NotifierController::Observer {
public:
explicit ChromeAshMessageCenterClient(
......@@ -27,15 +26,8 @@ class ChromeAshMessageCenterClient : public NotificationPlatformBridge,
~ChromeAshMessageCenterClient() override;
// NotificationPlatformBridge:
void Display(NotificationHandler::Type notification_type,
Profile* profile,
const message_center::Notification& notification,
std::unique_ptr<NotificationCommon::Metadata> metadata) override;
void Close(Profile* profile, const std::string& notification_id) override;
void GetDisplayed(Profile* profile,
GetDisplayedNotificationsCallback callback) const override;
void SetReadyCallback(NotificationBridgeReadyCallback callback) override;
void Display(const message_center::Notification& notification);
void Close(const std::string& notification_id);
// ash::mojom::AshMessageCenterClient:
void HandleNotificationClosed(const base::UnguessableToken& display_token,
......
......@@ -36,8 +36,7 @@ void NotificationPlatformBridgeChromeOs::Display(
std::unique_ptr<NotificationCommon::Metadata> metadata) {
auto active_notification = std::make_unique<ProfileNotification>(
profile, notification, notification_type);
impl_->Display(NotificationHandler::Type::MAX, nullptr /* profile */,
active_notification->notification(), std::move(metadata));
impl_->Display(active_notification->notification());
std::string profile_notification_id =
active_notification->notification().id();
......@@ -48,23 +47,27 @@ void NotificationPlatformBridgeChromeOs::Display(
void NotificationPlatformBridgeChromeOs::Close(
Profile* profile,
const std::string& notification_id) {
// TODO(estade): we need |is_incognito| here.
const std::string profile_notification_id =
ProfileNotification::GetProfileNotificationId(
notification_id, NotificationUIManager::GetProfileID(profile));
impl_->Close(nullptr, profile_notification_id);
impl_->Close(profile_notification_id);
}
void NotificationPlatformBridgeChromeOs::GetDisplayed(
Profile* profile,
GetDisplayedNotificationsCallback callback) const {
impl_->GetDisplayed(profile, std::move(callback));
// Right now, this is only used to get web notifications that were created by
// and have outlived a previous browser process. Ash itself doesn't outlive
// the browser process, so there's no need to implement.
std::move(callback).Run(std::make_unique<std::set<std::string>>(), false);
}
void NotificationPlatformBridgeChromeOs::SetReadyCallback(
NotificationBridgeReadyCallback callback) {
impl_->SetReadyCallback(std::move(callback));
// We don't handle the absence of Ash or a failure to open a Mojo connection,
// so just assume the client is ready.
std::move(callback).Run(true);
}
void NotificationPlatformBridgeChromeOs::HandleNotificationClosed(
......
......@@ -13,6 +13,8 @@
#include "chrome/browser/notifications/notification_platform_bridge.h"
#include "chrome/browser/notifications/profile_notification.h"
class ChromeAshMessageCenterClient;
// The interface that a NotificationPlatformBridge uses to pass back information
// and interactions from the native notification system. TODO(estade): this
// should be hoisted into its own file, implemented by
......@@ -77,7 +79,7 @@ class NotificationPlatformBridgeChromeOs
ProfileNotification* GetProfileNotification(
const std::string& profile_notification_id);
std::unique_ptr<NotificationPlatformBridge> impl_;
std::unique_ptr<ChromeAshMessageCenterClient> impl_;
// A container for all active notifications, where IDs are permuted to
// uniquely identify both the notification and its source profile. The key is
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment