| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/settings/tray_settings.h" | 5 #include "ash/common/system/chromeos/settings/tray_settings.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/session/session_controller.h" | 8 #include "ash/common/session/session_controller.h" |
| 9 #include "ash/common/system/chromeos/power/power_status.h" | 9 #include "ash/common/system/chromeos/power/power_status.h" |
| 10 #include "ash/common/system/chromeos/power/power_status_view.h" | 10 #include "ash/common/system/chromeos/power/power_status_view.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 label_(nullptr), | 43 label_(nullptr), |
| 44 power_status_view_(nullptr) { | 44 power_status_view_(nullptr) { |
| 45 PowerStatus::Get()->AddObserver(this); | 45 PowerStatus::Get()->AddObserver(this); |
| 46 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, | 46 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, |
| 47 ash::kTrayPopupPaddingHorizontal, 0, | 47 ash::kTrayPopupPaddingHorizontal, 0, |
| 48 ash::kTrayPopupPaddingBetweenItems)); | 48 ash::kTrayPopupPaddingBetweenItems)); |
| 49 | 49 |
| 50 bool power_view_right_align = false; | 50 bool power_view_right_align = false; |
| 51 if (login_status_ != LoginStatus::NOT_LOGGED_IN && | 51 if (login_status_ != LoginStatus::NOT_LOGGED_IN && |
| 52 login_status_ != LoginStatus::LOCKED && | 52 login_status_ != LoginStatus::LOCKED && |
| 53 !WmShell::Get()->session_controller()->IsInSecondaryLoginScreen()) { | 53 !Shell::Get()->session_controller()->IsInSecondaryLoginScreen()) { |
| 54 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 54 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 55 views::ImageView* icon = TrayPopupUtils::CreateMainImageView(); | 55 views::ImageView* icon = TrayPopupUtils::CreateMainImageView(); |
| 56 | 56 |
| 57 icon->SetImage( | 57 icon->SetImage( |
| 58 rb.GetImageNamed(IDR_AURA_UBER_TRAY_SETTINGS).ToImageSkia()); | 58 rb.GetImageNamed(IDR_AURA_UBER_TRAY_SETTINGS).ToImageSkia()); |
| 59 icon->set_id(test::kSettingsTrayItemViewId); | 59 icon->set_id(test::kSettingsTrayItemViewId); |
| 60 AddChildView(icon); | 60 AddChildView(icon); |
| 61 | 61 |
| 62 base::string16 text = rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_SETTINGS); | 62 base::string16 text = rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_SETTINGS); |
| 63 label_ = TrayPopupUtils::CreateDefaultLabel(); | 63 label_ = TrayPopupUtils::CreateDefaultLabel(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 77 if (MaterialDesignController::IsSystemTrayMenuMaterial()) | 77 if (MaterialDesignController::IsSystemTrayMenuMaterial()) |
| 78 SetInkDropMode(InkDropHostView::InkDropMode::ON); | 78 SetInkDropMode(InkDropHostView::InkDropMode::ON); |
| 79 } | 79 } |
| 80 | 80 |
| 81 ~SettingsDefaultView() override { PowerStatus::Get()->RemoveObserver(this); } | 81 ~SettingsDefaultView() override { PowerStatus::Get()->RemoveObserver(this); } |
| 82 | 82 |
| 83 // Overridden from ash::ActionableView. | 83 // Overridden from ash::ActionableView. |
| 84 bool PerformAction(const ui::Event& event) override { | 84 bool PerformAction(const ui::Event& event) override { |
| 85 if (login_status_ == LoginStatus::NOT_LOGGED_IN || | 85 if (login_status_ == LoginStatus::NOT_LOGGED_IN || |
| 86 login_status_ == LoginStatus::LOCKED || | 86 login_status_ == LoginStatus::LOCKED || |
| 87 WmShell::Get()->session_controller()->IsInSecondaryLoginScreen()) { | 87 Shell::Get()->session_controller()->IsInSecondaryLoginScreen()) { |
| 88 return false; | 88 return false; |
| 89 } | 89 } |
| 90 | 90 |
| 91 Shell::Get()->system_tray_controller()->ShowSettings(); | 91 Shell::Get()->system_tray_controller()->ShowSettings(); |
| 92 CloseSystemBubble(); | 92 CloseSystemBubble(); |
| 93 return true; | 93 return true; |
| 94 } | 94 } |
| 95 | 95 |
| 96 // Overridden from views::View. | 96 // Overridden from views::View. |
| 97 void Layout() override { | 97 void Layout() override { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 void TraySettings::DestroyDefaultView() { | 167 void TraySettings::DestroyDefaultView() { |
| 168 default_view_ = nullptr; | 168 default_view_ = nullptr; |
| 169 } | 169 } |
| 170 | 170 |
| 171 void TraySettings::DestroyDetailedView() {} | 171 void TraySettings::DestroyDetailedView() {} |
| 172 | 172 |
| 173 void TraySettings::UpdateAfterLoginStatusChange(LoginStatus status) {} | 173 void TraySettings::UpdateAfterLoginStatusChange(LoginStatus status) {} |
| 174 | 174 |
| 175 } // namespace ash | 175 } // namespace ash |
| OLD | NEW |