Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Unified Diff: ui/arc/notification/arc_notification_manager.cc

Issue 2133503002: arc: Revamp the ArcBridgeService interface (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: more rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/arc/notification/arc_notification_manager.cc
diff --git a/ui/arc/notification/arc_notification_manager.cc b/ui/arc/notification/arc_notification_manager.cc
index a6e3fa55d7130ed0b1a8619182b5ff59a2836981..69eb47a4ed8d0357bffa35a8600a07fa360d7c46 100644
--- a/ui/arc/notification/arc_notification_manager.cc
+++ b/ui/arc/notification/arc_notification_manager.cc
@@ -27,27 +27,23 @@ ArcNotificationManager::ArcNotificationManager(
main_profile_id_(main_profile_id),
message_center_(message_center),
binding_(this) {
- arc_bridge_service()->AddObserver(this);
+ arc_bridge_service()->notifications()->AddObserver(this);
}
ArcNotificationManager::~ArcNotificationManager() {
- arc_bridge_service()->RemoveObserver(this);
+ arc_bridge_service()->notifications()->RemoveObserver(this);
}
-void ArcNotificationManager::OnNotificationsInstanceReady() {
+void ArcNotificationManager::OnInstanceReady(
+ mojom::NotificationsInstance* notifications_instance,
+ uint32_t version) {
DCHECK(!ready_);
- auto notifications_instance = arc_bridge_service()->notifications_instance();
- if (!notifications_instance) {
- VLOG(2) << "Request to refresh app list when bridge service is not ready.";
- return;
- }
-
notifications_instance->Init(binding_.CreateInterfacePtrAndBind());
ready_ = true;
}
-void ArcNotificationManager::OnNotificationsInstanceClosed() {
+void ArcNotificationManager::OnInstanceClosed(mojom::NotificationsInstance*) {
DCHECK(ready_);
while (!items_.empty()) {
auto it = items_.begin();
@@ -109,7 +105,8 @@ void ArcNotificationManager::SendNotificationRemovedFromChrome(
std::unique_ptr<ArcNotificationItem> item = std::move(it->second);
items_.erase(it);
- auto notifications_instance = arc_bridge_service()->notifications_instance();
+ auto notifications_instance =
+ arc_bridge_service()->notifications()->instance();
// On shutdown, the ARC channel may quit earlier then notifications.
if (!notifications_instance) {
@@ -130,7 +127,8 @@ void ArcNotificationManager::SendNotificationClickedOnChrome(
return;
}
- auto notifications_instance = arc_bridge_service()->notifications_instance();
+ auto notifications_instance =
+ arc_bridge_service()->notifications()->instance();
// On shutdown, the ARC channel may quit earlier then notifications.
if (!notifications_instance) {
@@ -144,14 +142,16 @@ void ArcNotificationManager::SendNotificationClickedOnChrome(
}
void ArcNotificationManager::SendNotificationButtonClickedOnChrome(
- const std::string& key, int button_index) {
+ const std::string& key,
+ int button_index) {
if (items_.find(key) == items_.end()) {
VLOG(3) << "Chrome requests to fire a click event on notification (key: "
<< key << "), but it is gone.";
return;
}
- auto notifications_instance = arc_bridge_service()->notifications_instance();
+ auto notifications_instance =
+ arc_bridge_service()->notifications()->instance();
// On shutdown, the ARC channel may quit earlier then notifications.
if (!notifications_instance) {
@@ -178,8 +178,8 @@ void ArcNotificationManager::SendNotificationButtonClickedOnChrome(
command = mojom::ArcNotificationEvent::BUTTON_5_CLICKED;
break;
default:
- VLOG(3) << "Invalid button index (key: " << key << ", index: " <<
- button_index << ").";
+ VLOG(3) << "Invalid button index (key: " << key
+ << ", index: " << button_index << ").";
return;
}

Powered by Google App Engine
This is Rietveld 408576698