OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "ash/system/tray/system_tray.h" | 5 #include "ash/system/tray/system_tray.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/accessibility_delegate.h" | 9 #include "ash/accessibility_delegate.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 SystemTray* GetSystemTray() { | 41 SystemTray* GetSystemTray() { |
42 return Shell::GetPrimaryRootWindowController()->shelf()-> | 42 return Shell::GetPrimaryRootWindowController()->shelf()-> |
43 status_area_widget()->system_tray(); | 43 status_area_widget()->system_tray(); |
44 } | 44 } |
45 | 45 |
46 // Trivial item implementation that tracks its views for testing. | 46 // Trivial item implementation that tracks its views for testing. |
47 class TestItem : public SystemTrayItem { | 47 class TestItem : public SystemTrayItem { |
48 public: | 48 public: |
49 TestItem() : SystemTrayItem(GetSystemTray()), tray_view_(NULL) {} | 49 TestItem() : SystemTrayItem(GetSystemTray()), tray_view_(NULL) {} |
50 | 50 |
51 virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE { | 51 virtual views::View* CreateTrayView(user::LoginStatus status) override { |
52 tray_view_ = new views::View; | 52 tray_view_ = new views::View; |
53 // Add a label so it has non-zero width. | 53 // Add a label so it has non-zero width. |
54 tray_view_->SetLayoutManager(new views::FillLayout); | 54 tray_view_->SetLayoutManager(new views::FillLayout); |
55 tray_view_->AddChildView(new views::Label(base::UTF8ToUTF16("Tray"))); | 55 tray_view_->AddChildView(new views::Label(base::UTF8ToUTF16("Tray"))); |
56 return tray_view_; | 56 return tray_view_; |
57 } | 57 } |
58 | 58 |
59 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE { | 59 virtual views::View* CreateDefaultView(user::LoginStatus status) override { |
60 default_view_ = new views::View; | 60 default_view_ = new views::View; |
61 default_view_->SetLayoutManager(new views::FillLayout); | 61 default_view_->SetLayoutManager(new views::FillLayout); |
62 default_view_->AddChildView(new views::Label(base::UTF8ToUTF16("Default"))); | 62 default_view_->AddChildView(new views::Label(base::UTF8ToUTF16("Default"))); |
63 return default_view_; | 63 return default_view_; |
64 } | 64 } |
65 | 65 |
66 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE { | 66 virtual views::View* CreateDetailedView(user::LoginStatus status) override { |
67 detailed_view_ = new views::View; | 67 detailed_view_ = new views::View; |
68 detailed_view_->SetLayoutManager(new views::FillLayout); | 68 detailed_view_->SetLayoutManager(new views::FillLayout); |
69 detailed_view_->AddChildView( | 69 detailed_view_->AddChildView( |
70 new views::Label(base::UTF8ToUTF16("Detailed"))); | 70 new views::Label(base::UTF8ToUTF16("Detailed"))); |
71 return detailed_view_; | 71 return detailed_view_; |
72 } | 72 } |
73 | 73 |
74 virtual views::View* CreateNotificationView( | 74 virtual views::View* CreateNotificationView( |
75 user::LoginStatus status) OVERRIDE { | 75 user::LoginStatus status) override { |
76 notification_view_ = new views::View; | 76 notification_view_ = new views::View; |
77 return notification_view_; | 77 return notification_view_; |
78 } | 78 } |
79 | 79 |
80 virtual void DestroyTrayView() OVERRIDE { | 80 virtual void DestroyTrayView() override { |
81 tray_view_ = NULL; | 81 tray_view_ = NULL; |
82 } | 82 } |
83 | 83 |
84 virtual void DestroyDefaultView() OVERRIDE { | 84 virtual void DestroyDefaultView() override { |
85 default_view_ = NULL; | 85 default_view_ = NULL; |
86 } | 86 } |
87 | 87 |
88 virtual void DestroyDetailedView() OVERRIDE { | 88 virtual void DestroyDetailedView() override { |
89 detailed_view_ = NULL; | 89 detailed_view_ = NULL; |
90 } | 90 } |
91 | 91 |
92 virtual void DestroyNotificationView() OVERRIDE { | 92 virtual void DestroyNotificationView() override { |
93 notification_view_ = NULL; | 93 notification_view_ = NULL; |
94 } | 94 } |
95 | 95 |
96 virtual void UpdateAfterLoginStatusChange( | 96 virtual void UpdateAfterLoginStatusChange( |
97 user::LoginStatus status) OVERRIDE { | 97 user::LoginStatus status) override { |
98 } | 98 } |
99 | 99 |
100 views::View* tray_view() const { return tray_view_; } | 100 views::View* tray_view() const { return tray_view_; } |
101 views::View* default_view() const { return default_view_; } | 101 views::View* default_view() const { return default_view_; } |
102 views::View* detailed_view() const { return detailed_view_; } | 102 views::View* detailed_view() const { return detailed_view_; } |
103 views::View* notification_view() const { return notification_view_; } | 103 views::View* notification_view() const { return notification_view_; } |
104 | 104 |
105 private: | 105 private: |
106 views::View* tray_view_; | 106 views::View* tray_view_; |
107 views::View* default_view_; | 107 views::View* default_view_; |
108 views::View* detailed_view_; | 108 views::View* detailed_view_; |
109 views::View* notification_view_; | 109 views::View* notification_view_; |
110 }; | 110 }; |
111 | 111 |
112 // Trivial item implementation that returns NULL from tray/default/detailed | 112 // Trivial item implementation that returns NULL from tray/default/detailed |
113 // view creation methods. | 113 // view creation methods. |
114 class TestNoViewItem : public SystemTrayItem { | 114 class TestNoViewItem : public SystemTrayItem { |
115 public: | 115 public: |
116 TestNoViewItem() : SystemTrayItem(GetSystemTray()) {} | 116 TestNoViewItem() : SystemTrayItem(GetSystemTray()) {} |
117 | 117 |
118 virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE { | 118 virtual views::View* CreateTrayView(user::LoginStatus status) override { |
119 return NULL; | 119 return NULL; |
120 } | 120 } |
121 | 121 |
122 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE { | 122 virtual views::View* CreateDefaultView(user::LoginStatus status) override { |
123 return NULL; | 123 return NULL; |
124 } | 124 } |
125 | 125 |
126 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE { | 126 virtual views::View* CreateDetailedView(user::LoginStatus status) override { |
127 return NULL; | 127 return NULL; |
128 } | 128 } |
129 | 129 |
130 virtual views::View* CreateNotificationView( | 130 virtual views::View* CreateNotificationView( |
131 user::LoginStatus status) OVERRIDE { | 131 user::LoginStatus status) override { |
132 return NULL; | 132 return NULL; |
133 } | 133 } |
134 | 134 |
135 virtual void DestroyTrayView() OVERRIDE {} | 135 virtual void DestroyTrayView() override {} |
136 virtual void DestroyDefaultView() OVERRIDE {} | 136 virtual void DestroyDefaultView() override {} |
137 virtual void DestroyDetailedView() OVERRIDE {} | 137 virtual void DestroyDetailedView() override {} |
138 virtual void DestroyNotificationView() OVERRIDE {} | 138 virtual void DestroyNotificationView() override {} |
139 virtual void UpdateAfterLoginStatusChange( | 139 virtual void UpdateAfterLoginStatusChange( |
140 user::LoginStatus status) OVERRIDE { | 140 user::LoginStatus status) override { |
141 } | 141 } |
142 }; | 142 }; |
143 | 143 |
144 class ModalWidgetDelegate : public views::WidgetDelegateView { | 144 class ModalWidgetDelegate : public views::WidgetDelegateView { |
145 public: | 145 public: |
146 ModalWidgetDelegate() {} | 146 ModalWidgetDelegate() {} |
147 virtual ~ModalWidgetDelegate() {} | 147 virtual ~ModalWidgetDelegate() {} |
148 | 148 |
149 virtual views::View* GetContentsView() OVERRIDE { return this; } | 149 virtual views::View* GetContentsView() override { return this; } |
150 virtual ui::ModalType GetModalType() const OVERRIDE { | 150 virtual ui::ModalType GetModalType() const override { |
151 return ui::MODAL_TYPE_SYSTEM; | 151 return ui::MODAL_TYPE_SYSTEM; |
152 } | 152 } |
153 | 153 |
154 private: | 154 private: |
155 DISALLOW_COPY_AND_ASSIGN(ModalWidgetDelegate); | 155 DISALLOW_COPY_AND_ASSIGN(ModalWidgetDelegate); |
156 }; | 156 }; |
157 | 157 |
158 } // namespace | 158 } // namespace |
159 | 159 |
160 typedef AshTestBase SystemTrayTest; | 160 typedef AshTestBase SystemTrayTest; |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 | 500 |
501 tray->SetVisible(true); | 501 tray->SetVisible(true); |
502 animation_duration.reset(); | 502 animation_duration.reset(); |
503 tray->layer()->GetAnimator()->StopAnimating(); | 503 tray->layer()->GetAnimator()->StopAnimating(); |
504 EXPECT_TRUE(tray->visible()); | 504 EXPECT_TRUE(tray->visible()); |
505 EXPECT_EQ(1.0f, tray->layer()->GetTargetOpacity()); | 505 EXPECT_EQ(1.0f, tray->layer()->GetTargetOpacity()); |
506 } | 506 } |
507 | 507 |
508 } // namespace test | 508 } // namespace test |
509 } // namespace ash | 509 } // namespace ash |
OLD | NEW |