Darin Petkov | 804e8d0 | 2012-10-10 16:44:36 +0200 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS 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 "shill/shims/task_proxy.h" |
| 6 | |
| 7 | #include <base/logging.h> |
| 8 | |
| 9 | using std::map; |
| 10 | using std::string; |
| 11 | |
| 12 | namespace shill { |
| 13 | |
| 14 | namespace shims { |
| 15 | |
| 16 | TaskProxy::TaskProxy(DBus::Connection *connection, |
| 17 | const string &path, |
| 18 | const string &service) |
| 19 | : proxy_(connection, path, service) {} |
| 20 | |
| 21 | TaskProxy::~TaskProxy() {} |
| 22 | |
| 23 | void TaskProxy::Notify(const string &reason, map<string, string> &dict) { |
| 24 | LOG(INFO) << __func__ << "(" << reason << ", " << dict.size() << ")"; |
| 25 | try { |
| 26 | proxy_.notify(reason, dict); |
| 27 | } catch (const DBus::Error &e) { |
| 28 | LOG(ERROR) << "DBus exception: " << e.name() << ": " << e.what(); |
| 29 | } |
| 30 | } |
| 31 | |
Darin Petkov | e6ca320 | 2012-10-19 14:49:56 +0200 | [diff] [blame] | 32 | bool TaskProxy::GetSecret(string *username, string *password) { |
| 33 | LOG(INFO) << __func__; |
| 34 | try { |
| 35 | proxy_.getsec(*username, *password); |
| 36 | } catch (const DBus::Error &e) { |
| 37 | LOG(ERROR) << "DBus exception: " << e.name() << ": " << e.what(); |
| 38 | return false; |
| 39 | } |
| 40 | return true; |
| 41 | } |
| 42 | |
Darin Petkov | 804e8d0 | 2012-10-10 16:44:36 +0200 | [diff] [blame] | 43 | TaskProxy::Proxy::Proxy(DBus::Connection *connection, |
| 44 | const std::string &path, |
| 45 | const std::string &service) |
| 46 | : DBus::ObjectProxy(*connection, path, service.c_str()) {} |
| 47 | |
| 48 | TaskProxy::Proxy::~Proxy() {} |
| 49 | |
| 50 | } // namespace shims |
| 51 | |
| 52 | } // namespace shill |