Don't preload rarely seen large images
[chromium-blink-merge.git] / chromeos / dbus / fake_shill_third_party_vpn_driver_client.cc
blobb68d0b35875d17d9792478405e4431919f0979f3
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/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h"
11 #include "chromeos/dbus/shill_third_party_vpn_observer.h"
12 #include "dbus/object_proxy.h"
14 namespace chromeos {
16 FakeShillThirdPartyVpnDriverClient::FakeShillThirdPartyVpnDriverClient() {
19 FakeShillThirdPartyVpnDriverClient::~FakeShillThirdPartyVpnDriverClient() {
22 void FakeShillThirdPartyVpnDriverClient::Init(dbus::Bus* bus) {
25 void FakeShillThirdPartyVpnDriverClient::AddShillThirdPartyVpnObserver(
26 const std::string& object_path_value,
27 ShillThirdPartyVpnObserver* observer) {
28 if (observer_map_.find(object_path_value) != observer_map_.end()) {
29 VLOG(2) << "Observer exists.";
30 return;
32 observer_map_[object_path_value] = observer;
35 void FakeShillThirdPartyVpnDriverClient::RemoveShillThirdPartyVpnObserver(
36 const std::string& object_path_value) {
37 if (observer_map_.find(object_path_value) == observer_map_.end()) {
38 VLOG(2) << "Observer does not exist.";
39 return;
41 observer_map_.erase(object_path_value);
44 void FakeShillThirdPartyVpnDriverClient::SetParameters(
45 const std::string& object_path_value,
46 const base::DictionaryValue& parameters,
47 const ShillClientHelper::StringCallback& callback,
48 const ShillClientHelper::ErrorCallback& error_callback) {
49 base::ThreadTaskRunnerHandle::Get()->PostTask(
50 FROM_HERE, base::Bind(callback, std::string()));
53 void FakeShillThirdPartyVpnDriverClient::UpdateConnectionState(
54 const std::string& object_path_value,
55 const uint32_t connection_state,
56 const base::Closure& callback,
57 const ShillClientHelper::ErrorCallback& error_callback) {
58 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback);
61 void FakeShillThirdPartyVpnDriverClient::SendPacket(
62 const std::string& object_path_value,
63 const std::vector<char>& ip_packet,
64 const base::Closure& callback,
65 const ShillClientHelper::ErrorCallback& error_callback) {
66 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback);
69 void FakeShillThirdPartyVpnDriverClient::OnPacketReceived(
70 const std::string& object_path_value,
71 const std::vector<char>& packet) {
72 ObserverMap::iterator it = observer_map_.find(object_path_value);
73 if (it == observer_map_.end()) {
74 LOG(ERROR) << "Unexpected OnPacketReceived for " << object_path_value;
75 return;
78 it->second->OnPacketReceived(packet);
81 void FakeShillThirdPartyVpnDriverClient::OnPlatformMessage(
82 const std::string& object_path_value,
83 uint32_t message) {
84 ObserverMap::iterator it = observer_map_.find(object_path_value);
85 if (it == observer_map_.end()) {
86 LOG(ERROR) << "Unexpected OnPlatformMessage for " << object_path_value;
87 return;
90 it->second->OnPlatformMessage(message);
93 ShillThirdPartyVpnDriverClient::TestInterface*
94 FakeShillThirdPartyVpnDriverClient::GetTestInterface() {
95 return this;
98 } // namespace chromeos