| 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/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/accelerators/accelerator_table.h" | 8 #include "ash/accelerators/accelerator_table.h" |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 // Trivial item implementation that tracks its views for testing. | 259 // Trivial item implementation that tracks its views for testing. |
| 260 class TestItem : public SystemTrayItem { | 260 class TestItem : public SystemTrayItem { |
| 261 public: | 261 public: |
| 262 TestItem() | 262 TestItem() |
| 263 : SystemTrayItem(GetSystemTray()), | 263 : SystemTrayItem(GetSystemTray()), |
| 264 tray_view_(nullptr), | 264 tray_view_(nullptr), |
| 265 default_view_(nullptr), | 265 default_view_(nullptr), |
| 266 detailed_view_(nullptr), | 266 detailed_view_(nullptr), |
| 267 notification_view_(nullptr) {} | 267 notification_view_(nullptr) {} |
| 268 | 268 |
| 269 views::View* CreateTrayView(user::LoginStatus status) override { | 269 views::View* CreateTrayView(LoginStatus status) override { |
| 270 tray_view_ = new views::View; | 270 tray_view_ = new views::View; |
| 271 // Add a label so it has non-zero width. | 271 // Add a label so it has non-zero width. |
| 272 tray_view_->SetLayoutManager(new views::FillLayout); | 272 tray_view_->SetLayoutManager(new views::FillLayout); |
| 273 tray_view_->AddChildView(new views::Label(base::UTF8ToUTF16("Tray"))); | 273 tray_view_->AddChildView(new views::Label(base::UTF8ToUTF16("Tray"))); |
| 274 return tray_view_; | 274 return tray_view_; |
| 275 } | 275 } |
| 276 | 276 |
| 277 views::View* CreateDefaultView(user::LoginStatus status) override { | 277 views::View* CreateDefaultView(LoginStatus status) override { |
| 278 default_view_ = new views::View; | 278 default_view_ = new views::View; |
| 279 default_view_->SetLayoutManager(new views::FillLayout); | 279 default_view_->SetLayoutManager(new views::FillLayout); |
| 280 default_view_->AddChildView(new views::Label(base::UTF8ToUTF16("Default"))); | 280 default_view_->AddChildView(new views::Label(base::UTF8ToUTF16("Default"))); |
| 281 return default_view_; | 281 return default_view_; |
| 282 } | 282 } |
| 283 | 283 |
| 284 views::View* CreateDetailedView(user::LoginStatus status) override { | 284 views::View* CreateDetailedView(LoginStatus status) override { |
| 285 detailed_view_ = new views::View; | 285 detailed_view_ = new views::View; |
| 286 detailed_view_->SetLayoutManager(new views::FillLayout); | 286 detailed_view_->SetLayoutManager(new views::FillLayout); |
| 287 detailed_view_->AddChildView( | 287 detailed_view_->AddChildView( |
| 288 new views::Label(base::UTF8ToUTF16("Detailed"))); | 288 new views::Label(base::UTF8ToUTF16("Detailed"))); |
| 289 return detailed_view_; | 289 return detailed_view_; |
| 290 } | 290 } |
| 291 | 291 |
| 292 views::View* CreateNotificationView(user::LoginStatus status) override { | 292 views::View* CreateNotificationView(LoginStatus status) override { |
| 293 notification_view_ = new views::View; | 293 notification_view_ = new views::View; |
| 294 return notification_view_; | 294 return notification_view_; |
| 295 } | 295 } |
| 296 | 296 |
| 297 void DestroyTrayView() override { tray_view_ = nullptr; } | 297 void DestroyTrayView() override { tray_view_ = nullptr; } |
| 298 | 298 |
| 299 void DestroyDefaultView() override { default_view_ = nullptr; } | 299 void DestroyDefaultView() override { default_view_ = nullptr; } |
| 300 | 300 |
| 301 void DestroyDetailedView() override { detailed_view_ = nullptr; } | 301 void DestroyDetailedView() override { detailed_view_ = nullptr; } |
| 302 | 302 |
| 303 void DestroyNotificationView() override { notification_view_ = nullptr; } | 303 void DestroyNotificationView() override { notification_view_ = nullptr; } |
| 304 | 304 |
| 305 void UpdateAfterLoginStatusChange(user::LoginStatus status) override {} | 305 void UpdateAfterLoginStatusChange(LoginStatus status) override {} |
| 306 | 306 |
| 307 views::View* tray_view() const { return tray_view_; } | 307 views::View* tray_view() const { return tray_view_; } |
| 308 views::View* default_view() const { return default_view_; } | 308 views::View* default_view() const { return default_view_; } |
| 309 views::View* detailed_view() const { return detailed_view_; } | 309 views::View* detailed_view() const { return detailed_view_; } |
| 310 views::View* notification_view() const { return notification_view_; } | 310 views::View* notification_view() const { return notification_view_; } |
| 311 | 311 |
| 312 private: | 312 private: |
| 313 views::View* tray_view_; | 313 views::View* tray_view_; |
| 314 views::View* default_view_; | 314 views::View* default_view_; |
| 315 views::View* detailed_view_; | 315 views::View* detailed_view_; |
| (...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2297 ->shelf_widget() | 2297 ->shelf_widget() |
| 2298 ->status_area_widget(); | 2298 ->status_area_widget(); |
| 2299 EXPECT_TRUE(status_area_widget->IsVisible()); | 2299 EXPECT_TRUE(status_area_widget->IsVisible()); |
| 2300 // Shelf should be in the first display's area. | 2300 // Shelf should be in the first display's area. |
| 2301 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); | 2301 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); |
| 2302 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); | 2302 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); |
| 2303 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); | 2303 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); |
| 2304 } | 2304 } |
| 2305 | 2305 |
| 2306 } // namespace ash | 2306 } // namespace ash |
| OLD | NEW |