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

Side by Side Diff: ash/common/system/overview/overview_button_tray.cc

Issue 2147143002: [Chrome OS MD] Draw a 1px separator between 2 tray items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix ways to calculate x position for separator + fix comments Created 4 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/overview/overview_button_tray.h" 5 #include "ash/common/system/overview/overview_button_tray.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_constants.h" 9 #include "ash/common/shelf/shelf_constants.h"
10 #include "ash/common/shelf/shelf_types.h" 10 #include "ash/common/shelf/shelf_types.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 void OverviewButtonTray::SetIconBorderForShelfAlignment() { 116 void OverviewButtonTray::SetIconBorderForShelfAlignment() {
117 if (ash::MaterialDesignController::IsShelfMaterial()) { 117 if (ash::MaterialDesignController::IsShelfMaterial()) {
118 // Pad button size to align with other controls in the system tray. 118 // Pad button size to align with other controls in the system tray.
119 const gfx::ImageSkia image = icon_->GetImage(); 119 const gfx::ImageSkia image = icon_->GetImage();
120 const int vertical_padding = (kTrayItemSize - image.height()) / 2; 120 const int vertical_padding = (kTrayItemSize - image.height()) / 2;
121 const int horizontal_padding = (kTrayItemSize - image.width()) / 2; 121 const int horizontal_padding = (kTrayItemSize - image.width()) / 2;
122 icon_->SetBorder(views::Border::CreateEmptyBorder( 122 icon_->SetBorder(views::Border::CreateEmptyBorder(
123 gfx::Insets(vertical_padding, horizontal_padding))); 123 gfx::Insets(vertical_padding, horizontal_padding)));
124 } else { 124 } else {
125 if (IsHorizontalAlignment(shelf_alignment())) { 125 if (IsHorizontalAlignment(shelf_alignment())) {
126 icon_->SetBorder(views::Border::CreateEmptyBorder( 126 icon_->SetBorder(views::Border::CreateEmptyBorder(gfx::Insets(
127 kHorizontalShelfVerticalPadding, kHorizontalShelfHorizontalPadding, 127 kHorizontalShelfVerticalPadding, kHorizontalShelfHorizontalPadding)));
128 kHorizontalShelfVerticalPadding, kHorizontalShelfHorizontalPadding));
129 } else { 128 } else {
130 icon_->SetBorder(views::Border::CreateEmptyBorder( 129 icon_->SetBorder(views::Border::CreateEmptyBorder(gfx::Insets(
131 kVerticalShelfVerticalPadding, kVerticalShelfHorizontalPadding, 130 kVerticalShelfVerticalPadding, kVerticalShelfHorizontalPadding)));
varkha 2016/08/19 16:33:39 nit: Can you calculate insets in all 3 cases and t
yiyix 2016/08/19 19:07:55 Done.
132 kVerticalShelfVerticalPadding, kVerticalShelfHorizontalPadding));
133 } 131 }
134 } 132 }
135 } 133 }
136 134
137 void OverviewButtonTray::UpdateIconVisibility() { 135 void OverviewButtonTray::UpdateIconVisibility() {
138 // The visibility of the OverviewButtonTray has diverge from 136 // The visibility of the OverviewButtonTray has diverge from
139 // WindowSelectorController::CanSelect. The visibility of the button should 137 // WindowSelectorController::CanSelect. The visibility of the button should
140 // not change during transient times in which CanSelect is false. Such as when 138 // not change during transient times in which CanSelect is false. Such as when
141 // a modal dialog is present. 139 // a modal dialog is present.
142 WmShell* shell = WmShell::Get(); 140 WmShell* shell = WmShell::Get();
143 SessionStateDelegate* session_state_delegate = 141 SessionStateDelegate* session_state_delegate =
144 shell->GetSessionStateDelegate(); 142 shell->GetSessionStateDelegate();
145 143
146 SetVisible( 144 SetVisible(
147 shell->maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled() && 145 shell->maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled() &&
148 session_state_delegate->IsActiveUserSessionStarted() && 146 session_state_delegate->IsActiveUserSessionStarted() &&
149 !session_state_delegate->IsScreenLocked() && 147 !session_state_delegate->IsScreenLocked() &&
150 session_state_delegate->GetSessionState() == 148 session_state_delegate->GetSessionState() ==
151 SessionStateDelegate::SESSION_STATE_ACTIVE && 149 SessionStateDelegate::SESSION_STATE_ACTIVE &&
152 shell->system_tray_delegate()->GetUserLoginStatus() != 150 shell->system_tray_delegate()->GetUserLoginStatus() !=
153 LoginStatus::KIOSK_APP); 151 LoginStatus::KIOSK_APP);
154 } 152 }
155 153
156 } // namespace ash 154 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698