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

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

Issue 1907363004: (Merge to M-51) Revise the shelf alignment locking mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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/shell.cc ('k') | ash/system/chromeos/network/tray_network.cc » ('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/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
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
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
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | ash/system/chromeos/network/tray_network.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698