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

Side by Side Diff: ui/arc/notification/arc_custom_notification_view.h

Issue 2223583002: Merge "arc: Support custom notification size change" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 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
« no previous file with comments | « ui/arc/notification/DEPS ('k') | ui/arc/notification/arc_custom_notification_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ 5 #ifndef UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_
6 #define UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ 6 #define UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "ui/arc/notification/arc_custom_notification_item.h" 12 #include "ui/arc/notification/arc_custom_notification_item.h"
13 #include "ui/aura/window_observer.h"
13 #include "ui/views/controls/button/button.h" 14 #include "ui/views/controls/button/button.h"
14 #include "ui/views/controls/native/native_view_host.h" 15 #include "ui/views/controls/native/native_view_host.h"
15 16
16 namespace exo { 17 namespace exo {
17 class NotificationSurface; 18 class NotificationSurface;
18 } 19 }
19 20
20 namespace views { 21 namespace views {
21 class ImageButton; 22 class ImageButton;
22 class Widget; 23 class Widget;
23 } 24 }
24 25
25 namespace arc { 26 namespace arc {
26 27
27 class ArcCustomNotificationView : public views::NativeViewHost, 28 class ArcCustomNotificationView : public views::NativeViewHost,
28 public views::ButtonListener, 29 public views::ButtonListener,
30 public aura::WindowObserver,
29 public ArcCustomNotificationItem::Observer { 31 public ArcCustomNotificationItem::Observer {
30 public: 32 public:
31 ArcCustomNotificationView(ArcCustomNotificationItem* item, 33 ArcCustomNotificationView(ArcCustomNotificationItem* item,
32 exo::NotificationSurface* surface); 34 exo::NotificationSurface* surface);
33 ~ArcCustomNotificationView() override; 35 ~ArcCustomNotificationView() override;
34 36
35 private: 37 private:
36 void CreateFloatingCloseButton(); 38 void CreateFloatingCloseButton();
39 void UpdatePreferredSize();
37 40
38 // views::NativeViewHost 41 // views::NativeViewHost
39 void ViewHierarchyChanged( 42 void ViewHierarchyChanged(
40 const ViewHierarchyChangedDetails& details) override; 43 const ViewHierarchyChangedDetails& details) override;
41 void Layout() override; 44 void Layout() override;
42 45
43 // views::ButtonListener 46 // views::ButtonListener
44 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 47 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
45 48
49 // aura::WindowObserver
50 void OnWindowBoundsChanged(aura::Window* window,
51 const gfx::Rect& old_bounds,
52 const gfx::Rect& new_bounds) override;
53 void OnWindowDestroying(aura::Window* window) override;
54
46 // ArcCustomNotificationItem::Observer 55 // ArcCustomNotificationItem::Observer
47 void OnItemDestroying() override; 56 void OnItemDestroying() override;
48 void OnItemPinnedChanged() override; 57 void OnItemPinnedChanged() override;
49 void OnItemNotificationSurfaceRemoved() override; 58 void OnItemNotificationSurfaceRemoved() override;
50 59
51 ArcCustomNotificationItem* item_; 60 ArcCustomNotificationItem* item_;
52 exo::NotificationSurface* surface_; 61 exo::NotificationSurface* surface_;
53 62
54 // A close button on top of NotificationSurface. Needed because the 63 // A close button on top of NotificationSurface. Needed because the
55 // aura::Window of NotificationSurface is added after hosting widget's 64 // aura::Window of NotificationSurface is added after hosting widget's
56 // RootView thus standard notification close button is always below 65 // RootView thus standard notification close button is always below
57 // it. 66 // it.
58 std::unique_ptr<views::Widget> floating_close_button_widget_; 67 std::unique_ptr<views::Widget> floating_close_button_widget_;
59 68
60 views::ImageButton* floating_close_button_ = nullptr; 69 views::ImageButton* floating_close_button_ = nullptr;
61 70
62 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); 71 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView);
63 }; 72 };
64 73
65 } // namespace arc 74 } // namespace arc
66 75
67 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ 76 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_
OLDNEW
« no previous file with comments | « ui/arc/notification/DEPS ('k') | ui/arc/notification/arc_custom_notification_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698