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

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

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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/session/session_state_delegate.h" 7 #include "ash/common/session/session_state_delegate.h"
8 #include "ash/common/shelf/shelf_types.h" 8 #include "ash/common/shelf/shelf_types.h"
9 #include "ash/common/shelf/wm_shelf_util.h" 9 #include "ash/common/shelf/wm_shelf_util.h"
10 #include "ash/common/system/tray/fixed_sized_image_view.h" 10 #include "ash/common/system/tray/fixed_sized_image_view.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } // namespace 61 } // namespace
62 62
63 namespace tray { 63 namespace tray {
64 64
65 // This view is displayed in the system tray when the cast extension is active. 65 // This view is displayed in the system tray when the cast extension is active.
66 // It asks the user if they want to cast the desktop. If they click on the 66 // It asks the user if they want to cast the desktop. If they click on the
67 // chevron, then a detail view will replace this view where the user will 67 // chevron, then a detail view will replace this view where the user will
68 // actually pick the cast receiver. 68 // actually pick the cast receiver.
69 class CastSelectDefaultView : public TrayItemMore { 69 class CastSelectDefaultView : public TrayItemMore {
70 public: 70 public:
71 CastSelectDefaultView(SystemTrayItem* owner, 71 CastSelectDefaultView(SystemTrayItem* owner, bool show_more);
72 bool show_more);
73 ~CastSelectDefaultView() override; 72 ~CastSelectDefaultView() override;
74 73
75 private: 74 private:
76 DISALLOW_COPY_AND_ASSIGN(CastSelectDefaultView); 75 DISALLOW_COPY_AND_ASSIGN(CastSelectDefaultView);
77 }; 76 };
78 77
79 CastSelectDefaultView::CastSelectDefaultView(SystemTrayItem* owner, 78 CastSelectDefaultView::CastSelectDefaultView(SystemTrayItem* owner,
80 bool show_more) 79 bool show_more)
81 : TrayItemMore(owner, show_more) { 80 : TrayItemMore(owner, show_more) {
82 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 81 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 152
154 // Add the stop bottom on the far-right. We customize how this stop button is 153 // Add the stop bottom on the far-right. We customize how this stop button is
155 // displayed inside of |Layout()|. 154 // displayed inside of |Layout()|.
156 base::string16 stop_button_text = 155 base::string16 stop_button_text =
157 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( 156 ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
158 IDS_ASH_STATUS_TRAY_CAST_STOP); 157 IDS_ASH_STATUS_TRAY_CAST_STOP);
159 stop_button_ = new TrayPopupLabelButton(this, stop_button_text); 158 stop_button_ = new TrayPopupLabelButton(this, stop_button_text);
160 AddChildView(stop_button_); 159 AddChildView(stop_button_);
161 } 160 }
162 161
163 CastCastView::~CastCastView() { 162 CastCastView::~CastCastView() {}
164 }
165 163
166 int CastCastView::GetHeightForWidth(int width) const { 164 int CastCastView::GetHeightForWidth(int width) const {
167 // We are reusing the cached label_->bounds() calculation which was 165 // We are reusing the cached label_->bounds() calculation which was
168 // done inside of Layout(). Due to the way this object is initialized, 166 // done inside of Layout(). Due to the way this object is initialized,
169 // Layout() will always get initially invoked with the dummy text 167 // Layout() will always get initially invoked with the dummy text
170 // (which will compute the proper label width) and then when we know 168 // (which will compute the proper label width) and then when we know
171 // the cast receiver we will update the label text, which will cause 169 // the cast receiver we will update the label text, which will cause
172 // this method to get invoked. 170 // this method to get invoked.
173 return std::max(views::View::GetHeightForWidth(width), 171 return std::max(views::View::GetHeightForWidth(width),
174 kTrayPopupPaddingBetweenItems * 2 + 172 kTrayPopupPaddingBetweenItems * 2 +
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 342
345 CastTrayView::CastTrayView(SystemTrayItem* tray_item) 343 CastTrayView::CastTrayView(SystemTrayItem* tray_item)
346 : TrayItemView(tray_item) { 344 : TrayItemView(tray_item) {
347 CreateImageView(); 345 CreateImageView();
348 346
349 image_view()->SetImage(ui::ResourceBundle::GetSharedInstance() 347 image_view()->SetImage(ui::ResourceBundle::GetSharedInstance()
350 .GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE) 348 .GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE)
351 .ToImageSkia()); 349 .ToImageSkia());
352 } 350 }
353 351
354 CastTrayView::~CastTrayView() { 352 CastTrayView::~CastTrayView() {}
355 }
356 353
357 void CastTrayView::UpdateAlignment(ShelfAlignment alignment) { 354 void CastTrayView::UpdateAlignment(ShelfAlignment alignment) {
358 // Center the item dependent on the orientation of the shelf. 355 // Center the item dependent on the orientation of the shelf.
359 views::BoxLayout::Orientation layout = IsHorizontalAlignment(alignment) 356 views::BoxLayout::Orientation layout = IsHorizontalAlignment(alignment)
360 ? views::BoxLayout::kVertical 357 ? views::BoxLayout::kVertical
361 : views::BoxLayout::kHorizontal; 358 : views::BoxLayout::kHorizontal;
362 SetLayoutManager(new views::BoxLayout(layout, 0, 0, 0)); 359 SetLayoutManager(new views::BoxLayout(layout, 0, 0, 0));
363 Layout(); 360 Layout();
364 } 361 }
365 362
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 405
409 CastDetailedView::CastDetailedView( 406 CastDetailedView::CastDetailedView(
410 SystemTrayItem* owner, 407 SystemTrayItem* owner,
411 LoginStatus login, 408 LoginStatus login,
412 const CastConfigDelegate::ReceiversAndActivities& receivers_and_activities) 409 const CastConfigDelegate::ReceiversAndActivities& receivers_and_activities)
413 : TrayDetailsView(owner), login_(login) { 410 : TrayDetailsView(owner), login_(login) {
414 CreateItems(); 411 CreateItems();
415 UpdateReceiverList(receivers_and_activities); 412 UpdateReceiverList(receivers_and_activities);
416 } 413 }
417 414
418 CastDetailedView::~CastDetailedView() { 415 CastDetailedView::~CastDetailedView() {}
419 }
420 416
421 void CastDetailedView::SimulateViewClickedForTest( 417 void CastDetailedView::SimulateViewClickedForTest(
422 const std::string& receiver_id) { 418 const std::string& receiver_id) {
423 for (auto& it : receiver_activity_map_) { 419 for (auto& it : receiver_activity_map_) {
424 if (it.second == receiver_id) { 420 if (it.second == receiver_id) {
425 OnViewClicked(it.first); 421 OnViewClicked(it.first);
426 break; 422 break;
427 } 423 }
428 } 424 }
429 } 425 }
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 is_casting_ = started; 662 is_casting_ = started;
667 UpdatePrimaryView(); 663 UpdatePrimaryView();
668 } 664 }
669 665
670 void TrayCast::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { 666 void TrayCast::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {
671 if (tray_) 667 if (tray_)
672 tray_->UpdateAlignment(alignment); 668 tray_->UpdateAlignment(alignment);
673 } 669 }
674 670
675 } // namespace ash 671 } // namespace ash
OLDNEW
« no previous file with comments | « ash/sticky_keys/sticky_keys_unittest.cc ('k') | ash/system/chromeos/audio/audio_detailed_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698