| 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/shelf/shelf_util.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 } | 331 } |
| 332 | 332 |
| 333 // Exposes an icon in the tray. |TrayCast| manages the visiblity of this. | 333 // Exposes an icon in the tray. |TrayCast| manages the visiblity of this. |
| 334 class CastTrayView : public TrayItemView { | 334 class CastTrayView : public TrayItemView { |
| 335 public: | 335 public: |
| 336 explicit CastTrayView(SystemTrayItem* tray_item); | 336 explicit CastTrayView(SystemTrayItem* tray_item); |
| 337 ~CastTrayView() override; | 337 ~CastTrayView() override; |
| 338 | 338 |
| 339 // Called when the tray alignment changes so that the icon can recenter | 339 // Called when the tray alignment changes so that the icon can recenter |
| 340 // itself. | 340 // itself. |
| 341 void UpdateAlignment(ShelfAlignment alignment); | 341 void UpdateAlignment(wm::ShelfAlignment alignment); |
| 342 | 342 |
| 343 private: | 343 private: |
| 344 DISALLOW_COPY_AND_ASSIGN(CastTrayView); | 344 DISALLOW_COPY_AND_ASSIGN(CastTrayView); |
| 345 }; | 345 }; |
| 346 | 346 |
| 347 CastTrayView::CastTrayView(SystemTrayItem* tray_item) | 347 CastTrayView::CastTrayView(SystemTrayItem* tray_item) |
| 348 : TrayItemView(tray_item) { | 348 : TrayItemView(tray_item) { |
| 349 CreateImageView(); | 349 CreateImageView(); |
| 350 | 350 |
| 351 image_view()->SetImage(ui::ResourceBundle::GetSharedInstance() | 351 image_view()->SetImage(ui::ResourceBundle::GetSharedInstance() |
| 352 .GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE) | 352 .GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE) |
| 353 .ToImageSkia()); | 353 .ToImageSkia()); |
| 354 } | 354 } |
| 355 | 355 |
| 356 CastTrayView::~CastTrayView() { | 356 CastTrayView::~CastTrayView() { |
| 357 } | 357 } |
| 358 | 358 |
| 359 void CastTrayView::UpdateAlignment(ShelfAlignment alignment) { | 359 void CastTrayView::UpdateAlignment(wm::ShelfAlignment alignment) { |
| 360 // Center the item dependent on the orientation of the shelf. | 360 // Center the item dependent on the orientation of the shelf. |
| 361 views::BoxLayout::Orientation layout = IsHorizontalAlignment(alignment) | 361 views::BoxLayout::Orientation layout = IsHorizontalAlignment(alignment) |
| 362 ? views::BoxLayout::kVertical | 362 ? views::BoxLayout::kVertical |
| 363 : views::BoxLayout::kHorizontal; | 363 : views::BoxLayout::kHorizontal; |
| 364 SetLayoutManager(new views::BoxLayout(layout, 0, 0, 0)); | 364 SetLayoutManager(new views::BoxLayout(layout, 0, 0, 0)); |
| 365 Layout(); | 365 Layout(); |
| 366 } | 366 } |
| 367 | 367 |
| 368 // 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 |
| 369 // to. It is activated by clicking on the chevron inside of | 369 // to. It is activated by clicking on the chevron inside of |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 if (tray_) | 666 if (tray_) |
| 667 tray_->SetVisible(false); | 667 tray_->SetVisible(false); |
| 668 } | 668 } |
| 669 } | 669 } |
| 670 | 670 |
| 671 void TrayCast::OnCastingSessionStartedOrStopped(bool started) { | 671 void TrayCast::OnCastingSessionStartedOrStopped(bool started) { |
| 672 is_casting_ = started; | 672 is_casting_ = started; |
| 673 UpdatePrimaryView(); | 673 UpdatePrimaryView(); |
| 674 } | 674 } |
| 675 | 675 |
| 676 void TrayCast::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { | 676 void TrayCast::UpdateAfterShelfAlignmentChange(wm::ShelfAlignment alignment) { |
| 677 if (tray_) | 677 if (tray_) |
| 678 tray_->UpdateAlignment(alignment); | 678 tray_->UpdateAlignment(alignment); |
| 679 } | 679 } |
| 680 | 680 |
| 681 } // namespace ash | 681 } // namespace ash |
| OLD | NEW |