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

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

Issue 2066853002: arc: Show custom notification via notification surface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notification-exo
Patch Set: rebase Created 4 years, 6 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 | « ui/arc/notification/arc_custom_notification_view.h ('k') | ui/arc/notification/arc_notification_item.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/arc/notification/arc_custom_notification_view.cc
diff --git a/ui/arc/notification/arc_custom_notification_view.cc b/ui/arc/notification/arc_custom_notification_view.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5fefa7e0d09393799951ae47aaa1c16de03beae1
--- /dev/null
+++ b/ui/arc/notification/arc_custom_notification_view.cc
@@ -0,0 +1,38 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/arc/notification/arc_custom_notification_view.h"
+
+#include "components/exo/notification_surface.h"
+#include "components/exo/surface.h"
+#include "ui/views/widget/widget.h"
+
+namespace arc {
+
+ArcCustomNotificationView::ArcCustomNotificationView(
+ exo::NotificationSurface* surface)
+ : surface_(surface) {}
+
+ArcCustomNotificationView::~ArcCustomNotificationView() {}
+
+void ArcCustomNotificationView::ViewHierarchyChanged(
+ const views::View::ViewHierarchyChangedDetails& details) {
+ views::Widget* widget = GetWidget();
+
+ // Bail if native_view() has attached to a different widget.
+ if (widget && native_view() &&
+ views::Widget::GetTopLevelWidgetForNativeView(native_view()) != widget) {
+ return;
+ }
+
+ views::NativeViewHost::ViewHierarchyChanged(details);
+
+ if (!widget || !details.is_add)
+ return;
+
+ SetPreferredSize(surface_->GetSize());
+ Attach(surface_->window());
+}
+
+} // namespace arc
« no previous file with comments | « ui/arc/notification/arc_custom_notification_view.h ('k') | ui/arc/notification/arc_notification_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698