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

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

Issue 2610853011: Put the close button of a notification into focus chain. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | 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/arc/notification/arc_notification_surface_manager.h" 13 #include "ui/arc/notification/arc_notification_surface_manager.h"
14 #include "ui/aura/window_observer.h" 14 #include "ui/aura/window_observer.h"
15 #include "ui/message_center/views/custom_notification_content_view_delegate.h" 15 #include "ui/message_center/views/custom_notification_content_view_delegate.h"
16 #include "ui/views/controls/button/button.h" 16 #include "ui/views/controls/button/button.h"
17 #include "ui/views/controls/native/native_view_host.h" 17 #include "ui/views/controls/native/native_view_host.h"
18 18
19 namespace exo { 19 namespace exo {
20 class NotificationSurface; 20 class NotificationSurface;
21 } 21 }
22 22
23 namespace views { 23 namespace views {
24 class FocusTraversable;
24 class ImageButton; 25 class ImageButton;
25 class Widget; 26 class Widget;
26 } 27 }
27 28
28 namespace arc { 29 namespace arc {
29 30
30 class ArcCustomNotificationView 31 class ArcCustomNotificationView
31 : public views::NativeViewHost, 32 : public views::NativeViewHost,
32 public views::ButtonListener, 33 public views::ButtonListener,
33 public aura::WindowObserver, 34 public aura::WindowObserver,
34 public ArcCustomNotificationItem::Observer, 35 public ArcCustomNotificationItem::Observer,
35 public ArcNotificationSurfaceManager::Observer { 36 public ArcNotificationSurfaceManager::Observer {
36 public: 37 public:
37 explicit ArcCustomNotificationView(ArcCustomNotificationItem* item); 38 explicit ArcCustomNotificationView(ArcCustomNotificationItem* item);
38 ~ArcCustomNotificationView() override; 39 ~ArcCustomNotificationView() override;
39 40
40 std::unique_ptr<message_center::CustomNotificationContentViewDelegate> 41 std::unique_ptr<message_center::CustomNotificationContentViewDelegate>
41 CreateContentViewDelegate(); 42 CreateContentViewDelegate();
42 43
43 private: 44 private:
44 class ContentViewDelegate; 45 class ContentViewDelegate;
46 class CloseButton;
45 class EventForwarder; 47 class EventForwarder;
46 class SlideHelper; 48 class SlideHelper;
47 49
48 void CreateFloatingCloseButton(); 50 void CreateFloatingCloseButton();
49 void SetSurface(exo::NotificationSurface* surface); 51 void SetSurface(exo::NotificationSurface* surface);
50 void UpdatePreferredSize(); 52 void UpdatePreferredSize();
51 void UpdateCloseButtonVisiblity(); 53 void UpdateCloseButtonVisiblity();
52 void UpdatePinnedState(); 54 void UpdatePinnedState();
53 void UpdateSnapshot(); 55 void UpdateSnapshot();
54 void AttachSurface(); 56 void AttachSurface();
55 57
56 // views::NativeViewHost 58 // views::NativeViewHost
57 void ViewHierarchyChanged( 59 void ViewHierarchyChanged(
58 const ViewHierarchyChangedDetails& details) override; 60 const ViewHierarchyChangedDetails& details) override;
59 void Layout() override; 61 void Layout() override;
60 void OnPaint(gfx::Canvas* canvas) override; 62 void OnPaint(gfx::Canvas* canvas) override;
61 void OnKeyEvent(ui::KeyEvent* event) override; 63 void OnKeyEvent(ui::KeyEvent* event) override;
62 void OnGestureEvent(ui::GestureEvent* event) override; 64 void OnGestureEvent(ui::GestureEvent* event) override;
63 void OnMouseEntered(const ui::MouseEvent& event) override; 65 void OnMouseEntered(const ui::MouseEvent& event) override;
64 void OnMouseExited(const ui::MouseEvent& event) override; 66 void OnMouseExited(const ui::MouseEvent& event) override;
65 void OnFocus() override; 67 void OnFocus() override;
66 void OnBlur() override; 68 void OnBlur() override;
69 views::FocusTraversable* GetFocusTraversable() override;
67 70
68 // views::ButtonListener 71 // views::ButtonListener
69 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 72 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
70 73
71 // aura::WindowObserver 74 // aura::WindowObserver
72 void OnWindowBoundsChanged(aura::Window* window, 75 void OnWindowBoundsChanged(aura::Window* window,
73 const gfx::Rect& old_bounds, 76 const gfx::Rect& old_bounds,
74 const gfx::Rect& new_bounds) override; 77 const gfx::Rect& new_bounds) override;
75 void OnWindowDestroying(aura::Window* window) override; 78 void OnWindowDestroying(aura::Window* window) override;
76 79
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 111
109 // Protects from call loops between Layout and OnWindowBoundsChanged. 112 // Protects from call loops between Layout and OnWindowBoundsChanged.
110 bool in_layout_ = false; 113 bool in_layout_ = false;
111 114
112 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); 115 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView);
113 }; 116 };
114 117
115 } // namespace arc 118 } // namespace arc
116 119
117 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ 120 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | ui/arc/notification/arc_custom_notification_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698