OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_popup_utils.h" | 5 #include "ash/common/system/tray/tray_popup_utils.h" |
6 | 6 |
7 #include "ash/common/ash_constants.h" | 7 #include "ash/common/ash_constants.h" |
8 #include "ash/common/ash_view_ids.h" | 8 #include "ash/common/ash_view_ids.h" |
9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
10 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 views::ToggleButton* TrayPopupUtils::CreateToggleButton( | 263 views::ToggleButton* TrayPopupUtils::CreateToggleButton( |
264 views::ButtonListener* listener, | 264 views::ButtonListener* listener, |
265 int accessible_name_id) { | 265 int accessible_name_id) { |
266 views::ToggleButton* toggle = new views::ToggleButton(listener); | 266 views::ToggleButton* toggle = new views::ToggleButton(listener); |
267 const gfx::Size toggle_size(toggle->GetPreferredSize()); | 267 const gfx::Size toggle_size(toggle->GetPreferredSize()); |
268 const int vertical_padding = (kMenuButtonSize - toggle_size.height()) / 2; | 268 const int vertical_padding = (kMenuButtonSize - toggle_size.height()) / 2; |
269 const int horizontal_padding = | 269 const int horizontal_padding = |
270 (kTrayToggleButtonWidth - toggle_size.width()) / 2; | 270 (kTrayToggleButtonWidth - toggle_size.width()) / 2; |
271 toggle->SetBorder(views::CreateEmptyBorder( | 271 toggle->SetBorder(views::CreateEmptyBorder( |
272 gfx::Insets(vertical_padding, horizontal_padding))); | 272 gfx::Insets(vertical_padding, horizontal_padding))); |
273 // TODO(varkha): remove this and implement toggle-button specific focus. See | |
274 // crbug.com/669124 | |
275 toggle->SetFocusPainter(CreateFocusPainter()); | 273 toggle->SetFocusPainter(CreateFocusPainter()); |
276 toggle->SetAccessibleName(l10n_util::GetStringUTF16(accessible_name_id)); | 274 toggle->SetAccessibleName(l10n_util::GetStringUTF16(accessible_name_id)); |
277 return toggle; | 275 return toggle; |
278 } | 276 } |
279 | 277 |
280 std::unique_ptr<views::Painter> TrayPopupUtils::CreateFocusPainter() { | 278 std::unique_ptr<views::Painter> TrayPopupUtils::CreateFocusPainter() { |
281 return views::Painter::CreateSolidFocusPainter( | 279 return views::Painter::CreateSolidFocusPainter( |
282 kFocusBorderColor, kFocusBorderThickness, gfx::InsetsF()); | 280 kFocusBorderColor, kFocusBorderThickness, gfx::InsetsF()); |
283 } | 281 } |
284 | 282 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { | 469 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { |
472 // TODO(tdanderson): Consider moving this into WmShell, or introduce a | 470 // TODO(tdanderson): Consider moving this into WmShell, or introduce a |
473 // CanShowSettings() method in each delegate type that has a | 471 // CanShowSettings() method in each delegate type that has a |
474 // ShowSettings() method. | 472 // ShowSettings() method. |
475 return status != LoginStatus::NOT_LOGGED_IN && | 473 return status != LoginStatus::NOT_LOGGED_IN && |
476 status != LoginStatus::LOCKED && | 474 status != LoginStatus::LOCKED && |
477 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); | 475 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); |
478 } | 476 } |
479 | 477 |
480 } // namespace ash | 478 } // namespace ash |
OLD | NEW |