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 <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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 222 |
224 views::ImageView* TrayPopupUtils::CreateMoreImageView() { | 223 views::ImageView* TrayPopupUtils::CreateMoreImageView() { |
225 views::ImageView* image = | 224 views::ImageView* image = |
226 new FixedSizedImageView(GetTrayConstant(TRAY_POPUP_ITEM_MORE_IMAGE_SIZE), | 225 new FixedSizedImageView(GetTrayConstant(TRAY_POPUP_ITEM_MORE_IMAGE_SIZE), |
227 GetTrayConstant(TRAY_POPUP_ITEM_MORE_IMAGE_SIZE)); | 226 GetTrayConstant(TRAY_POPUP_ITEM_MORE_IMAGE_SIZE)); |
228 image->EnableCanvasFlippingForRTLUI(true); | 227 image->EnableCanvasFlippingForRTLUI(true); |
229 return image; | 228 return image; |
230 } | 229 } |
231 | 230 |
232 views::Slider* TrayPopupUtils::CreateSlider(views::SliderListener* listener) { | 231 views::Slider* TrayPopupUtils::CreateSlider(views::SliderListener* listener) { |
233 const bool is_material = MaterialDesignController::IsSystemTrayMenuMaterial(); | 232 views::Slider* slider = new views::Slider(listener); |
234 views::Slider* slider = views::Slider::CreateSlider(is_material, listener); | 233 slider->SetBorder(views::CreateEmptyBorder(gfx::Insets(0, 16))); |
235 if (is_material) { | |
236 slider->SetBorder( | |
237 views::CreateEmptyBorder(gfx::Insets(0, kTrayPopupSliderPaddingMD))); | |
238 } else { | |
239 slider->SetBorder( | |
240 views::CreateEmptyBorder(0, 0, 0, kTrayPopupPaddingBetweenItems)); | |
241 } | |
242 return slider; | 234 return slider; |
243 } | 235 } |
244 | 236 |
245 views::ToggleButton* TrayPopupUtils::CreateToggleButton( | 237 views::ToggleButton* TrayPopupUtils::CreateToggleButton( |
246 views::ButtonListener* listener, | 238 views::ButtonListener* listener, |
247 int accessible_name_id) { | 239 int accessible_name_id) { |
248 views::ToggleButton* toggle = new views::ToggleButton(listener); | 240 views::ToggleButton* toggle = new views::ToggleButton(listener); |
249 const gfx::Size toggle_size(toggle->GetPreferredSize()); | 241 const gfx::Size toggle_size(toggle->GetPreferredSize()); |
250 const int vertical_padding = (kMenuButtonSize - toggle_size.height()) / 2; | 242 const int vertical_padding = (kMenuButtonSize - toggle_size.height()) / 2; |
251 const int horizontal_padding = | 243 const int horizontal_padding = |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { | 427 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { |
436 // TODO(tdanderson): Consider moving this into WmShell, or introduce a | 428 // TODO(tdanderson): Consider moving this into WmShell, or introduce a |
437 // CanShowSettings() method in each delegate type that has a | 429 // CanShowSettings() method in each delegate type that has a |
438 // ShowSettings() method. | 430 // ShowSettings() method. |
439 return status != LoginStatus::NOT_LOGGED_IN && | 431 return status != LoginStatus::NOT_LOGGED_IN && |
440 status != LoginStatus::LOCKED && | 432 status != LoginStatus::LOCKED && |
441 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); | 433 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); |
442 } | 434 } |
443 | 435 |
444 } // namespace ash | 436 } // namespace ash |
OLD | NEW |