| 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/system/session/logout_button_tray.h" | 5 #include "ash/system/session/logout_button_tray.h" |
| 6 | 6 |
| 7 #include "ash/public/cpp/ash_typography.h" |
| 7 #include "ash/resources/vector_icons/vector_icons.h" | 8 #include "ash/resources/vector_icons/vector_icons.h" |
| 8 #include "ash/shelf/wm_shelf.h" | 9 #include "ash/shelf/wm_shelf.h" |
| 9 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 10 #include "ash/system/session/logout_confirmation_controller.h" | 11 #include "ash/system/session/logout_confirmation_controller.h" |
| 11 #include "ash/system/status_area_widget.h" | 12 #include "ash/system/status_area_widget.h" |
| 12 #include "ash/system/tray/system_tray_controller.h" | 13 #include "ash/system/tray/system_tray_controller.h" |
| 13 #include "ash/system/tray/system_tray_notifier.h" | 14 #include "ash/system/tray/system_tray_notifier.h" |
| 14 #include "ash/system/tray/tray_constants.h" | 15 #include "ash/system/tray/tray_constants.h" |
| 15 #include "ash/system/tray/tray_container.h" | 16 #include "ash/system/tray/tray_container.h" |
| 16 #include "ash/system/user/login_status.h" | 17 #include "ash/system/user/login_status.h" |
| 17 #include "ui/accessibility/ax_node_data.h" | 18 #include "ui/accessibility/ax_node_data.h" |
| 18 #include "ui/gfx/color_palette.h" | 19 #include "ui/gfx/color_palette.h" |
| 19 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
| 20 #include "ui/gfx/paint_vector_icon.h" | 21 #include "ui/gfx/paint_vector_icon.h" |
| 21 #include "ui/views/controls/button/md_text_button.h" | 22 #include "ui/views/controls/button/md_text_button.h" |
| 22 #include "ui/views/layout/fill_layout.h" | 23 #include "ui/views/layout/fill_layout.h" |
| 23 | 24 |
| 24 namespace ash { | 25 namespace ash { |
| 25 | 26 |
| 26 LogoutButtonTray::LogoutButtonTray(WmShelf* wm_shelf) | 27 LogoutButtonTray::LogoutButtonTray(WmShelf* wm_shelf) |
| 27 : wm_shelf_(wm_shelf), | 28 : wm_shelf_(wm_shelf), |
| 28 container_(new TrayContainer(wm_shelf)), | 29 container_(new TrayContainer(wm_shelf)), |
| 29 button_(views::MdTextButton::Create(this, base::string16())), | 30 button_(views::MdTextButton::Create(this, |
| 31 base::string16(), |
| 32 CONTEXT_LAUNCHER_BUTTON)), |
| 30 show_logout_button_in_tray_(false) { | 33 show_logout_button_in_tray_(false) { |
| 31 SetLayoutManager(new views::FillLayout); | 34 SetLayoutManager(new views::FillLayout); |
| 32 AddChildView(container_); | 35 AddChildView(container_); |
| 33 | 36 |
| 34 button_->SetProminent(true); | 37 button_->SetProminent(true); |
| 35 button_->SetBgColorOverride(gfx::kGoogleRed700); | 38 button_->SetBgColorOverride(gfx::kGoogleRed700); |
| 36 button_->AdjustFontSize(kTrayTextFontSizeIncrease); | |
| 37 | 39 |
| 38 container_->AddChildView(button_); | 40 container_->AddChildView(button_); |
| 39 Shell::Get()->system_tray_notifier()->AddLogoutButtonObserver(this); | 41 Shell::Get()->system_tray_notifier()->AddLogoutButtonObserver(this); |
| 40 SetVisible(false); | 42 SetVisible(false); |
| 41 } | 43 } |
| 42 | 44 |
| 43 LogoutButtonTray::~LogoutButtonTray() { | 45 LogoutButtonTray::~LogoutButtonTray() { |
| 44 Shell::Get()->system_tray_notifier()->RemoveLogoutButtonObserver(this); | 46 Shell::Get()->system_tray_notifier()->RemoveLogoutButtonObserver(this); |
| 45 } | 47 } |
| 46 | 48 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 button_->SetText(base::string16()); | 103 button_->SetText(base::string16()); |
| 102 button_->SetAccessibleName(title); | 104 button_->SetAccessibleName(title); |
| 103 button_->SetImage(views::Button::STATE_NORMAL, | 105 button_->SetImage(views::Button::STATE_NORMAL, |
| 104 gfx::CreateVectorIcon(kShelfLogoutIcon, kTrayIconColor)); | 106 gfx::CreateVectorIcon(kShelfLogoutIcon, kTrayIconColor)); |
| 105 button_->SetMinSize(gfx::Size(kTrayItemSize, kTrayItemSize)); | 107 button_->SetMinSize(gfx::Size(kTrayItemSize, kTrayItemSize)); |
| 106 } | 108 } |
| 107 UpdateVisibility(); | 109 UpdateVisibility(); |
| 108 } | 110 } |
| 109 | 111 |
| 110 } // namespace ash | 112 } // namespace ash |
| OLD | NEW |