Chromium Code Reviews| 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 user_adding_running = Shell::GetInstance() |
|
msw
2016/06/10 18:48:21
nit: |adding_user| or |in_secondary_login| or inli
James Cook
2016/06/10 20:20:32
I went with adding_user, since that's what's actua
| |
| 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 || user_adding_running) |
|
msw
2016/06/10 18:48:21
nit: curlies
James Cook
2016/06/10 20:20:31
Done.
| |
| 81 return false; | 82 return false; |
| 82 | 83 |
| 83 ash::Shell::GetInstance()->system_tray_delegate()->ShowSettings(); | 84 WmShell::Get()->system_tray_delegate()->ShowSettings(); |
| 84 return true; | 85 return true; |
| 85 } | 86 } |
| 86 | 87 |
| 87 // Overridden from views::View. | 88 // Overridden from views::View. |
| 88 void Layout() override { | 89 void Layout() override { |
| 89 views::View::Layout(); | 90 views::View::Layout(); |
| 90 | 91 |
| 91 if (label_ && power_status_view_) { | 92 if (label_ && power_status_view_) { |
| 92 // Let the box-layout do the layout first. Then move power_status_view_ | 93 // Let the box-layout do the layout first. Then move power_status_view_ |
| 93 // to right align if it is created. | 94 // to right align if it is created. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 } | 137 } |
| 137 | 138 |
| 138 views::View* TraySettings::CreateTrayView(LoginStatus status) { | 139 views::View* TraySettings::CreateTrayView(LoginStatus status) { |
| 139 return NULL; | 140 return NULL; |
| 140 } | 141 } |
| 141 | 142 |
| 142 views::View* TraySettings::CreateDefaultView(LoginStatus status) { | 143 views::View* TraySettings::CreateDefaultView(LoginStatus status) { |
| 143 if ((status == LoginStatus::NOT_LOGGED_IN || status == LoginStatus::LOCKED) && | 144 if ((status == LoginStatus::NOT_LOGGED_IN || status == LoginStatus::LOCKED) && |
| 144 !PowerStatus::Get()->IsBatteryPresent()) | 145 !PowerStatus::Get()->IsBatteryPresent()) |
| 145 return NULL; | 146 return NULL; |
| 146 if (!ash::Shell::GetInstance()->system_tray_delegate()->ShouldShowSettings()) | 147 if (!WmShell::Get()->system_tray_delegate()->ShouldShowSettings()) |
| 147 return NULL; | 148 return NULL; |
| 148 CHECK(default_view_ == NULL); | 149 CHECK(default_view_ == NULL); |
| 149 default_view_ = new tray::SettingsDefaultView(status); | 150 default_view_ = new tray::SettingsDefaultView(status); |
| 150 return default_view_; | 151 return default_view_; |
| 151 } | 152 } |
| 152 | 153 |
| 153 views::View* TraySettings::CreateDetailedView(LoginStatus status) { | 154 views::View* TraySettings::CreateDetailedView(LoginStatus status) { |
| 154 NOTIMPLEMENTED(); | 155 NOTIMPLEMENTED(); |
| 155 return NULL; | 156 return NULL; |
| 156 } | 157 } |
| 157 | 158 |
| 158 void TraySettings::DestroyTrayView() { | 159 void TraySettings::DestroyTrayView() { |
| 159 } | 160 } |
| 160 | 161 |
| 161 void TraySettings::DestroyDefaultView() { | 162 void TraySettings::DestroyDefaultView() { |
| 162 default_view_ = NULL; | 163 default_view_ = NULL; |
| 163 } | 164 } |
| 164 | 165 |
| 165 void TraySettings::DestroyDetailedView() { | 166 void TraySettings::DestroyDetailedView() { |
| 166 } | 167 } |
| 167 | 168 |
| 168 void TraySettings::UpdateAfterLoginStatusChange(LoginStatus status) {} | 169 void TraySettings::UpdateAfterLoginStatusChange(LoginStatus status) {} |
| 169 | 170 |
| 170 } // namespace ash | 171 } // namespace ash |
| OLD | NEW |