| 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" |
| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 ~SettingsDefaultView() override { PowerStatus::Get()->RemoveObserver(this); } | 81 ~SettingsDefaultView() override { PowerStatus::Get()->RemoveObserver(this); } |
| 81 | 82 |
| 82 // Overridden from ash::ActionableView. | 83 // Overridden from ash::ActionableView. |
| 83 bool PerformAction(const ui::Event& event) override { | 84 bool PerformAction(const ui::Event& event) override { |
| 84 if (login_status_ == LoginStatus::NOT_LOGGED_IN || | 85 if (login_status_ == LoginStatus::NOT_LOGGED_IN || |
| 85 login_status_ == LoginStatus::LOCKED || | 86 login_status_ == LoginStatus::LOCKED || |
| 86 WmShell::Get()->session_controller()->IsInSecondaryLoginScreen()) { | 87 WmShell::Get()->session_controller()->IsInSecondaryLoginScreen()) { |
| 87 return false; | 88 return false; |
| 88 } | 89 } |
| 89 | 90 |
| 90 WmShell::Get()->system_tray_controller()->ShowSettings(); | 91 Shell::Get()->system_tray_controller()->ShowSettings(); |
| 91 CloseSystemBubble(); | 92 CloseSystemBubble(); |
| 92 return true; | 93 return true; |
| 93 } | 94 } |
| 94 | 95 |
| 95 // Overridden from views::View. | 96 // Overridden from views::View. |
| 96 void Layout() override { | 97 void Layout() override { |
| 97 views::View::Layout(); | 98 views::View::Layout(); |
| 98 | 99 |
| 99 if (label_ && power_status_view_) { | 100 if (label_ && power_status_view_) { |
| 100 // Let the box-layout do the layout first. Then move power_status_view_ | 101 // 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... |
| 142 TraySettings::~TraySettings() {} | 143 TraySettings::~TraySettings() {} |
| 143 | 144 |
| 144 views::View* TraySettings::CreateTrayView(LoginStatus status) { | 145 views::View* TraySettings::CreateTrayView(LoginStatus status) { |
| 145 return nullptr; | 146 return nullptr; |
| 146 } | 147 } |
| 147 | 148 |
| 148 views::View* TraySettings::CreateDefaultView(LoginStatus status) { | 149 views::View* TraySettings::CreateDefaultView(LoginStatus status) { |
| 149 if ((status == LoginStatus::NOT_LOGGED_IN || status == LoginStatus::LOCKED) && | 150 if ((status == LoginStatus::NOT_LOGGED_IN || status == LoginStatus::LOCKED) && |
| 150 !PowerStatus::Get()->IsBatteryPresent()) | 151 !PowerStatus::Get()->IsBatteryPresent()) |
| 151 return nullptr; | 152 return nullptr; |
| 152 if (!WmShell::Get()->system_tray_delegate()->ShouldShowSettings()) | 153 if (!Shell::Get()->system_tray_delegate()->ShouldShowSettings()) |
| 153 return nullptr; | 154 return nullptr; |
| 154 CHECK(default_view_ == nullptr); | 155 CHECK(default_view_ == nullptr); |
| 155 default_view_ = new tray::SettingsDefaultView(this, status); | 156 default_view_ = new tray::SettingsDefaultView(this, status); |
| 156 return default_view_; | 157 return default_view_; |
| 157 } | 158 } |
| 158 | 159 |
| 159 views::View* TraySettings::CreateDetailedView(LoginStatus status) { | 160 views::View* TraySettings::CreateDetailedView(LoginStatus status) { |
| 160 NOTIMPLEMENTED(); | 161 NOTIMPLEMENTED(); |
| 161 return nullptr; | 162 return nullptr; |
| 162 } | 163 } |
| 163 | 164 |
| 164 void TraySettings::DestroyTrayView() {} | 165 void TraySettings::DestroyTrayView() {} |
| 165 | 166 |
| 166 void TraySettings::DestroyDefaultView() { | 167 void TraySettings::DestroyDefaultView() { |
| 167 default_view_ = nullptr; | 168 default_view_ = nullptr; |
| 168 } | 169 } |
| 169 | 170 |
| 170 void TraySettings::DestroyDetailedView() {} | 171 void TraySettings::DestroyDetailedView() {} |
| 171 | 172 |
| 172 void TraySettings::UpdateAfterLoginStatusChange(LoginStatus status) {} | 173 void TraySettings::UpdateAfterLoginStatusChange(LoginStatus status) {} |
| 173 | 174 |
| 174 } // namespace ash | 175 } // namespace ash |
| OLD | NEW |