| 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/shelf/wm_shelf_util.h" | 10 #include "ash/common/shelf/wm_shelf_util.h" |
| 11 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h" | 11 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h" |
| 12 #include "ash/common/system/tray/system_tray_controller.h" | 12 #include "ash/common/system/tray/system_tray_controller.h" |
| 13 #include "ash/common/system/tray/system_tray_notifier.h" | 13 #include "ash/common/system/tray/system_tray_notifier.h" |
| 14 #include "ash/common/system/tray/tray_constants.h" | 14 #include "ash/common/system/tray/tray_constants.h" |
| 15 #include "ash/common/system/tray/tray_utils.h" | 15 #include "ash/common/system/tray/tray_utils.h" |
| 16 #include "ash/common/system/user/login_status.h" | 16 #include "ash/common/system/user/login_status.h" |
| 17 #include "ash/common/wm_shell.h" | |
| 18 #include "ash/public/cpp/shelf_types.h" | 17 #include "ash/public/cpp/shelf_types.h" |
| 19 #include "ash/resources/grit/ash_resources.h" | 18 #include "ash/resources/grit/ash_resources.h" |
| 20 #include "ash/resources/vector_icons/vector_icons.h" | 19 #include "ash/resources/vector_icons/vector_icons.h" |
| 21 #include "ash/shell.h" | 20 #include "ash/shell.h" |
| 22 #include "base/logging.h" | 21 #include "base/logging.h" |
| 23 #include "third_party/skia/include/core/SkColor.h" | 22 #include "third_party/skia/include/core/SkColor.h" |
| 24 #include "ui/events/event.h" | 23 #include "ui/events/event.h" |
| 25 #include "ui/gfx/color_palette.h" | 24 #include "ui/gfx/color_palette.h" |
| 26 #include "ui/gfx/geometry/insets.h" | 25 #include "ui/gfx/geometry/insets.h" |
| 27 #include "ui/gfx/geometry/size.h" | 26 #include "ui/gfx/geometry/size.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 46 // Base font size + 2 = 14. | 45 // Base font size + 2 = 14. |
| 47 // TODO(estade): should this 2 be shared with other tray views? See | 46 // TODO(estade): should this 2 be shared with other tray views? See |
| 48 // crbug.com/623987 | 47 // crbug.com/623987 |
| 49 button->AdjustFontSize(2); | 48 button->AdjustFontSize(2); |
| 50 button_ = button; | 49 button_ = button; |
| 51 | 50 |
| 52 // Since LogoutButtonTray has a red background and it is distinguished | 51 // Since LogoutButtonTray has a red background and it is distinguished |
| 53 // by itself, no separator is needed on its right side. | 52 // by itself, no separator is needed on its right side. |
| 54 set_separator_visibility(false); | 53 set_separator_visibility(false); |
| 55 tray_container()->AddChildView(button_); | 54 tray_container()->AddChildView(button_); |
| 56 WmShell::Get()->system_tray_notifier()->AddLogoutButtonObserver(this); | 55 Shell::Get()->system_tray_notifier()->AddLogoutButtonObserver(this); |
| 57 } | 56 } |
| 58 | 57 |
| 59 LogoutButtonTray::~LogoutButtonTray() { | 58 LogoutButtonTray::~LogoutButtonTray() { |
| 60 WmShell::Get()->system_tray_notifier()->RemoveLogoutButtonObserver(this); | 59 Shell::Get()->system_tray_notifier()->RemoveLogoutButtonObserver(this); |
| 61 } | 60 } |
| 62 | 61 |
| 63 void LogoutButtonTray::SetShelfAlignment(ShelfAlignment alignment) { | 62 void LogoutButtonTray::SetShelfAlignment(ShelfAlignment alignment) { |
| 64 // We must first update the button so that | 63 // We must first update the button so that |
| 65 // TrayBackgroundView::SetShelfAlignment() can lay it out correctly. | 64 // TrayBackgroundView::SetShelfAlignment() can lay it out correctly. |
| 66 UpdateButtonTextAndImage(login_status_, alignment); | 65 UpdateButtonTextAndImage(login_status_, alignment); |
| 67 TrayBackgroundView::SetShelfAlignment(alignment); | 66 TrayBackgroundView::SetShelfAlignment(alignment); |
| 68 } | 67 } |
| 69 | 68 |
| 70 base::string16 LogoutButtonTray::GetAccessibleNameForTray() { | 69 base::string16 LogoutButtonTray::GetAccessibleNameForTray() { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 button_->SetText(base::string16()); | 123 button_->SetText(base::string16()); |
| 125 button_->SetAccessibleName(title); | 124 button_->SetAccessibleName(title); |
| 126 button_->SetImage(views::LabelButton::STATE_NORMAL, | 125 button_->SetImage(views::LabelButton::STATE_NORMAL, |
| 127 gfx::CreateVectorIcon(kShelfLogoutIcon, kTrayIconColor)); | 126 gfx::CreateVectorIcon(kShelfLogoutIcon, kTrayIconColor)); |
| 128 button_->SetMinSize(gfx::Size(kTrayItemSize, kTrayItemSize)); | 127 button_->SetMinSize(gfx::Size(kTrayItemSize, kTrayItemSize)); |
| 129 } | 128 } |
| 130 UpdateVisibility(); | 129 UpdateVisibility(); |
| 131 } | 130 } |
| 132 | 131 |
| 133 } // namespace ash | 132 } // namespace ash |
| OLD | NEW |