| 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/system/chromeos/settings/tray_settings.h" | 5 #include "ash/system/chromeos/settings/tray_settings.h" |
| 6 | 6 |
| 7 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
| 8 #include "ash/common/system/tray/fixed_sized_image_view.h" | 8 #include "ash/common/system/tray/fixed_sized_image_view.h" |
| 9 #include "ash/common/system/tray/system_tray_delegate.h" | 9 #include "ash/common/system/tray/system_tray_delegate.h" |
| 10 #include "ash/common/system/tray/tray_constants.h" | 10 #include "ash/common/system/tray/tray_constants.h" |
| 11 #include "ash/common/wm_shell.h" |
| 11 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 12 #include "ash/system/chromeos/power/power_status.h" | 13 #include "ash/system/chromeos/power/power_status.h" |
| 13 #include "ash/system/chromeos/power/power_status_view.h" | 14 #include "ash/system/chromeos/power/power_status_view.h" |
| 14 #include "ash/system/tray/actionable_view.h" | 15 #include "ash/system/tray/actionable_view.h" |
| 15 #include "base/logging.h" | 16 #include "base/logging.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 17 #include "grit/ash_resources.h" | 18 #include "grit/ash_resources.h" |
| 18 #include "grit/ash_strings.h" | 19 #include "grit/ash_strings.h" |
| 19 #include "third_party/skia/include/core/SkColor.h" | 20 #include "third_party/skia/include/core/SkColor.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 power_status_view_ = new ash::PowerStatusView(power_view_right_align); | 66 power_status_view_ = new ash::PowerStatusView(power_view_right_align); |
| 66 AddChildView(power_status_view_); | 67 AddChildView(power_status_view_); |
| 67 OnPowerStatusChanged(); | 68 OnPowerStatusChanged(); |
| 68 } | 69 } |
| 69 } | 70 } |
| 70 | 71 |
| 71 ~SettingsDefaultView() override { PowerStatus::Get()->RemoveObserver(this); } | 72 ~SettingsDefaultView() override { PowerStatus::Get()->RemoveObserver(this); } |
| 72 | 73 |
| 73 // Overridden from ash::ActionableView. | 74 // Overridden from ash::ActionableView. |
| 74 bool PerformAction(const ui::Event& event) override { | 75 bool PerformAction(const ui::Event& event) override { |
| 75 bool userAddingRunning = ash::Shell::GetInstance() | 76 bool adding_user = Shell::GetInstance() |
| 76 ->session_state_delegate() | 77 ->session_state_delegate() |
| 77 ->IsInSecondaryLoginScreen(); | 78 ->IsInSecondaryLoginScreen(); |
| 78 | 79 |
| 79 if (login_status_ == LoginStatus::NOT_LOGGED_IN || | 80 if (login_status_ == LoginStatus::NOT_LOGGED_IN || |
| 80 login_status_ == LoginStatus::LOCKED || userAddingRunning) | 81 login_status_ == LoginStatus::LOCKED || adding_user) { |
| 81 return false; | 82 return false; |
| 83 } |
| 82 | 84 |
| 83 ash::Shell::GetInstance()->system_tray_delegate()->ShowSettings(); | 85 WmShell::Get()->system_tray_delegate()->ShowSettings(); |
| 84 return true; | 86 return true; |
| 85 } | 87 } |
| 86 | 88 |
| 87 // Overridden from views::View. | 89 // Overridden from views::View. |
| 88 void Layout() override { | 90 void Layout() override { |
| 89 views::View::Layout(); | 91 views::View::Layout(); |
| 90 | 92 |
| 91 if (label_ && power_status_view_) { | 93 if (label_ && power_status_view_) { |
| 92 // Let the box-layout do the layout first. Then move power_status_view_ | 94 // Let the box-layout do the layout first. Then move power_status_view_ |
| 93 // to right align if it is created. | 95 // to right align if it is created. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 } | 138 } |
| 137 | 139 |
| 138 views::View* TraySettings::CreateTrayView(LoginStatus status) { | 140 views::View* TraySettings::CreateTrayView(LoginStatus status) { |
| 139 return NULL; | 141 return NULL; |
| 140 } | 142 } |
| 141 | 143 |
| 142 views::View* TraySettings::CreateDefaultView(LoginStatus status) { | 144 views::View* TraySettings::CreateDefaultView(LoginStatus status) { |
| 143 if ((status == LoginStatus::NOT_LOGGED_IN || status == LoginStatus::LOCKED) && | 145 if ((status == LoginStatus::NOT_LOGGED_IN || status == LoginStatus::LOCKED) && |
| 144 !PowerStatus::Get()->IsBatteryPresent()) | 146 !PowerStatus::Get()->IsBatteryPresent()) |
| 145 return NULL; | 147 return NULL; |
| 146 if (!ash::Shell::GetInstance()->system_tray_delegate()->ShouldShowSettings()) | 148 if (!WmShell::Get()->system_tray_delegate()->ShouldShowSettings()) |
| 147 return NULL; | 149 return NULL; |
| 148 CHECK(default_view_ == NULL); | 150 CHECK(default_view_ == NULL); |
| 149 default_view_ = new tray::SettingsDefaultView(status); | 151 default_view_ = new tray::SettingsDefaultView(status); |
| 150 return default_view_; | 152 return default_view_; |
| 151 } | 153 } |
| 152 | 154 |
| 153 views::View* TraySettings::CreateDetailedView(LoginStatus status) { | 155 views::View* TraySettings::CreateDetailedView(LoginStatus status) { |
| 154 NOTIMPLEMENTED(); | 156 NOTIMPLEMENTED(); |
| 155 return NULL; | 157 return NULL; |
| 156 } | 158 } |
| 157 | 159 |
| 158 void TraySettings::DestroyTrayView() { | 160 void TraySettings::DestroyTrayView() { |
| 159 } | 161 } |
| 160 | 162 |
| 161 void TraySettings::DestroyDefaultView() { | 163 void TraySettings::DestroyDefaultView() { |
| 162 default_view_ = NULL; | 164 default_view_ = NULL; |
| 163 } | 165 } |
| 164 | 166 |
| 165 void TraySettings::DestroyDetailedView() { | 167 void TraySettings::DestroyDetailedView() { |
| 166 } | 168 } |
| 167 | 169 |
| 168 void TraySettings::UpdateAfterLoginStatusChange(LoginStatus status) {} | 170 void TraySettings::UpdateAfterLoginStatusChange(LoginStatus status) {} |
| 169 | 171 |
| 170 } // namespace ash | 172 } // namespace ash |
| OLD | NEW |