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 #include "chromeos/network/shill_service_observer.h" |
| 6 |
| 7 #include "chromeos/dbus/dbus_thread_manager.h" |
| 8 #include "chromeos/dbus/shill_service_client.h" |
| 9 #include "dbus/object_path.h" |
| 10 |
| 11 namespace chromeos { |
| 12 namespace internal { |
| 13 |
| 14 ShillServiceObserver::ShillServiceObserver(const std::string& service_path, |
| 15 const Handler& handler) |
| 16 : service_path_(service_path), |
| 17 handler_(handler) { |
| 18 DBusThreadManager::Get()->GetShillServiceClient()-> |
| 19 AddPropertyChangedObserver(dbus::ObjectPath(service_path), this); |
| 20 } |
| 21 |
| 22 ShillServiceObserver::~ShillServiceObserver() { |
| 23 DBusThreadManager::Get()->GetShillServiceClient()-> |
| 24 RemovePropertyChangedObserver(dbus::ObjectPath(service_path_), this); |
| 25 } |
| 26 |
| 27 void ShillServiceObserver::OnPropertyChanged(const std::string& key, |
| 28 const base::Value& value) { |
| 29 handler_.Run(service_path_, key, value); |
| 30 } |
| 31 |
| 32 } // namespace internal |
| 33 } // namespace chromeos |
OLD | NEW |