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

Side by Side Diff: ash/common/system/tray/tray_utils.cc

Issue 2455183002: Simplify layout of tray items and fix spacing for MD. (Closed)
Patch Set: Created 4 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/tray/tray_utils.h" 5 #include "ash/common/system/tray/tray_utils.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/wm_shelf_util.h" 9 #include "ash/common/shelf/wm_shelf_util.h"
10 #include "ash/common/system/tray/tray_constants.h" 10 #include "ash/common/system/tray/tray_constants.h"
(...skipping 19 matching lines...) Expand all
30 gfx::FontList().Derive(1, gfx::Font::NORMAL, gfx::Font::Weight::BOLD)); 30 gfx::FontList().Derive(1, gfx::Font::NORMAL, gfx::Font::Weight::BOLD));
31 label->SetShadows(gfx::ShadowValues( 31 label->SetShadows(gfx::ShadowValues(
32 1, 32 1,
33 gfx::ShadowValue(gfx::Vector2d(0, 1), 0, SkColorSetARGB(64, 0, 0, 0)))); 33 gfx::ShadowValue(gfx::Vector2d(0, 1), 0, SkColorSetARGB(64, 0, 0, 0))));
34 label->SetAutoColorReadabilityEnabled(false); 34 label->SetAutoColorReadabilityEnabled(false);
35 label->SetEnabledColor(SK_ColorWHITE); 35 label->SetEnabledColor(SK_ColorWHITE);
36 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); 36 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255));
37 } 37 }
38 } 38 }
39 39
40 // TODO(yiyix): Instead of using a fixed padding beside each tray item, take
41 // internal icon padding into account when adjusting tray icon spacing. See
42 // crbug.com/653292.
43 void SetTrayImageItemBorder(views::View* tray_view, ShelfAlignment alignment) { 40 void SetTrayImageItemBorder(views::View* tray_view, ShelfAlignment alignment) {
41 if (MaterialDesignController::IsShelfMaterial())
Evan Stade 2016/10/27 19:05:30 TrayItemView takes care of sizing, don't need this
tdanderson 2016/10/27 19:28:01 Won't this still be needed by TrayPower::UpdateAft
Evan Stade 2016/10/27 21:36:34 yes. I saw that class, but figured it was working
42 return;
43
44 const int tray_image_item_padding = GetTrayConstant(TRAY_IMAGE_ITEM_PADDING); 44 const int tray_image_item_padding = GetTrayConstant(TRAY_IMAGE_ITEM_PADDING);
45 if (IsHorizontalAlignment(alignment)) { 45 if (IsHorizontalAlignment(alignment)) {
46 tray_view->SetBorder(views::Border::CreateEmptyBorder( 46 tray_view->SetBorder(views::Border::CreateEmptyBorder(
47 0, tray_image_item_padding, 0, tray_image_item_padding)); 47 0, tray_image_item_padding, 0, tray_image_item_padding));
48 } else { 48 } else {
49 tray_view->SetBorder(views::Border::CreateEmptyBorder( 49 tray_view->SetBorder(views::Border::CreateEmptyBorder(
50 tray_image_item_padding, 50 tray_image_item_padding,
51 kTrayImageItemHorizontalPaddingVerticalAlignment, 51 kTrayImageItemHorizontalPaddingVerticalAlignment,
52 tray_image_item_padding, 52 tray_image_item_padding,
53 kTrayImageItemHorizontalPaddingVerticalAlignment)); 53 kTrayImageItemHorizontalPaddingVerticalAlignment));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 bool CanOpenWebUISettings(LoginStatus status) { 91 bool CanOpenWebUISettings(LoginStatus status) {
92 // TODO(tdanderson): Consider moving this into WmShell, or introduce a 92 // TODO(tdanderson): Consider moving this into WmShell, or introduce a
93 // CanShowSettings() method in each delegate type that has a 93 // CanShowSettings() method in each delegate type that has a
94 // ShowSettings() method. 94 // ShowSettings() method.
95 return status != LoginStatus::NOT_LOGGED_IN && 95 return status != LoginStatus::NOT_LOGGED_IN &&
96 status != LoginStatus::LOCKED && 96 status != LoginStatus::LOCKED &&
97 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); 97 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen();
98 } 98 }
99 99
100 } // namespace ash 100 } // namespace ash
OLDNEW
« ash/common/system/tray/tray_item_view.cc ('K') | « ash/common/system/tray/tray_item_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698