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

Side by Side 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: add comment for use_custom_notification 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/arc/notification/arc_custom_notification_view.h"
6
7 #include "components/exo/notification_surface.h"
8 #include "components/exo/surface.h"
9 #include "ui/views/widget/widget.h"
10
11 namespace arc {
12
13 ArcCustomNotificationView::ArcCustomNotificationView(
14 exo::NotificationSurface* surface)
15 : surface_(surface) {}
16
17 ArcCustomNotificationView::~ArcCustomNotificationView() {}
18
19 void ArcCustomNotificationView::ViewHierarchyChanged(
20 const views::View::ViewHierarchyChangedDetails& details) {
21 views::Widget* widget = GetWidget();
22
23 // Bail if native_view() has attached to a different widget.
24 if (widget && native_view() &&
25 views::Widget::GetTopLevelWidgetForNativeView(native_view()) != widget) {
26 return;
27 }
28
29 views::NativeViewHost::ViewHierarchyChanged(details);
30
31 if (!widget || !details.is_add)
32 return;
33
34 SetPreferredSize(surface_->GetSize());
35 Attach(surface_->window());
36 }
37
38 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698