| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_SHUTDOWN_POLICY_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_SHUTDOWN_POLICY_HANDLER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_SHUTDOWN_POLICY_HANDLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_SHUTDOWN_POLICY_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/chromeos/settings/cros_settings.h" | 13 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 13 | 14 |
| 14 namespace chromeos { | 15 namespace chromeos { |
| 15 | 16 |
| 16 // This class observes the device setting |DeviceRebootOnShutdown|. Changes to | 17 // This class observes the device setting |DeviceRebootOnShutdown|. Changes to |
| 17 // this policy are communicated to the ShutdownPolicyHandler::Delegate by | 18 // this policy are communicated to the ShutdownPolicyHandler::Delegate by |
| 18 // calling its OnShutdownPolicyChanged method with the new state of the policy. | 19 // calling its OnShutdownPolicyChanged method with the new state of the policy. |
| 19 class ShutdownPolicyHandler { | 20 class ShutdownPolicyHandler { |
| 20 public: | 21 public: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 void CallDelegate(bool reboot_on_shutdown); | 47 void CallDelegate(bool reboot_on_shutdown); |
| 47 | 48 |
| 48 void OnShutdownPolicyChanged(); | 49 void OnShutdownPolicyChanged(); |
| 49 | 50 |
| 50 CrosSettings* cros_settings_; | 51 CrosSettings* cros_settings_; |
| 51 | 52 |
| 52 Delegate* delegate_; | 53 Delegate* delegate_; |
| 53 | 54 |
| 54 scoped_ptr<CrosSettings::ObserverSubscription> shutdown_policy_subscription_; | 55 std::unique_ptr<CrosSettings::ObserverSubscription> |
| 56 shutdown_policy_subscription_; |
| 55 | 57 |
| 56 base::WeakPtrFactory<ShutdownPolicyHandler> weak_factory_; | 58 base::WeakPtrFactory<ShutdownPolicyHandler> weak_factory_; |
| 57 | 59 |
| 58 DISALLOW_COPY_AND_ASSIGN(ShutdownPolicyHandler); | 60 DISALLOW_COPY_AND_ASSIGN(ShutdownPolicyHandler); |
| 59 }; | 61 }; |
| 60 | 62 |
| 61 } // namespace chromeos | 63 } // namespace chromeos |
| 62 | 64 |
| 63 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SHUTDOWN_POLICY_HANDLER_H_ | 65 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SHUTDOWN_POLICY_HANDLER_H_ |
| OLD | NEW |