OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROMEOS_NETWORK_SHILL_SERVICE_OBSERVER_H_ |
| 6 #define CHROMEOS_NETWORK_SHILL_SERVICE_OBSERVER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "chromeos/dbus/shill_property_changed_observer.h" |
| 12 |
| 13 namespace chromeos { |
| 14 namespace internal { |
| 15 |
| 16 // Class to manage Shill service property changed observers. Observers are |
| 17 // added on construction and removed on destruction. Runs the handler when |
| 18 // OnPropertyChanged is called. |
| 19 class ShillServiceObserver : public ShillPropertyChangedObserver { |
| 20 public: |
| 21 typedef base::Callback<void(const std::string& service, |
| 22 const std::string& name, |
| 23 const base::Value& value)> Handler; |
| 24 |
| 25 ShillServiceObserver(const std::string& service_path, |
| 26 const Handler& handler); |
| 27 |
| 28 virtual ~ShillServiceObserver(); |
| 29 |
| 30 // ShillPropertyChangedObserver overrides. |
| 31 virtual void OnPropertyChanged(const std::string& key, |
| 32 const base::Value& value) OVERRIDE; |
| 33 |
| 34 private: |
| 35 std::string service_path_; |
| 36 Handler handler_; |
| 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(ShillServiceObserver); |
| 39 }; |
| 40 |
| 41 } // namespace internal |
| 42 } // namespace chromeos |
| 43 |
| 44 #endif // CHROMEOS_NETWORK_SHILL_SERVICE_OBSERVER_H_ |
OLD | NEW |