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

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

Issue 2347293002: arc: Add InstanceHelper::GetInstanceForMethod() (Closed)
Patch Set: No more DCHECK 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
« no previous file with comments | « components/arc/storage_manager/arc_storage_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f30dfbdd9286b554a668959f06ac466b501017f5 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()->GetInstanceForMethod(
+ "CreateNotificationWindow", kMinVersionNotificationWindow);
+ 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()->GetInstanceForMethod(
+ "CloseNotificationWindow", kMinVersionNotificationWindow);
+ if (!notifications_instance)
return;
- }
-
- if (arc_bridge_service()->notifications()->version() <
- kMinVersionNotificationWindow) {
- VLOG(2) << "NotificationInstance does not support CloseNotificationWindow.";
- return;
- }
notifications_instance->CloseNotificationWindow(key);
}
« no previous file with comments | « components/arc/storage_manager/arc_storage_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698