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_state_delegate.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" |
11 #include "ash/common/system/tray/actionable_view.h" | 11 #include "ash/common/system/tray/actionable_view.h" |
12 #include "ash/common/system/tray/fixed_sized_image_view.h" | 12 #include "ash/common/system/tray/fixed_sized_image_view.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_delegate.h" | 14 #include "ash/common/system/tray/system_tray_delegate.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_popup_utils.h" | 16 #include "ash/common/system/tray/tray_popup_utils.h" |
17 #include "ash/common/wm_shell.h" | 17 #include "ash/common/wm_shell.h" |
18 #include "ash/resources/grit/ash_resources.h" | 18 #include "ash/resources/grit/ash_resources.h" |
(...skipping 23 matching lines...) Expand all Loading... |
42 label_(nullptr), | 42 label_(nullptr), |
43 power_status_view_(nullptr) { | 43 power_status_view_(nullptr) { |
44 PowerStatus::Get()->AddObserver(this); | 44 PowerStatus::Get()->AddObserver(this); |
45 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, | 45 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, |
46 ash::kTrayPopupPaddingHorizontal, 0, | 46 ash::kTrayPopupPaddingHorizontal, 0, |
47 ash::kTrayPopupPaddingBetweenItems)); | 47 ash::kTrayPopupPaddingBetweenItems)); |
48 | 48 |
49 bool power_view_right_align = false; | 49 bool power_view_right_align = false; |
50 if (login_status_ != LoginStatus::NOT_LOGGED_IN && | 50 if (login_status_ != LoginStatus::NOT_LOGGED_IN && |
51 login_status_ != LoginStatus::LOCKED && | 51 login_status_ != LoginStatus::LOCKED && |
52 !WmShell::Get() | 52 !WmShell::Get()->session_controller()->IsInSecondaryLoginScreen()) { |
53 ->GetSessionStateDelegate() | |
54 ->IsInSecondaryLoginScreen()) { | |
55 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 53 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
56 views::ImageView* icon = TrayPopupUtils::CreateMainImageView(); | 54 views::ImageView* icon = TrayPopupUtils::CreateMainImageView(); |
57 | 55 |
58 icon->SetImage( | 56 icon->SetImage( |
59 rb.GetImageNamed(IDR_AURA_UBER_TRAY_SETTINGS).ToImageSkia()); | 57 rb.GetImageNamed(IDR_AURA_UBER_TRAY_SETTINGS).ToImageSkia()); |
60 icon->set_id(test::kSettingsTrayItemViewId); | 58 icon->set_id(test::kSettingsTrayItemViewId); |
61 AddChildView(icon); | 59 AddChildView(icon); |
62 | 60 |
63 base::string16 text = rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_SETTINGS); | 61 base::string16 text = rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_SETTINGS); |
64 label_ = TrayPopupUtils::CreateDefaultLabel(); | 62 label_ = TrayPopupUtils::CreateDefaultLabel(); |
(...skipping 13 matching lines...) Expand all Loading... |
78 if (MaterialDesignController::IsSystemTrayMenuMaterial()) | 76 if (MaterialDesignController::IsSystemTrayMenuMaterial()) |
79 SetInkDropMode(InkDropHostView::InkDropMode::ON); | 77 SetInkDropMode(InkDropHostView::InkDropMode::ON); |
80 } | 78 } |
81 | 79 |
82 ~SettingsDefaultView() override { PowerStatus::Get()->RemoveObserver(this); } | 80 ~SettingsDefaultView() override { PowerStatus::Get()->RemoveObserver(this); } |
83 | 81 |
84 // Overridden from ash::ActionableView. | 82 // Overridden from ash::ActionableView. |
85 bool PerformAction(const ui::Event& event) override { | 83 bool PerformAction(const ui::Event& event) override { |
86 if (login_status_ == LoginStatus::NOT_LOGGED_IN || | 84 if (login_status_ == LoginStatus::NOT_LOGGED_IN || |
87 login_status_ == LoginStatus::LOCKED || | 85 login_status_ == LoginStatus::LOCKED || |
88 WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen()) { | 86 WmShell::Get()->session_controller()->IsInSecondaryLoginScreen()) { |
89 return false; | 87 return false; |
90 } | 88 } |
91 | 89 |
92 WmShell::Get()->system_tray_controller()->ShowSettings(); | 90 WmShell::Get()->system_tray_controller()->ShowSettings(); |
93 CloseSystemBubble(); | 91 CloseSystemBubble(); |
94 return true; | 92 return true; |
95 } | 93 } |
96 | 94 |
97 // Overridden from views::View. | 95 // Overridden from views::View. |
98 void Layout() override { | 96 void Layout() override { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 165 |
168 void TraySettings::DestroyDefaultView() { | 166 void TraySettings::DestroyDefaultView() { |
169 default_view_ = nullptr; | 167 default_view_ = nullptr; |
170 } | 168 } |
171 | 169 |
172 void TraySettings::DestroyDetailedView() {} | 170 void TraySettings::DestroyDetailedView() {} |
173 | 171 |
174 void TraySettings::UpdateAfterLoginStatusChange(LoginStatus status) {} | 172 void TraySettings::UpdateAfterLoginStatusChange(LoginStatus status) {} |
175 | 173 |
176 } // namespace ash | 174 } // namespace ash |
OLD | NEW |