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

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

Issue 2347293002: arc: Add InstanceHelper::GetInstanceForMethod() (Closed)
Patch Set: Addressed feedback Created 4 years, 3 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 59be98a787d3d32796e5b068d8431788ba47c8e2..790019a1030d33c918e2a5f88c4694b76cc1d898 100644
--- a/ui/arc/notification/arc_notification_manager.cc
+++ b/ui/arc/notification/arc_notification_manager.cc
@@ -4,6 +4,9 @@
#include "ui/arc/notification/arc_notification_manager.h"
+#include <memory>
+#include <utility>
+
#include "ash/common/system/toast/toast_manager.h"
#include "ash/common/wm_shell.h"
#include "base/memory/ptr_util.h"
@@ -207,20 +210,10 @@ void ArcNotificationManager::CreateNotificationWindow(const std::string& key) {
}
auto* notifications_instance =
- arc_bridge_service()->notifications()->instance();
- // On shutdown, the ARC channel may quit earlier then notifications.
- if (!notifications_instance) {
- VLOG(2) << "Request to create window for ARC Notification (key: " << key
- << "), but the ARC channel has already gone.";
+ arc_bridge_service()->notifications()->GetInstanceForVersion(
+ kMinVersionNotificationWindow, "CreateNotificationWindow");
+ if (!notifications_instance)
return;
- }
-
- if (arc_bridge_service()->notifications()->version() <
- kMinVersionNotificationWindow) {
- VLOG(2)
- << "NotificationInstance does not support CreateNotificationWindow.";
- return;
- }
notifications_instance->CreateNotificationWindow(key);
}
@@ -233,19 +226,10 @@ void ArcNotificationManager::CloseNotificationWindow(const std::string& key) {
}
auto* notifications_instance =
- arc_bridge_service()->notifications()->instance();
- // On shutdown, the ARC channel may quit earlier then notifications.
- if (!notifications_instance) {
- VLOG(2) << "Request to close window for ARC Notification (key: " << key
- << "), but the ARC channel has already gone.";
+ arc_bridge_service()->notifications()->GetInstanceForVersion(
+ kMinVersionNotificationWindow, "CloseNotificationWindow");
+ if (!notifications_instance)
return;
- }
-
- if (arc_bridge_service()->notifications()->version() <
- kMinVersionNotificationWindow) {
- VLOG(2) << "NotificationInstance does not support CloseNotificationWindow.";
- return;
- }
notifications_instance->CloseNotificationWindow(key);
}

Powered by Google App Engine
This is Rietveld 408576698