Add type annotations to exif_parser.js.
[chromium-blink-merge.git] / chromeos / dbus / fake_shill_third_party_vpn_driver_client.cc
blob8be3db3d6cbe224852c0051a61f8774f5437ddf4
1 // Copyright 2014 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.
5 #include "chromeos/dbus/fake_shill_third_party_vpn_driver_client.h"
7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h"
9 #include "chromeos/dbus/shill_third_party_vpn_observer.h"
10 #include "dbus/object_proxy.h"
12 namespace chromeos {
14 FakeShillThirdPartyVpnDriverClient::FakeShillThirdPartyVpnDriverClient() {
17 FakeShillThirdPartyVpnDriverClient::~FakeShillThirdPartyVpnDriverClient() {
20 void FakeShillThirdPartyVpnDriverClient::Init(dbus::Bus* bus) {
23 void FakeShillThirdPartyVpnDriverClient::AddShillThirdPartyVpnObserver(
24 const std::string& object_path_value,
25 ShillThirdPartyVpnObserver* observer) {
26 if (observer_map_.find(object_path_value) != observer_map_.end()) {
27 VLOG(2) << "Observer exists.";
28 return;
30 observer_map_[object_path_value] = observer;
33 void FakeShillThirdPartyVpnDriverClient::RemoveShillThirdPartyVpnObserver(
34 const std::string& object_path_value) {
35 if (observer_map_.find(object_path_value) == observer_map_.end()) {
36 VLOG(2) << "Observer does not exist.";
37 return;
39 observer_map_.erase(object_path_value);
42 void FakeShillThirdPartyVpnDriverClient::SetParameters(
43 const std::string& object_path_value,
44 const base::DictionaryValue& parameters,
45 const base::Closure& callback,
46 const ShillClientHelper::ErrorCallback& error_callback) {
47 base::MessageLoop::current()->PostTask(FROM_HERE, callback);
50 void FakeShillThirdPartyVpnDriverClient::UpdateConnectionState(
51 const std::string& object_path_value,
52 const uint32_t connection_state,
53 const base::Closure& callback,
54 const ShillClientHelper::ErrorCallback& error_callback) {
55 base::MessageLoop::current()->PostTask(FROM_HERE, callback);
58 void FakeShillThirdPartyVpnDriverClient::SendPacket(
59 const std::string& object_path_value,
60 const std::string& ip_packet,
61 const base::Closure& callback,
62 const ShillClientHelper::ErrorCallback& error_callback) {
63 base::MessageLoop::current()->PostTask(FROM_HERE, callback);
66 void FakeShillThirdPartyVpnDriverClient::OnPacketReceived(
67 const std::string& object_path_value,
68 const std::string& packet) {
69 ObserverMap::iterator it = observer_map_.find(object_path_value);
70 if (it == observer_map_.end()) {
71 LOG(ERROR) << "Unexpected OnPacketReceived for " << object_path_value;
72 return;
75 it->second->OnPacketReceived(packet);
78 void FakeShillThirdPartyVpnDriverClient::OnPlatformMessage(
79 const std::string& object_path_value,
80 uint32_t message) {
81 ObserverMap::iterator it = observer_map_.find(object_path_value);
82 if (it == observer_map_.end()) {
83 LOG(ERROR) << "Unexpected OnPlatformMessage for " << object_path_value;
84 return;
87 it->second->OnPlatformMessage(message);
90 ShillThirdPartyVpnDriverClient::TestInterface*
91 FakeShillThirdPartyVpnDriverClient::GetTestInterface() {
92 return this;
95 } // namespace chromeos