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

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

Issue 2316183003: Move a bunch of ash-only vector icons to ash/. (Closed)
Patch Set: drop the "id". Just "icon". It's cleaner. Created 4 years, 3 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/common/system/cast/tray_cast.h" 5 #include "ash/common/system/cast/tray_cast.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/session/session_state_delegate.h" 8 #include "ash/common/session/session_state_delegate.h"
9 #include "ash/common/shelf/shelf_types.h" 9 #include "ash/common/shelf/shelf_types.h"
10 #include "ash/common/shelf/wm_shelf_util.h" 10 #include "ash/common/shelf/wm_shelf_util.h"
11 #include "ash/common/system/chromeos/screen_security/screen_tray_item.h" 11 #include "ash/common/system/chromeos/screen_security/screen_tray_item.h"
12 #include "ash/common/system/tray/fixed_sized_image_view.h" 12 #include "ash/common/system/tray/fixed_sized_image_view.h"
13 #include "ash/common/system/tray/fixed_sized_scroll_view.h" 13 #include "ash/common/system/tray/fixed_sized_scroll_view.h"
14 #include "ash/common/system/tray/hover_highlight_view.h" 14 #include "ash/common/system/tray/hover_highlight_view.h"
15 #include "ash/common/system/tray/system_tray.h" 15 #include "ash/common/system/tray/system_tray.h"
16 #include "ash/common/system/tray/system_tray_delegate.h" 16 #include "ash/common/system/tray/system_tray_delegate.h"
17 #include "ash/common/system/tray/throbber_view.h" 17 #include "ash/common/system/tray/throbber_view.h"
18 #include "ash/common/system/tray/tray_constants.h" 18 #include "ash/common/system/tray/tray_constants.h"
19 #include "ash/common/system/tray/tray_details_view.h" 19 #include "ash/common/system/tray/tray_details_view.h"
20 #include "ash/common/system/tray/tray_item_more.h" 20 #include "ash/common/system/tray/tray_item_more.h"
21 #include "ash/common/system/tray/tray_item_view.h" 21 #include "ash/common/system/tray/tray_item_view.h"
22 #include "ash/common/system/tray/tray_popup_label_button.h" 22 #include "ash/common/system/tray/tray_popup_label_button.h"
23 #include "ash/common/wm_shell.h" 23 #include "ash/common/wm_shell.h"
24 #include "ash/resources/vector_icons/vector_icons.h"
24 #include "base/bind.h" 25 #include "base/bind.h"
25 #include "grit/ash_resources.h" 26 #include "grit/ash_resources.h"
26 #include "grit/ash_strings.h" 27 #include "grit/ash_strings.h"
27 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
28 #include "ui/base/resource/resource_bundle.h" 29 #include "ui/base/resource/resource_bundle.h"
29 #include "ui/gfx/image/image.h" 30 #include "ui/gfx/image/image.h"
30 #include "ui/gfx/paint_vector_icon.h" 31 #include "ui/gfx/paint_vector_icon.h"
31 #include "ui/gfx/text_elider.h" 32 #include "ui/gfx/text_elider.h"
32 #include "ui/gfx/vector_icons_public.h"
33 #include "ui/views/controls/button/button.h" 33 #include "ui/views/controls/button/button.h"
34 #include "ui/views/controls/image_view.h" 34 #include "ui/views/controls/image_view.h"
35 #include "ui/views/controls/label.h" 35 #include "ui/views/controls/label.h"
36 #include "ui/views/layout/box_layout.h" 36 #include "ui/views/layout/box_layout.h"
37 #include "ui/views/layout/fill_layout.h" 37 #include "ui/views/layout/fill_layout.h"
38 38
39 namespace ash { 39 namespace ash {
40 40
41 namespace { 41 namespace {
42 42
(...skipping 13 matching lines...) Expand all
56 base::string16 ElideString(const base::string16& text) { 56 base::string16 ElideString(const base::string16& text) {
57 base::string16 elided; 57 base::string16 elided;
58 gfx::ElideString(text, kMaximumStatusStringLength, &elided); 58 gfx::ElideString(text, kMaximumStatusStringLength, &elided);
59 return elided; 59 return elided;
60 } 60 }
61 61
62 // Returns a vectorized version of the Cast icon. The icon's interior region is 62 // Returns a vectorized version of the Cast icon. The icon's interior region is
63 // filled in if |is_casting| is true. 63 // filled in if |is_casting| is true.
64 gfx::ImageSkia GetCastIconForSystemMenu(bool is_casting) { 64 gfx::ImageSkia GetCastIconForSystemMenu(bool is_casting) {
65 return gfx::CreateVectorIcon( 65 return gfx::CreateVectorIcon(
66 gfx::VectorIconId::SYSTEM_MENU_CAST, 66 kSystemMenuCastIcon, is_casting ? kMenuIconColor : SK_ColorTRANSPARENT);
67 is_casting ? kMenuIconColor : SK_ColorTRANSPARENT);
68 } 67 }
69 68
70 } // namespace 69 } // namespace
71 70
72 namespace tray { 71 namespace tray {
73 72
74 // This view is displayed in the system tray when the cast extension is active. 73 // This view is displayed in the system tray when the cast extension is active.
75 // It asks the user if they want to cast the desktop. If they click on the 74 // It asks the user if they want to cast the desktop. If they click on the
76 // chevron, then a detail view will replace this view where the user will 75 // chevron, then a detail view will replace this view where the user will
77 // actually pick the cast receiver. 76 // actually pick the cast receiver.
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 void UpdateAlignment(ShelfAlignment alignment); 353 void UpdateAlignment(ShelfAlignment alignment);
355 354
356 private: 355 private:
357 DISALLOW_COPY_AND_ASSIGN(CastTrayView); 356 DISALLOW_COPY_AND_ASSIGN(CastTrayView);
358 }; 357 };
359 358
360 CastTrayView::CastTrayView(SystemTrayItem* tray_item) 359 CastTrayView::CastTrayView(SystemTrayItem* tray_item)
361 : TrayItemView(tray_item) { 360 : TrayItemView(tray_item) {
362 CreateImageView(); 361 CreateImageView();
363 if (MaterialDesignController::UseMaterialDesignSystemIcons()) { 362 if (MaterialDesignController::UseMaterialDesignSystemIcons()) {
364 image_view()->SetImage(gfx::CreateVectorIcon( 363 image_view()->SetImage(
365 gfx::VectorIconId::SYSTEM_TRAY_CAST, kTrayIconColor)); 364 gfx::CreateVectorIcon(kSystemTrayCastIcon, kTrayIconColor));
366 } else { 365 } else {
367 image_view()->SetImage(ui::ResourceBundle::GetSharedInstance() 366 image_view()->SetImage(ui::ResourceBundle::GetSharedInstance()
368 .GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE) 367 .GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE)
369 .ToImageSkia()); 368 .ToImageSkia());
370 } 369 }
371 } 370 }
372 371
373 CastTrayView::~CastTrayView() {} 372 CastTrayView::~CastTrayView() {}
374 373
375 void CastTrayView::UpdateAlignment(ShelfAlignment alignment) { 374 void CastTrayView::UpdateAlignment(ShelfAlignment alignment) {
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 is_casting_ = started; 677 is_casting_ = started;
679 UpdatePrimaryView(); 678 UpdatePrimaryView();
680 } 679 }
681 680
682 void TrayCast::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { 681 void TrayCast::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {
683 if (tray_) 682 if (tray_)
684 tray_->UpdateAlignment(alignment); 683 tray_->UpdateAlignment(alignment);
685 } 684 }
686 685
687 } // namespace ash 686 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/audio/volume_view.cc ('k') | ash/common/system/chromeos/bluetooth/tray_bluetooth.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698