| 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_state_delegate.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" |
| 19 #include "ash/shell.h" |
| 19 #include "ash/strings/grit/ash_strings.h" | 20 #include "ash/strings/grit/ash_strings.h" |
| 20 #include "base/logging.h" | 21 #include "base/logging.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 22 #include "third_party/skia/include/core/SkColor.h" | 23 #include "third_party/skia/include/core/SkColor.h" |
| 23 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 24 #include "ui/gfx/image/image.h" | 25 #include "ui/gfx/image/image.h" |
| 25 #include "ui/views/controls/image_view.h" | 26 #include "ui/views/controls/image_view.h" |
| 26 #include "ui/views/controls/label.h" | 27 #include "ui/views/controls/label.h" |
| 27 #include "ui/views/layout/box_layout.h" | 28 #include "ui/views/layout/box_layout.h" |
| 28 #include "ui/views/layout/fill_layout.h" | 29 #include "ui/views/layout/fill_layout.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 ~SettingsDefaultView() override { PowerStatus::Get()->RemoveObserver(this); } | 83 ~SettingsDefaultView() override { PowerStatus::Get()->RemoveObserver(this); } |
| 83 | 84 |
| 84 // Overridden from ash::ActionableView. | 85 // Overridden from ash::ActionableView. |
| 85 bool PerformAction(const ui::Event& event) override { | 86 bool PerformAction(const ui::Event& event) override { |
| 86 if (login_status_ == LoginStatus::NOT_LOGGED_IN || | 87 if (login_status_ == LoginStatus::NOT_LOGGED_IN || |
| 87 login_status_ == LoginStatus::LOCKED || | 88 login_status_ == LoginStatus::LOCKED || |
| 88 WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen()) { | 89 WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen()) { |
| 89 return false; | 90 return false; |
| 90 } | 91 } |
| 91 | 92 |
| 92 WmShell::Get()->system_tray_controller()->ShowSettings(); | 93 Shell::Get()->system_tray_controller()->ShowSettings(); |
| 93 CloseSystemBubble(); | 94 CloseSystemBubble(); |
| 94 return true; | 95 return true; |
| 95 } | 96 } |
| 96 | 97 |
| 97 // Overridden from views::View. | 98 // Overridden from views::View. |
| 98 void Layout() override { | 99 void Layout() override { |
| 99 views::View::Layout(); | 100 views::View::Layout(); |
| 100 | 101 |
| 101 if (label_ && power_status_view_) { | 102 if (label_ && power_status_view_) { |
| 102 // Let the box-layout do the layout first. Then move power_status_view_ | 103 // Let the box-layout do the layout first. Then move power_status_view_ |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 TraySettings::~TraySettings() {} | 145 TraySettings::~TraySettings() {} |
| 145 | 146 |
| 146 views::View* TraySettings::CreateTrayView(LoginStatus status) { | 147 views::View* TraySettings::CreateTrayView(LoginStatus status) { |
| 147 return nullptr; | 148 return nullptr; |
| 148 } | 149 } |
| 149 | 150 |
| 150 views::View* TraySettings::CreateDefaultView(LoginStatus status) { | 151 views::View* TraySettings::CreateDefaultView(LoginStatus status) { |
| 151 if ((status == LoginStatus::NOT_LOGGED_IN || status == LoginStatus::LOCKED) && | 152 if ((status == LoginStatus::NOT_LOGGED_IN || status == LoginStatus::LOCKED) && |
| 152 !PowerStatus::Get()->IsBatteryPresent()) | 153 !PowerStatus::Get()->IsBatteryPresent()) |
| 153 return nullptr; | 154 return nullptr; |
| 154 if (!WmShell::Get()->system_tray_delegate()->ShouldShowSettings()) | 155 if (!Shell::Get()->system_tray_delegate()->ShouldShowSettings()) |
| 155 return nullptr; | 156 return nullptr; |
| 156 CHECK(default_view_ == nullptr); | 157 CHECK(default_view_ == nullptr); |
| 157 default_view_ = new tray::SettingsDefaultView(this, status); | 158 default_view_ = new tray::SettingsDefaultView(this, status); |
| 158 return default_view_; | 159 return default_view_; |
| 159 } | 160 } |
| 160 | 161 |
| 161 views::View* TraySettings::CreateDetailedView(LoginStatus status) { | 162 views::View* TraySettings::CreateDetailedView(LoginStatus status) { |
| 162 NOTIMPLEMENTED(); | 163 NOTIMPLEMENTED(); |
| 163 return nullptr; | 164 return nullptr; |
| 164 } | 165 } |
| 165 | 166 |
| 166 void TraySettings::DestroyTrayView() {} | 167 void TraySettings::DestroyTrayView() {} |
| 167 | 168 |
| 168 void TraySettings::DestroyDefaultView() { | 169 void TraySettings::DestroyDefaultView() { |
| 169 default_view_ = nullptr; | 170 default_view_ = nullptr; |
| 170 } | 171 } |
| 171 | 172 |
| 172 void TraySettings::DestroyDetailedView() {} | 173 void TraySettings::DestroyDetailedView() {} |
| 173 | 174 |
| 174 void TraySettings::UpdateAfterLoginStatusChange(LoginStatus status) {} | 175 void TraySettings::UpdateAfterLoginStatusChange(LoginStatus status) {} |
| 175 | 176 |
| 176 } // namespace ash | 177 } // namespace ash |
| OLD | NEW |