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

Side by Side Diff: ui/message_center/views/custom_notification_view.h

Issue 2581703003: Defer focus handling to the content if it claims to have focus. (Closed)
Patch Set: address the comment 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
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_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_ 5 #ifndef UI_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_
6 #define UI_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_ 6 #define UI_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "ui/message_center/message_center_export.h" 9 #include "ui/message_center/message_center_export.h"
10 #include "ui/message_center/views/message_view.h" 10 #include "ui/message_center/views/message_view.h"
11 11
12 namespace views {
13 class Painter;
14 }
15
12 namespace message_center { 16 namespace message_center {
13 17
14 // View for notification with NOTIFICATION_TYPE_CUSTOM that hosts the custom 18 // View for notification with NOTIFICATION_TYPE_CUSTOM that hosts the custom
15 // content of the notification. 19 // content of the notification.
16 class MESSAGE_CENTER_EXPORT CustomNotificationView : public MessageView { 20 class MESSAGE_CENTER_EXPORT CustomNotificationView : public MessageView {
17 public: 21 public:
18 CustomNotificationView(MessageCenterController* controller, 22 CustomNotificationView(MessageCenterController* controller,
19 const Notification& notification); 23 const Notification& notification);
20 ~CustomNotificationView() override; 24 ~CustomNotificationView() override;
21 25
26 // These method are called by the content view when focus handling is defered
27 // to the content.
28 void OnContentFocused();
29 void OnContentBlured();
30
22 // Overidden from MessageView: 31 // Overidden from MessageView:
23 void SetDrawBackgroundAsActive(bool active) override; 32 void SetDrawBackgroundAsActive(bool active) override;
24 bool IsCloseButtonFocused() const override; 33 bool IsCloseButtonFocused() const override;
25 void RequestFocusOnCloseButton() override; 34 void RequestFocusOnCloseButton() override;
26 bool IsPinned() const override; 35 bool IsPinned() const override;
27 36
28 // Overridden from views::View: 37 // Overridden from views::View:
29 gfx::Size GetPreferredSize() const override; 38 gfx::Size GetPreferredSize() const override;
30 void Layout() override; 39 void Layout() override;
40 bool HasFocus() const override;
41 void RequestFocus() override;
42 void OnPaint(gfx::Canvas* canvas) override;
31 43
32 private: 44 private:
33 friend class CustomNotificationViewTest; 45 friend class CustomNotificationViewTest;
34 46
35 // The view for the custom content. Owned by view hierarchy. 47 // The view for the custom content. Owned by view hierarchy.
36 views::View* contents_view_ = nullptr; 48 views::View* contents_view_ = nullptr;
37 std::unique_ptr<CustomNotificationContentViewDelegate> 49 std::unique_ptr<CustomNotificationContentViewDelegate>
38 contents_view_delegate_; 50 contents_view_delegate_;
39 51
52 std::unique_ptr<views::Painter> focus_painter_;
53
40 DISALLOW_COPY_AND_ASSIGN(CustomNotificationView); 54 DISALLOW_COPY_AND_ASSIGN(CustomNotificationView);
41 }; 55 };
42 56
43 } // namespace message_center 57 } // namespace message_center
44 58
45 #endif // UI_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_ 59 #endif // UI_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_
OLDNEW
« no previous file with comments | « ui/arc/notification/arc_custom_notification_view.cc ('k') | ui/message_center/views/custom_notification_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698