| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/chromeos/settings/shutdown_policy_forwarder.h" | 5 #include "chrome/browser/chromeos/settings/shutdown_policy_forwarder.h" |
| 6 | 6 |
| 7 #include "ash/public/interfaces/constants.mojom.h" |
| 7 #include "ash/public/interfaces/shutdown.mojom.h" | 8 #include "ash/public/interfaces/shutdown.mojom.h" |
| 8 #include "chrome/browser/chromeos/settings/cros_settings.h" | 9 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 9 #include "chrome/browser/ui/ash/ash_util.h" | |
| 10 #include "content/public/common/service_manager_connection.h" | 10 #include "content/public/common/service_manager_connection.h" |
| 11 #include "services/service_manager/public/cpp/connector.h" | 11 #include "services/service_manager/public/cpp/connector.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 | 14 |
| 15 ShutdownPolicyForwarder::ShutdownPolicyForwarder() | 15 ShutdownPolicyForwarder::ShutdownPolicyForwarder() |
| 16 : shutdown_policy_handler_(CrosSettings::Get(), this) { | 16 : shutdown_policy_handler_(CrosSettings::Get(), this) { |
| 17 // Request the initial setting. | 17 // Request the initial setting. |
| 18 shutdown_policy_handler_.NotifyDelegateWithShutdownPolicy(); | 18 shutdown_policy_handler_.NotifyDelegateWithShutdownPolicy(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 ShutdownPolicyForwarder::~ShutdownPolicyForwarder() {} | 21 ShutdownPolicyForwarder::~ShutdownPolicyForwarder() {} |
| 22 | 22 |
| 23 void ShutdownPolicyForwarder::OnShutdownPolicyChanged(bool reboot_on_shutdown) { | 23 void ShutdownPolicyForwarder::OnShutdownPolicyChanged(bool reboot_on_shutdown) { |
| 24 // Shutdown policy changes rarely so don't bother caching the connection. | 24 // Shutdown policy changes rarely so don't bother caching the connection. |
| 25 ash::mojom::ShutdownControllerPtr shutdown_controller; | 25 ash::mojom::ShutdownControllerPtr shutdown_controller; |
| 26 content::ServiceManagerConnection::GetForProcess() | 26 content::ServiceManagerConnection::GetForProcess() |
| 27 ->GetConnector() | 27 ->GetConnector() |
| 28 ->BindInterface(ash_util::GetAshServiceName(), &shutdown_controller); | 28 ->BindInterface(ash::mojom::kServiceName, &shutdown_controller); |
| 29 | 29 |
| 30 // Forward the setting to ash. | 30 // Forward the setting to ash. |
| 31 shutdown_controller->SetRebootOnShutdown(reboot_on_shutdown); | 31 shutdown_controller->SetRebootOnShutdown(reboot_on_shutdown); |
| 32 } | 32 } |
| 33 | 33 |
| 34 } // namespace chromeos | 34 } // namespace chromeos |
| OLD | NEW |