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

Side by Side Diff: ash/system/cast/tray_cast.cc

Issue 2036353002: mash: Move ash/common/wm/shelf to ash/common/shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 4 years, 6 months 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 | « ash/system/cast/tray_cast.h ('k') | ash/system/chromeos/network/tray_network.h » ('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 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/common/wm/shelf/wm_shelf_util.h" 7 #include "ash/common/shelf/shelf_types.h"
8 #include "ash/common/shelf/wm_shelf_util.h"
8 #include "ash/session/session_state_delegate.h" 9 #include "ash/session/session_state_delegate.h"
9 #include "ash/shelf/shelf_types.h"
10 #include "ash/shelf/shelf_util.h" 10 #include "ash/shelf/shelf_util.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/system/chromeos/screen_security/screen_tray_item.h" 12 #include "ash/system/chromeos/screen_security/screen_tray_item.h"
13 #include "ash/system/tray/fixed_sized_image_view.h" 13 #include "ash/system/tray/fixed_sized_image_view.h"
14 #include "ash/system/tray/fixed_sized_scroll_view.h" 14 #include "ash/system/tray/fixed_sized_scroll_view.h"
15 #include "ash/system/tray/hover_highlight_view.h" 15 #include "ash/system/tray/hover_highlight_view.h"
16 #include "ash/system/tray/system_tray.h" 16 #include "ash/system/tray/system_tray.h"
17 #include "ash/system/tray/system_tray_delegate.h" 17 #include "ash/system/tray/system_tray_delegate.h"
18 #include "ash/system/tray/system_tray_notifier.h" 18 #include "ash/system/tray/system_tray_notifier.h"
19 #include "ash/system/tray/throbber_view.h" 19 #include "ash/system/tray/throbber_view.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 } 332 }
333 333
334 // Exposes an icon in the tray. |TrayCast| manages the visiblity of this. 334 // Exposes an icon in the tray. |TrayCast| manages the visiblity of this.
335 class CastTrayView : public TrayItemView { 335 class CastTrayView : public TrayItemView {
336 public: 336 public:
337 explicit CastTrayView(SystemTrayItem* tray_item); 337 explicit CastTrayView(SystemTrayItem* tray_item);
338 ~CastTrayView() override; 338 ~CastTrayView() override;
339 339
340 // Called when the tray alignment changes so that the icon can recenter 340 // Called when the tray alignment changes so that the icon can recenter
341 // itself. 341 // itself.
342 void UpdateAlignment(wm::ShelfAlignment alignment); 342 void UpdateAlignment(ShelfAlignment alignment);
343 343
344 private: 344 private:
345 DISALLOW_COPY_AND_ASSIGN(CastTrayView); 345 DISALLOW_COPY_AND_ASSIGN(CastTrayView);
346 }; 346 };
347 347
348 CastTrayView::CastTrayView(SystemTrayItem* tray_item) 348 CastTrayView::CastTrayView(SystemTrayItem* tray_item)
349 : TrayItemView(tray_item) { 349 : TrayItemView(tray_item) {
350 CreateImageView(); 350 CreateImageView();
351 351
352 image_view()->SetImage(ui::ResourceBundle::GetSharedInstance() 352 image_view()->SetImage(ui::ResourceBundle::GetSharedInstance()
353 .GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE) 353 .GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE)
354 .ToImageSkia()); 354 .ToImageSkia());
355 } 355 }
356 356
357 CastTrayView::~CastTrayView() { 357 CastTrayView::~CastTrayView() {
358 } 358 }
359 359
360 void CastTrayView::UpdateAlignment(wm::ShelfAlignment alignment) { 360 void CastTrayView::UpdateAlignment(ShelfAlignment alignment) {
361 // Center the item dependent on the orientation of the shelf. 361 // Center the item dependent on the orientation of the shelf.
362 views::BoxLayout::Orientation layout = wm::IsHorizontalAlignment(alignment) 362 views::BoxLayout::Orientation layout = IsHorizontalAlignment(alignment)
363 ? views::BoxLayout::kVertical 363 ? views::BoxLayout::kVertical
364 : views::BoxLayout::kHorizontal; 364 : views::BoxLayout::kHorizontal;
365 SetLayoutManager(new views::BoxLayout(layout, 0, 0, 0)); 365 SetLayoutManager(new views::BoxLayout(layout, 0, 0, 0));
366 Layout(); 366 Layout();
367 } 367 }
368 368
369 // This view displays a list of cast receivers that can be clicked on and casted 369 // This view displays a list of cast receivers that can be clicked on and casted
370 // to. It is activated by clicking on the chevron inside of 370 // to. It is activated by clicking on the chevron inside of
371 // |CastSelectDefaultView|. 371 // |CastSelectDefaultView|.
372 class CastDetailedView : public TrayDetailsView, public ViewClickListener { 372 class CastDetailedView : public TrayDetailsView, public ViewClickListener {
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 if (tray_) 667 if (tray_)
668 tray_->SetVisible(false); 668 tray_->SetVisible(false);
669 } 669 }
670 } 670 }
671 671
672 void TrayCast::OnCastingSessionStartedOrStopped(bool started) { 672 void TrayCast::OnCastingSessionStartedOrStopped(bool started) {
673 is_casting_ = started; 673 is_casting_ = started;
674 UpdatePrimaryView(); 674 UpdatePrimaryView();
675 } 675 }
676 676
677 void TrayCast::UpdateAfterShelfAlignmentChange(wm::ShelfAlignment alignment) { 677 void TrayCast::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {
678 if (tray_) 678 if (tray_)
679 tray_->UpdateAlignment(alignment); 679 tray_->UpdateAlignment(alignment);
680 } 680 }
681 681
682 } // namespace ash 682 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/cast/tray_cast.h ('k') | ash/system/chromeos/network/tray_network.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698