| OLD | NEW |
| 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/chromeos/session/logout_button_tray.h" | 5 #include "ash/common/system/chromeos/session/logout_button_tray.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| 11 #include "ash/common/shelf/wm_shelf_util.h" | 11 #include "ash/common/shelf/wm_shelf_util.h" |
| 12 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h" | 12 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h" |
| 13 #include "ash/common/system/tray/system_tray_controller.h" | 13 #include "ash/common/system/tray/system_tray_controller.h" |
| 14 #include "ash/common/system/tray/system_tray_notifier.h" | 14 #include "ash/common/system/tray/system_tray_notifier.h" |
| 15 #include "ash/common/system/tray/tray_constants.h" | 15 #include "ash/common/system/tray/tray_constants.h" |
| 16 #include "ash/common/system/tray/tray_utils.h" | 16 #include "ash/common/system/tray/tray_utils.h" |
| 17 #include "ash/common/system/user/login_status.h" | 17 #include "ash/common/system/user/login_status.h" |
| 18 #include "ash/common/wm_shell.h" | 18 #include "ash/common/wm_shell.h" |
| 19 #include "ash/public/cpp/shelf_types.h" | 19 #include "ash/public/cpp/shelf_types.h" |
| 20 #include "ash/resources/vector_icons/vector_icons.h" |
| 20 #include "base/logging.h" | 21 #include "base/logging.h" |
| 21 #include "grit/ash_resources.h" | 22 #include "grit/ash_resources.h" |
| 22 #include "third_party/skia/include/core/SkColor.h" | 23 #include "third_party/skia/include/core/SkColor.h" |
| 23 #include "ui/events/event.h" | 24 #include "ui/events/event.h" |
| 24 #include "ui/gfx/color_palette.h" | 25 #include "ui/gfx/color_palette.h" |
| 25 #include "ui/gfx/geometry/insets.h" | 26 #include "ui/gfx/geometry/insets.h" |
| 26 #include "ui/gfx/geometry/size.h" | 27 #include "ui/gfx/geometry/size.h" |
| 27 #include "ui/gfx/paint_vector_icon.h" | 28 #include "ui/gfx/paint_vector_icon.h" |
| 28 #include "ui/gfx/vector_icons_public.h" | |
| 29 #include "ui/views/bubble/tray_bubble_view.h" | 29 #include "ui/views/bubble/tray_bubble_view.h" |
| 30 #include "ui/views/controls/button/label_button.h" | 30 #include "ui/views/controls/button/label_button.h" |
| 31 #include "ui/views/controls/button/label_button_border.h" | 31 #include "ui/views/controls/button/label_button_border.h" |
| 32 #include "ui/views/controls/button/md_text_button.h" | 32 #include "ui/views/controls/button/md_text_button.h" |
| 33 #include "ui/views/painter.h" | 33 #include "ui/views/painter.h" |
| 34 | 34 |
| 35 namespace ash { | 35 namespace ash { |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 const int kLogoutButtonHorizontalExtraPadding = 7; | 38 const int kLogoutButtonHorizontalExtraPadding = 7; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 const int button_size = MaterialDesignController::IsShelfMaterial() | 190 const int button_size = MaterialDesignController::IsShelfMaterial() |
| 191 ? kTrayItemSize | 191 ? kTrayItemSize |
| 192 : GetTrayConstant(TRAY_ITEM_HEIGHT_LEGACY); | 192 : GetTrayConstant(TRAY_ITEM_HEIGHT_LEGACY); |
| 193 if (IsHorizontalAlignment(alignment)) { | 193 if (IsHorizontalAlignment(alignment)) { |
| 194 button_->SetText(title); | 194 button_->SetText(title); |
| 195 button_->SetImage(views::LabelButton::STATE_NORMAL, gfx::ImageSkia()); | 195 button_->SetImage(views::LabelButton::STATE_NORMAL, gfx::ImageSkia()); |
| 196 button_->SetMinSize(gfx::Size(0, button_size)); | 196 button_->SetMinSize(gfx::Size(0, button_size)); |
| 197 } else { | 197 } else { |
| 198 button_->SetText(base::string16()); | 198 button_->SetText(base::string16()); |
| 199 button_->SetAccessibleName(title); | 199 button_->SetAccessibleName(title); |
| 200 button_->SetImage( | 200 button_->SetImage(views::LabelButton::STATE_NORMAL, |
| 201 views::LabelButton::STATE_NORMAL, | 201 gfx::CreateVectorIcon(kShelfLogoutIcon, kTrayIconColor)); |
| 202 gfx::CreateVectorIcon(gfx::VectorIconId::SHELF_LOGOUT, kTrayIconColor)); | |
| 203 button_->SetMinSize(gfx::Size(button_size, button_size)); | 202 button_->SetMinSize(gfx::Size(button_size, button_size)); |
| 204 } | 203 } |
| 205 UpdateVisibility(); | 204 UpdateVisibility(); |
| 206 } | 205 } |
| 207 | 206 |
| 208 } // namespace ash | 207 } // namespace ash |
| OLD | NEW |