| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/cast/tray_cast.h" | 5 #include "ash/system/cast/tray_cast.h" |
| 6 | 6 |
| 7 #include "ash/session/session_state_delegate.h" | 7 #include "ash/session/session_state_delegate.h" |
| 8 #include "ash/shelf/shelf_types.h" | 8 #include "ash/shelf/shelf_types.h" |
| 9 #include "ash/shelf/shelf_util.h" |
| 9 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 10 #include "ash/system/chromeos/screen_security/screen_tray_item.h" | 11 #include "ash/system/chromeos/screen_security/screen_tray_item.h" |
| 11 #include "ash/system/tray/fixed_sized_image_view.h" | 12 #include "ash/system/tray/fixed_sized_image_view.h" |
| 12 #include "ash/system/tray/fixed_sized_scroll_view.h" | 13 #include "ash/system/tray/fixed_sized_scroll_view.h" |
| 13 #include "ash/system/tray/hover_highlight_view.h" | 14 #include "ash/system/tray/hover_highlight_view.h" |
| 14 #include "ash/system/tray/system_tray.h" | 15 #include "ash/system/tray/system_tray.h" |
| 15 #include "ash/system/tray/system_tray_delegate.h" | 16 #include "ash/system/tray/system_tray_delegate.h" |
| 16 #include "ash/system/tray/system_tray_notifier.h" | 17 #include "ash/system/tray/system_tray_notifier.h" |
| 17 #include "ash/system/tray/throbber_view.h" | 18 #include "ash/system/tray/throbber_view.h" |
| 18 #include "ash/system/tray/tray_constants.h" | 19 #include "ash/system/tray/tray_constants.h" |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 image_view()->SetImage(ui::ResourceBundle::GetSharedInstance() | 351 image_view()->SetImage(ui::ResourceBundle::GetSharedInstance() |
| 351 .GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE) | 352 .GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE) |
| 352 .ToImageSkia()); | 353 .ToImageSkia()); |
| 353 } | 354 } |
| 354 | 355 |
| 355 CastTrayView::~CastTrayView() { | 356 CastTrayView::~CastTrayView() { |
| 356 } | 357 } |
| 357 | 358 |
| 358 void CastTrayView::UpdateAlignment(ShelfAlignment alignment) { | 359 void CastTrayView::UpdateAlignment(ShelfAlignment alignment) { |
| 359 // Center the item dependent on the orientation of the shelf. | 360 // Center the item dependent on the orientation of the shelf. |
| 360 views::BoxLayout::Orientation layout = views::BoxLayout::kHorizontal; | 361 views::BoxLayout::Orientation layout = IsHorizontalAlignment(alignment) |
| 361 switch (alignment) { | 362 ? views::BoxLayout::kVertical |
| 362 case ash::SHELF_ALIGNMENT_BOTTOM: | 363 : views::BoxLayout::kHorizontal; |
| 363 layout = views::BoxLayout::kHorizontal; | |
| 364 break; | |
| 365 case ash::SHELF_ALIGNMENT_LEFT: | |
| 366 case ash::SHELF_ALIGNMENT_RIGHT: | |
| 367 layout = views::BoxLayout::kVertical; | |
| 368 break; | |
| 369 } | |
| 370 SetLayoutManager(new views::BoxLayout(layout, 0, 0, 0)); | 364 SetLayoutManager(new views::BoxLayout(layout, 0, 0, 0)); |
| 371 Layout(); | 365 Layout(); |
| 372 } | 366 } |
| 373 | 367 |
| 374 // This view displays a list of cast receivers that can be clicked on and casted | 368 // This view displays a list of cast receivers that can be clicked on and casted |
| 375 // to. It is activated by clicking on the chevron inside of | 369 // to. It is activated by clicking on the chevron inside of |
| 376 // |CastSelectDefaultView|. | 370 // |CastSelectDefaultView|. |
| 377 class CastDetailedView : public TrayDetailsView, public ViewClickListener { | 371 class CastDetailedView : public TrayDetailsView, public ViewClickListener { |
| 378 public: | 372 public: |
| 379 CastDetailedView(SystemTrayItem* owner, | 373 CastDetailedView(SystemTrayItem* owner, |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 is_casting_ = started; | 672 is_casting_ = started; |
| 679 UpdatePrimaryView(); | 673 UpdatePrimaryView(); |
| 680 } | 674 } |
| 681 | 675 |
| 682 void TrayCast::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { | 676 void TrayCast::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { |
| 683 if (tray_) | 677 if (tray_) |
| 684 tray_->UpdateAlignment(alignment); | 678 tray_->UpdateAlignment(alignment); |
| 685 } | 679 } |
| 686 | 680 |
| 687 } // namespace ash | 681 } // namespace ash |
| OLD | NEW |