Chromium Code Reviews| 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 |
|
tdanderson
2017/02/16 22:03:50
nit: please also include BUG=686215 in the CL desc
Evan Stade
2017/02/16 22:48:01
Done.
| |
| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/common/ash_constants.h" | 10 #include "ash/common/ash_constants.h" |
| 11 #include "ash/common/ash_view_ids.h" | 11 #include "ash/common/ash_view_ids.h" |
| 12 #include "ash/common/material_design/material_design_controller.h" | |
| 13 #include "ash/common/session/session_state_delegate.h" | 12 #include "ash/common/session/session_state_delegate.h" |
| 14 #include "ash/common/system/tray/fixed_sized_image_view.h" | 13 #include "ash/common/system/tray/fixed_sized_image_view.h" |
| 15 #include "ash/common/system/tray/size_range_layout.h" | 14 #include "ash/common/system/tray/size_range_layout.h" |
| 16 #include "ash/common/system/tray/tray_constants.h" | 15 #include "ash/common/system/tray/tray_constants.h" |
| 17 #include "ash/common/system/tray/tray_popup_item_style.h" | 16 #include "ash/common/system/tray/tray_popup_item_style.h" |
| 18 #include "ash/common/wm_shell.h" | 17 #include "ash/common/wm_shell.h" |
| 19 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 20 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| 22 #include "ui/views/animation/ink_drop_highlight.h" | 21 #include "ui/views/animation/ink_drop_highlight.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 | 225 |
| 227 views::ImageView* TrayPopupUtils::CreateMoreImageView() { | 226 views::ImageView* TrayPopupUtils::CreateMoreImageView() { |
| 228 views::ImageView* image = | 227 views::ImageView* image = |
| 229 new FixedSizedImageView(GetTrayConstant(TRAY_POPUP_ITEM_MORE_IMAGE_SIZE), | 228 new FixedSizedImageView(GetTrayConstant(TRAY_POPUP_ITEM_MORE_IMAGE_SIZE), |
| 230 GetTrayConstant(TRAY_POPUP_ITEM_MORE_IMAGE_SIZE)); | 229 GetTrayConstant(TRAY_POPUP_ITEM_MORE_IMAGE_SIZE)); |
| 231 image->EnableCanvasFlippingForRTLUI(true); | 230 image->EnableCanvasFlippingForRTLUI(true); |
| 232 return image; | 231 return image; |
| 233 } | 232 } |
| 234 | 233 |
| 235 views::Slider* TrayPopupUtils::CreateSlider(views::SliderListener* listener) { | 234 views::Slider* TrayPopupUtils::CreateSlider(views::SliderListener* listener) { |
| 236 const bool is_material = MaterialDesignController::IsSystemTrayMenuMaterial(); | 235 views::Slider* slider = new views::Slider(listener); |
| 237 views::Slider* slider = views::Slider::CreateSlider(is_material, listener); | 236 slider->SetBorder( |
| 238 if (is_material) { | 237 views::CreateEmptyBorder(gfx::Insets(0, kTrayPopupSliderPaddingMD))); |
|
msw
2017/02/16 21:08:20
nit: drop 'MD' from constant (and move to this fun
tdanderson
2017/02/16 22:03:50
+1
Evan Stade
2017/02/16 22:48:01
Done.
| |
| 239 slider->SetBorder( | |
| 240 views::CreateEmptyBorder(gfx::Insets(0, kTrayPopupSliderPaddingMD))); | |
| 241 } else { | |
| 242 slider->SetBorder( | |
| 243 views::CreateEmptyBorder(0, 0, 0, kTrayPopupPaddingBetweenItems)); | |
| 244 } | |
| 245 return slider; | 238 return slider; |
| 246 } | 239 } |
| 247 | 240 |
| 248 views::ToggleButton* TrayPopupUtils::CreateToggleButton( | 241 views::ToggleButton* TrayPopupUtils::CreateToggleButton( |
| 249 views::ButtonListener* listener, | 242 views::ButtonListener* listener, |
| 250 int accessible_name_id) { | 243 int accessible_name_id) { |
| 251 views::ToggleButton* toggle = new views::ToggleButton(listener); | 244 views::ToggleButton* toggle = new views::ToggleButton(listener); |
| 252 const gfx::Size toggle_size(toggle->GetPreferredSize()); | 245 const gfx::Size toggle_size(toggle->GetPreferredSize()); |
| 253 const int vertical_padding = (kMenuButtonSize - toggle_size.height()) / 2; | 246 const int vertical_padding = (kMenuButtonSize - toggle_size.height()) / 2; |
| 254 const int horizontal_padding = | 247 const int horizontal_padding = |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 443 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { | 436 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { |
| 444 // TODO(tdanderson): Consider moving this into WmShell, or introduce a | 437 // TODO(tdanderson): Consider moving this into WmShell, or introduce a |
| 445 // CanShowSettings() method in each delegate type that has a | 438 // CanShowSettings() method in each delegate type that has a |
| 446 // ShowSettings() method. | 439 // ShowSettings() method. |
| 447 return status != LoginStatus::NOT_LOGGED_IN && | 440 return status != LoginStatus::NOT_LOGGED_IN && |
| 448 status != LoginStatus::LOCKED && | 441 status != LoginStatus::LOCKED && |
| 449 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); | 442 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); |
| 450 } | 443 } |
| 451 | 444 |
| 452 } // namespace ash | 445 } // namespace ash |
| OLD | NEW |