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

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

Issue 1998933002: Update shelf spacing in Chrome OS according to the MD specs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments & Refactor border around item implementation Created 4 years, 6 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/system/overview/overview_button_tray.h" 5 #include "ash/system/overview/overview_button_tray.h"
6 6
7 #include "ash/material_design/material_design_controller.h"
7 #include "ash/session/session_state_delegate.h" 8 #include "ash/session/session_state_delegate.h"
9 #include "ash/shelf/shelf_constants.h"
8 #include "ash/shelf/shelf_types.h" 10 #include "ash/shelf/shelf_types.h"
9 #include "ash/shelf/shelf_util.h" 11 #include "ash/shelf/shelf_util.h"
10 #include "ash/shell.h" 12 #include "ash/shell.h"
11 #include "ash/system/tray/system_tray_delegate.h" 13 #include "ash/system/tray/system_tray_delegate.h"
14 #include "ash/system/tray/tray_constants.h"
12 #include "ash/system/tray/tray_utils.h" 15 #include "ash/system/tray/tray_utils.h"
13 #include "ash/wm/common/shelf/wm_shelf_util.h" 16 #include "ash/wm/common/shelf/wm_shelf_util.h"
14 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 17 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
15 #include "ash/wm/overview/window_selector_controller.h" 18 #include "ash/wm/overview/window_selector_controller.h"
16 #include "grit/ash_resources.h" 19 #include "grit/ash_resources.h"
17 #include "grit/ash_strings.h" 20 #include "grit/ash_strings.h"
18 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/views/border.h" 23 #include "ui/views/border.h"
21 #include "ui/views/controls/image_view.h" 24 #include "ui/views/controls/image_view.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 100 }
98 101
99 void OverviewButtonTray::SetShelfAlignment(wm::ShelfAlignment alignment) { 102 void OverviewButtonTray::SetShelfAlignment(wm::ShelfAlignment alignment) {
100 if (alignment == shelf_alignment()) 103 if (alignment == shelf_alignment())
101 return; 104 return;
102 105
103 TrayBackgroundView::SetShelfAlignment(alignment); 106 TrayBackgroundView::SetShelfAlignment(alignment);
104 SetIconBorderForShelfAlignment(); 107 SetIconBorderForShelfAlignment();
105 } 108 }
106 109
110 void OverviewButtonTray::GetHitRegionInsets(gfx::Insets& insets) {
111 if (ash::MaterialDesignController::IsShelfMaterial()) {
112 int top_edge, left_edge, bottom_edge, right_edge;
113 if (wm::IsHorizontalAlignment(shelf_alignment())) {
114 top_edge = (GetShelfLayoutConstant(SHELF_SIZE) - kShelfItemHeight) / 2;
115 left_edge = 0;
116 bottom_edge = (GetShelfLayoutConstant(SHELF_SIZE) - kShelfItemHeight) / 2;
117 right_edge = GetTrayConstant(PADDING_FROM_EDGE_OF_SHELF);
118 } else { // SHELF_ALIGNMENT_LEFT || SHELF_ALIGNMENT_RIGHT
119 top_edge = 0;
120 left_edge = (GetShelfLayoutConstant(SHELF_SIZE) - kShelfItemHeight) / 2;
121 bottom_edge = GetTrayConstant(PADDING_FROM_EDGE_OF_SHELF);
122 right_edge = (GetShelfLayoutConstant(SHELF_SIZE) - kShelfItemHeight) / 2;
123 }
124 insets.Set(top_edge, left_edge, bottom_edge, right_edge);
125 } else {
126 TrayBackgroundView::GetHitRegionInsets(insets);
127 }
128 }
129
130 // TODO(yiyix): Remove the 3dp border around the button.
tdanderson 2016/06/03 19:25:23 Move to TrayContainer, reword to be something like
yiyix 2016/06/10 19:26:04 Done.
107 void OverviewButtonTray::SetIconBorderForShelfAlignment() { 131 void OverviewButtonTray::SetIconBorderForShelfAlignment() {
108 if (wm::IsHorizontalAlignment(shelf_alignment())) { 132 if (wm::IsHorizontalAlignment(shelf_alignment())) {
109 icon_->SetBorder(views::Border::CreateEmptyBorder( 133 icon_->SetBorder(views::Border::CreateEmptyBorder(
110 kHorizontalShelfVerticalPadding, 134 kHorizontalShelfVerticalPadding,
111 kHorizontalShelfHorizontalPadding, 135 kHorizontalShelfHorizontalPadding,
112 kHorizontalShelfVerticalPadding, 136 kHorizontalShelfVerticalPadding,
113 kHorizontalShelfHorizontalPadding)); 137 kHorizontalShelfHorizontalPadding));
114 } else { 138 } else {
115 icon_->SetBorder(views::Border::CreateEmptyBorder( 139 icon_->SetBorder(views::Border::CreateEmptyBorder(
116 kVerticalShelfVerticalPadding, 140 kVerticalShelfVerticalPadding,
(...skipping 16 matching lines...) Expand all
133 shell->maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled() && 157 shell->maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled() &&
134 session_state_delegate->IsActiveUserSessionStarted() && 158 session_state_delegate->IsActiveUserSessionStarted() &&
135 !session_state_delegate->IsScreenLocked() && 159 !session_state_delegate->IsScreenLocked() &&
136 session_state_delegate->GetSessionState() == 160 session_state_delegate->GetSessionState() ==
137 SessionStateDelegate::SESSION_STATE_ACTIVE && 161 SessionStateDelegate::SESSION_STATE_ACTIVE &&
138 shell->system_tray_delegate()->GetUserLoginStatus() != 162 shell->system_tray_delegate()->GetUserLoginStatus() !=
139 user::LOGGED_IN_KIOSK_APP); 163 user::LOGGED_IN_KIOSK_APP);
140 } 164 }
141 165
142 } // namespace ash 166 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698