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/shutdown.mojom.h" | 7 #include "ash/public/interfaces/shutdown.mojom.h" |
8 #include "chrome/browser/chromeos/settings/cros_settings.h" | 8 #include "chrome/browser/chromeos/settings/cros_settings.h" |
9 #include "chrome/browser/ui/ash/ash_util.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 "content/public/common/service_names.mojom.h" |
11 #include "services/service_manager/public/cpp/connector.h" | 12 #include "services/service_manager/public/cpp/connector.h" |
12 | 13 |
13 namespace chromeos { | 14 namespace chromeos { |
14 | 15 |
15 ShutdownPolicyForwarder::ShutdownPolicyForwarder() | 16 ShutdownPolicyForwarder::ShutdownPolicyForwarder() |
16 : shutdown_policy_handler_(CrosSettings::Get(), this) { | 17 : shutdown_policy_handler_(CrosSettings::Get(), this) { |
17 // Request the initial setting. | 18 // Request the initial setting. |
18 shutdown_policy_handler_.NotifyDelegateWithShutdownPolicy(); | 19 shutdown_policy_handler_.NotifyDelegateWithShutdownPolicy(); |
19 } | 20 } |
20 | 21 |
21 ShutdownPolicyForwarder::~ShutdownPolicyForwarder() {} | 22 ShutdownPolicyForwarder::~ShutdownPolicyForwarder() {} |
22 | 23 |
23 void ShutdownPolicyForwarder::OnShutdownPolicyChanged(bool reboot_on_shutdown) { | 24 void ShutdownPolicyForwarder::OnShutdownPolicyChanged(bool reboot_on_shutdown) { |
24 service_manager::Connector* connector = | 25 service_manager::Connector* connector = |
25 content::ServiceManagerConnection::GetForProcess()->GetConnector(); | 26 content::ServiceManagerConnection::GetForProcess()->GetConnector(); |
26 | 27 |
27 // Shutdown policy changes rarely so don't bother caching the connection. | 28 // Shutdown policy changes rarely so don't bother caching the connection. |
28 ash::mojom::ShutdownControllerPtr shutdown_controller; | 29 ash::mojom::ShutdownControllerPtr shutdown_controller; |
29 | 30 |
30 // Under mash the ShutdownController interface is in the ash process. In | 31 // Under mash the ShutdownController interface is in the ash process. In |
31 // classic ash the browser provides it to itself. | 32 // classic ash the browser provides it to itself. |
32 if (chrome::IsRunningInMash()) | 33 if (chrome::IsRunningInMash()) { |
33 connector->ConnectToInterface("ash", &shutdown_controller); | 34 connector->ConnectToInterface("ash", &shutdown_controller); |
34 else | 35 } else { |
35 connector->ConnectToInterface("content_browser", &shutdown_controller); | 36 connector->ConnectToInterface(content::mojom::kBrowserServiceName, |
| 37 &shutdown_controller); |
| 38 } |
36 | 39 |
37 // Forward the setting to ash. | 40 // Forward the setting to ash. |
38 shutdown_controller->SetRebootOnShutdown(reboot_on_shutdown); | 41 shutdown_controller->SetRebootOnShutdown(reboot_on_shutdown); |
39 } | 42 } |
40 | 43 |
41 } // namespace chromeos | 44 } // namespace chromeos |
OLD | NEW |