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

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: address nits 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 void OverviewButtonTray::SetShelfAlignment(ShelfAlignment alignment) { 108 void OverviewButtonTray::SetShelfAlignment(ShelfAlignment alignment) {
109 if (alignment == shelf_alignment()) 109 if (alignment == shelf_alignment())
110 return; 110 return;
111 111
112 TrayBackgroundView::SetShelfAlignment(alignment); 112 TrayBackgroundView::SetShelfAlignment(alignment);
113 SetIconBorderForShelfAlignment(); 113 SetIconBorderForShelfAlignment();
114 } 114 }
115 115
116 void OverviewButtonTray::SetIconBorderForShelfAlignment() { 116 void OverviewButtonTray::SetIconBorderForShelfAlignment() {
117 gfx::Insets insets;
117 if (ash::MaterialDesignController::IsShelfMaterial()) { 118 if (ash::MaterialDesignController::IsShelfMaterial()) {
118 // Pad button size to align with other controls in the system tray. 119 // Pad button size to align with other controls in the system tray.
119 const gfx::ImageSkia image = icon_->GetImage(); 120 const gfx::ImageSkia image = icon_->GetImage();
120 const int vertical_padding = (kTrayItemSize - image.height()) / 2; 121 const int vertical_padding = (kTrayItemSize - image.height()) / 2;
121 const int horizontal_padding = (kTrayItemSize - image.width()) / 2; 122 const int horizontal_padding = (kTrayItemSize - image.width()) / 2;
122 icon_->SetBorder(views::Border::CreateEmptyBorder( 123 insets = gfx::Insets(vertical_padding, horizontal_padding);
123 gfx::Insets(vertical_padding, horizontal_padding)));
124 } else { 124 } else {
125 if (IsHorizontalAlignment(shelf_alignment())) { 125 insets = IsHorizontalAlignment(shelf_alignment())
126 icon_->SetBorder(views::Border::CreateEmptyBorder( 126 ? gfx::Insets(kHorizontalShelfVerticalPadding,
127 kHorizontalShelfVerticalPadding, kHorizontalShelfHorizontalPadding, 127 kHorizontalShelfHorizontalPadding)
128 kHorizontalShelfVerticalPadding, kHorizontalShelfHorizontalPadding)); 128 : gfx::Insets(kVerticalShelfVerticalPadding,
129 } else { 129 kVerticalShelfHorizontalPadding);
130 icon_->SetBorder(views::Border::CreateEmptyBorder(
131 kVerticalShelfVerticalPadding, kVerticalShelfHorizontalPadding,
132 kVerticalShelfVerticalPadding, kVerticalShelfHorizontalPadding));
133 }
134 } 130 }
131 icon_->SetBorder(views::Border::CreateEmptyBorder(insets));
135 } 132 }
136 133
137 void OverviewButtonTray::UpdateIconVisibility() { 134 void OverviewButtonTray::UpdateIconVisibility() {
138 // The visibility of the OverviewButtonTray has diverge from 135 // The visibility of the OverviewButtonTray has diverge from
139 // WindowSelectorController::CanSelect. The visibility of the button should 136 // WindowSelectorController::CanSelect. The visibility of the button should
140 // not change during transient times in which CanSelect is false. Such as when 137 // not change during transient times in which CanSelect is false. Such as when
141 // a modal dialog is present. 138 // a modal dialog is present.
142 WmShell* shell = WmShell::Get(); 139 WmShell* shell = WmShell::Get();
143 SessionStateDelegate* session_state_delegate = 140 SessionStateDelegate* session_state_delegate =
144 shell->GetSessionStateDelegate(); 141 shell->GetSessionStateDelegate();
145 142
146 SetVisible( 143 SetVisible(
147 shell->maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled() && 144 shell->maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled() &&
148 session_state_delegate->IsActiveUserSessionStarted() && 145 session_state_delegate->IsActiveUserSessionStarted() &&
149 !session_state_delegate->IsScreenLocked() && 146 !session_state_delegate->IsScreenLocked() &&
150 session_state_delegate->GetSessionState() == 147 session_state_delegate->GetSessionState() ==
151 SessionStateDelegate::SESSION_STATE_ACTIVE && 148 SessionStateDelegate::SESSION_STATE_ACTIVE &&
152 shell->system_tray_delegate()->GetUserLoginStatus() != 149 shell->system_tray_delegate()->GetUserLoginStatus() !=
153 LoginStatus::KIOSK_APP); 150 LoginStatus::KIOSK_APP);
154 } 151 }
155 152
156 } // namespace ash 153 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc ('k') | ash/common/system/status_area_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698