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

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

Issue 2554903003: Add unittest for MessageListView (Closed)
Patch Set: fixed the build failrue on win Created 4 years 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/message_center/BUILD.gn ('k') | ui/message_center/views/message_center_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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_MESSAGE_CENTER_VIEW_H_ 5 #ifndef UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_
6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ 6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "ui/gfx/animation/animation_delegate.h" 11 #include "ui/gfx/animation/animation_delegate.h"
12 #include "ui/message_center/message_center_export.h" 12 #include "ui/message_center/message_center_export.h"
13 #include "ui/message_center/message_center_observer.h" 13 #include "ui/message_center/message_center_observer.h"
14 #include "ui/message_center/notification_list.h" 14 #include "ui/message_center/notification_list.h"
15 #include "ui/message_center/views/message_center_controller.h" 15 #include "ui/message_center/views/message_center_controller.h"
16 #include "ui/message_center/views/message_list_view.h"
16 #include "ui/message_center/views/message_view.h" 17 #include "ui/message_center/views/message_view.h"
17 #include "ui/views/view.h" 18 #include "ui/views/view.h"
18 19
19 namespace gfx { 20 namespace gfx {
20 class MultiAnimation; 21 class MultiAnimation;
21 } // namespace gfx 22 } // namespace gfx
22 23
23 namespace message_center { 24 namespace message_center {
24 25
25 class MessageCenter; 26 class MessageCenter;
26 class MessageCenterButtonBar; 27 class MessageCenterButtonBar;
27 class MessageCenterTray; 28 class MessageCenterTray;
28 class MessageView; 29 class MessageView;
29 class MessageViewContextMenuController; 30 class MessageViewContextMenuController;
30 class MessageListView; 31 class MessageListView;
31 class NotifierSettingsView; 32 class NotifierSettingsView;
32 33
33 // Container for all the top-level views in the notification center, such as the 34 // Container for all the top-level views in the notification center, such as the
34 // button bar, settings view, scrol view, and message list view. Acts as a 35 // button bar, settings view, scrol view, and message list view. Acts as a
35 // controller for the message list view, passing data back and forth to message 36 // controller for the message list view, passing data back and forth to message
36 // center. 37 // center.
37 class MESSAGE_CENTER_EXPORT MessageCenterView : public views::View, 38 class MESSAGE_CENTER_EXPORT MessageCenterView
38 public MessageCenterObserver, 39 : public views::View,
39 public MessageCenterController, 40 public MessageCenterObserver,
40 public gfx::AnimationDelegate { 41 public MessageCenterController,
42 public MessageListView::Observer,
43 public gfx::AnimationDelegate {
41 public: 44 public:
42 MessageCenterView(MessageCenter* message_center, 45 MessageCenterView(MessageCenter* message_center,
43 MessageCenterTray* tray, 46 MessageCenterTray* tray,
44 int max_height, 47 int max_height,
45 bool initially_settings_visible, 48 bool initially_settings_visible,
46 bool top_down); 49 bool top_down);
47 ~MessageCenterView() override; 50 ~MessageCenterView() override;
48 51
49 void SetNotifications(const NotificationList::Notifications& notifications); 52 void SetNotifications(const NotificationList::Notifications& notifications);
50 53
51 void ClearAllClosableNotifications(); 54 void ClearAllClosableNotifications();
52 void OnAllNotificationsCleared();
53 55
54 size_t NumMessageViewsForTest() const; 56 size_t NumMessageViewsForTest() const;
55 57
56 void SetSettingsVisible(bool visible); 58 void SetSettingsVisible(bool visible);
57 void OnSettingsChanged(); 59 void OnSettingsChanged();
58 bool settings_visible() const { return settings_visible_; } 60 bool settings_visible() const { return settings_visible_; }
59 MessageCenterTray* tray() { return tray_; } 61 MessageCenterTray* tray() { return tray_; }
60 62
61 void SetIsClosing(bool is_closing); 63 void SetIsClosing(bool is_closing);
62 64
(...skipping 16 matching lines...) Expand all
79 void RemoveNotification(const std::string& notification_id, 81 void RemoveNotification(const std::string& notification_id,
80 bool by_user) override; 82 bool by_user) override;
81 std::unique_ptr<ui::MenuModel> CreateMenuModel( 83 std::unique_ptr<ui::MenuModel> CreateMenuModel(
82 const NotifierId& notifier_id, 84 const NotifierId& notifier_id,
83 const base::string16& display_source) override; 85 const base::string16& display_source) override;
84 bool HasClickedListener(const std::string& notification_id) override; 86 bool HasClickedListener(const std::string& notification_id) override;
85 void ClickOnNotificationButton(const std::string& notification_id, 87 void ClickOnNotificationButton(const std::string& notification_id,
86 int button_index) override; 88 int button_index) override;
87 void ClickOnSettingsButton(const std::string& notification_id) override; 89 void ClickOnSettingsButton(const std::string& notification_id) override;
88 90
91 // Overridden from MessageListView::Observer:
92 void OnAllNotificationsCleared() override;
93
89 // Overridden from gfx::AnimationDelegate: 94 // Overridden from gfx::AnimationDelegate:
90 void AnimationEnded(const gfx::Animation* animation) override; 95 void AnimationEnded(const gfx::Animation* animation) override;
91 void AnimationProgressed(const gfx::Animation* animation) override; 96 void AnimationProgressed(const gfx::Animation* animation) override;
92 void AnimationCanceled(const gfx::Animation* animation) override; 97 void AnimationCanceled(const gfx::Animation* animation) override;
93 98
94 private: 99 private:
95 friend class MessageCenterViewTest; 100 friend class MessageCenterViewTest;
96 101
97 enum class Mode { NOTIFICATIONS, SETTINGS, BUTTONS_ONLY }; 102 enum class Mode { NOTIFICATIONS, SETTINGS, BUTTONS_ONLY };
98 103
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 Mode mode_ = Mode::BUTTONS_ONLY; 150 Mode mode_ = Mode::BUTTONS_ONLY;
146 151
147 std::unique_ptr<MessageViewContextMenuController> context_menu_controller_; 152 std::unique_ptr<MessageViewContextMenuController> context_menu_controller_;
148 153
149 DISALLOW_COPY_AND_ASSIGN(MessageCenterView); 154 DISALLOW_COPY_AND_ASSIGN(MessageCenterView);
150 }; 155 };
151 156
152 } // namespace message_center 157 } // namespace message_center
153 158
154 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ 159 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_
OLDNEW
« no previous file with comments | « ui/message_center/BUILD.gn ('k') | ui/message_center/views/message_center_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698