| OLD | NEW | 
|    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |    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 |    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 "chromeos/dbus/shill_client_helper.h" |    5 #include "chromeos/dbus/shill_client_helper.h" | 
|    6  |    6  | 
|    7 #include "base/bind.h" |    7 #include "base/bind.h" | 
|    8 #include "base/values.h" |    8 #include "base/values.h" | 
|    9 #include "dbus/message.h" |    9 #include "dbus/message.h" | 
|   10 #include "dbus/object_proxy.h" |   10 #include "dbus/object_proxy.h" | 
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  143  |  143  | 
|  144 bool ShillClientHelper::CallVoidMethodAndBlock( |  144 bool ShillClientHelper::CallVoidMethodAndBlock( | 
|  145     dbus::MethodCall* method_call) { |  145     dbus::MethodCall* method_call) { | 
|  146   scoped_ptr<dbus::Response> response( |  146   scoped_ptr<dbus::Response> response( | 
|  147       blocking_method_caller_.CallMethodAndBlock(method_call)); |  147       blocking_method_caller_.CallMethodAndBlock(method_call)); | 
|  148   if (!response.get()) |  148   if (!response.get()) | 
|  149     return false; |  149     return false; | 
|  150   return true; |  150   return true; | 
|  151 } |  151 } | 
|  152  |  152  | 
|  153 dbus::ObjectPath ShillClientHelper::CallObjectPathMethodAndBlock( |  | 
|  154     dbus::MethodCall* method_call) { |  | 
|  155   scoped_ptr<dbus::Response> response( |  | 
|  156       blocking_method_caller_.CallMethodAndBlock(method_call)); |  | 
|  157   if (!response.get()) |  | 
|  158     return dbus::ObjectPath(); |  | 
|  159  |  | 
|  160   dbus::MessageReader reader(response.get()); |  | 
|  161   dbus::ObjectPath result; |  | 
|  162   if (!reader.PopObjectPath(&result)) |  | 
|  163     return dbus::ObjectPath(); |  | 
|  164  |  | 
|  165   return result; |  | 
|  166 } |  | 
|  167  |  | 
|  168 base::DictionaryValue* ShillClientHelper::CallDictionaryValueMethodAndBlock( |  153 base::DictionaryValue* ShillClientHelper::CallDictionaryValueMethodAndBlock( | 
|  169     dbus::MethodCall* method_call) { |  154     dbus::MethodCall* method_call) { | 
|  170   scoped_ptr<dbus::Response> response( |  155   scoped_ptr<dbus::Response> response( | 
|  171       blocking_method_caller_.CallMethodAndBlock(method_call)); |  156       blocking_method_caller_.CallMethodAndBlock(method_call)); | 
|  172   if (!response.get()) |  157   if (!response.get()) | 
|  173     return NULL; |  158     return NULL; | 
|  174  |  159  | 
|  175   dbus::MessageReader reader(response.get()); |  160   dbus::MessageReader reader(response.get()); | 
|  176   base::Value* value = dbus::PopDataAsValue(&reader); |  161   base::Value* value = dbus::PopDataAsValue(&reader); | 
|  177   base::DictionaryValue* result = NULL; |  162   base::DictionaryValue* result = NULL; | 
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  349   if (response) { |  334   if (response) { | 
|  350     // Error message may contain the error message as string. |  335     // Error message may contain the error message as string. | 
|  351     dbus::MessageReader reader(response); |  336     dbus::MessageReader reader(response); | 
|  352     error_name = response->GetErrorName(); |  337     error_name = response->GetErrorName(); | 
|  353     reader.PopString(&error_message); |  338     reader.PopString(&error_message); | 
|  354   } |  339   } | 
|  355   error_callback.Run(error_name, error_message); |  340   error_callback.Run(error_name, error_message); | 
|  356 } |  341 } | 
|  357  |  342  | 
|  358 }  // namespace chromeos |  343 }  // namespace chromeos | 
| OLD | NEW |