summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus
diff options
context:
space:
mode:
authorstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-29 17:08:22 +0000
committerstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-29 17:08:22 +0000
commitc46c2a993a37c4f2e7b69319abbbbbc63f7ba019 (patch)
tree85783f0a0116ba4f96bb3cc49c55e5281ce74ab4 /chromeos/dbus
parentf955bece17404ab4012f275b7a1c3d0b026e5f81 (diff)
downloadchromium_src-c46c2a993a37c4f2e7b69319abbbbbc63f7ba019.zip
chromium_src-c46c2a993a37c4f2e7b69319abbbbbc63f7ba019.tar.gz
chromium_src-c46c2a993a37c4f2e7b69319abbbbbc63f7ba019.tar.bz2
Remove CashewClient from src/chromeos
CashewClient has been deprecated and should be removed. BUG=162717 Review URL: https://codereview.chromium.org/11299246 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170210 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus')
-rw-r--r--chromeos/dbus/cashew_client.cc139
-rw-r--r--chromeos/dbus/cashew_client.h65
-rw-r--r--chromeos/dbus/dbus_thread_manager.cc7
-rw-r--r--chromeos/dbus/dbus_thread_manager.h2
-rw-r--r--chromeos/dbus/mock_cashew_client.cc13
-rw-r--r--chromeos/dbus/mock_cashew_client.h26
-rw-r--r--chromeos/dbus/mock_dbus_thread_manager.cc4
-rw-r--r--chromeos/dbus/mock_dbus_thread_manager.h6
-rw-r--r--chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc5
-rw-r--r--chromeos/dbus/mock_dbus_thread_manager_without_gmock.h1
10 files changed, 0 insertions, 268 deletions
diff --git a/chromeos/dbus/cashew_client.cc b/chromeos/dbus/cashew_client.cc
deleted file mode 100644
index 27a7b87..0000000
--- a/chromeos/dbus/cashew_client.cc
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chromeos/dbus/cashew_client.h"
-
-#include "base/bind.h"
-#include "base/values.h"
-#include "dbus/bus.h"
-#include "dbus/message.h"
-#include "dbus/object_path.h"
-#include "dbus/object_proxy.h"
-#include "dbus/values_util.h"
-#include "third_party/cros_system_api/dbus/service_constants.h"
-
-namespace chromeos {
-
-namespace {
-
-// Does nothing.
-// This method is used to handle results of RequestDataPlansUpdate method call.
-void DoNothing(dbus::Response* response) {
-}
-
-// The CashewClient implementation.
-class CashewClientImpl : public CashewClient {
- public:
- explicit CashewClientImpl(dbus::Bus* bus)
- : proxy_(bus->GetObjectProxy(
- cashew::kCashewServiceName,
- dbus::ObjectPath(cashew::kCashewServicePath))),
- weak_ptr_factory_(this) {
- proxy_->ConnectToSignal(
- cashew::kCashewServiceInterface,
- cashew::kMonitorDataPlanUpdate,
- base::Bind(&CashewClientImpl::OnDataPlansUpdate,
- weak_ptr_factory_.GetWeakPtr()),
- base::Bind(&CashewClientImpl::OnSignalConnected,
- weak_ptr_factory_.GetWeakPtr()));
- }
-
- // CashewClient override.
- virtual void SetDataPlansUpdateHandler(
- const DataPlansUpdateHandler& handler) OVERRIDE {
- data_plans_update_handler_ = handler;
- }
-
- // CashewClient override.
- virtual void ResetDataPlansUpdateHandler() OVERRIDE {
- data_plans_update_handler_.Reset();
- }
-
- // CashewClient override.
- virtual void RequestDataPlansUpdate(const std::string& service) OVERRIDE {
- dbus::MethodCall method_call(cashew::kCashewServiceInterface,
- cashew::kRequestDataPlanFunction);
- dbus::MessageWriter writer(&method_call);
- writer.AppendString(service);
- proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
- base::Bind(&DoNothing));
- }
-
- private:
- // Handles DataPlansUpdate signal.
- void OnDataPlansUpdate(dbus::Signal* signal) {
- dbus::MessageReader reader(signal);
- std::string service;
- if (!reader.PopString(&service)) {
- LOG(ERROR) << "Invalid signal: " << signal->ToString();
- return;
- }
- scoped_ptr<Value> value(dbus::PopDataAsValue(&reader));
- ListValue* data_plans = NULL;
- if (!value.get() || !value->GetAsList(&data_plans)) {
- LOG(ERROR) << "Invalid signal: " << signal->ToString();
- return;
- }
- if (!data_plans_update_handler_.is_null())
- data_plans_update_handler_.Run(service, *data_plans);
- }
-
- // Handles the result of signal connection setup.
- void OnSignalConnected(const std::string& interface,
- const std::string& signal,
- bool succeeded) {
- LOG_IF(ERROR, !succeeded) << "Connect to " << interface << " " <<
- signal << " failed.";
- }
-
- dbus::ObjectProxy* proxy_;
- DataPlansUpdateHandler data_plans_update_handler_;
-
- // Note: This should remain the last member so it'll be destroyed and
- // invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<CashewClientImpl> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(CashewClientImpl);
-};
-
-// A stub implementaion of CashewClient.
-class CashewClientStubImpl : public CashewClient {
- public:
- CashewClientStubImpl() {}
-
- virtual ~CashewClientStubImpl() {}
-
- // CashewClient override.
- virtual void SetDataPlansUpdateHandler(
- const DataPlansUpdateHandler& handler) OVERRIDE {}
-
- // CashewClient override.
- virtual void ResetDataPlansUpdateHandler() OVERRIDE {}
-
- // CashewClient override.
- virtual void RequestDataPlansUpdate(const std::string& service) OVERRIDE {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CashewClientStubImpl);
-};
-
-} // namespace
-
-////////////////////////////////////////////////////////////////////////////////
-// CashewClient
-
-CashewClient::CashewClient() {}
-
-CashewClient::~CashewClient() {}
-
-// static
-CashewClient* CashewClient::Create(DBusClientImplementationType type,
- dbus::Bus* bus) {
- if (type == REAL_DBUS_CLIENT_IMPLEMENTATION)
- return new CashewClientImpl(bus);
- DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type);
- return new CashewClientStubImpl();
-}
-
-} // namespace chromeos
diff --git a/chromeos/dbus/cashew_client.h b/chromeos/dbus/cashew_client.h
deleted file mode 100644
index e208e88..0000000
--- a/chromeos/dbus/cashew_client.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROMEOS_DBUS_CASHEW_CLIENT_H_
-#define CHROMEOS_DBUS_CASHEW_CLIENT_H_
-
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/callback.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/dbus_client_implementation_type.h"
-
-namespace base {
-class ListValue;
-}
-
-namespace dbus {
-class Bus;
-}
-
-namespace chromeos {
-
-// CashewClient is used to communicate with the Cashew service.
-// All methods should be called from the origin thread (UI thread) which
-// initializes the DBusThreadManager instance.
-class CHROMEOS_EXPORT CashewClient {
- public:
- // A callback to handle "DataPlansUpdate" signal.
- // |service| is the D-Bus path of the cellular service.
- // (e.g. /service/cellular_0271266ce2ce_310260467781434)
- typedef base::Callback<void(const std::string& service,
- const base::ListValue& data_plans)>
- DataPlansUpdateHandler;
-
- virtual ~CashewClient();
-
- // Factory function, creates a new instance and returns ownership.
- // For normal usage, access the singleton via DBusThreadManager::Get().
- static CashewClient* Create(DBusClientImplementationType type,
- dbus::Bus* bus);
-
- // Sets DataPlansUpdate signal handler.
- virtual void SetDataPlansUpdateHandler(
- const DataPlansUpdateHandler& handler) = 0;
-
- // Resets DataPlansUpdate signal handler.
- virtual void ResetDataPlansUpdateHandler() = 0;
-
- // Calls RequestDataPlansUpdate method.
- virtual void RequestDataPlansUpdate(const std::string& service) = 0;
-
- protected:
- // Create() should be used instead.
- CashewClient();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CashewClient);
-};
-
-} // namespace chromeos
-
-#endif // CHROMEOS_DBUS_CASHEW_CLIENT_H_
diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc
index cb15afd..f72e6a0 100644
--- a/chromeos/dbus/dbus_thread_manager.cc
+++ b/chromeos/dbus/dbus_thread_manager.cc
@@ -17,7 +17,6 @@
#include "chromeos/dbus/bluetooth_manager_client.h"
#include "chromeos/dbus/bluetooth_node_client.h"
#include "chromeos/dbus/bluetooth_out_of_band_client.h"
-#include "chromeos/dbus/cashew_client.h"
#include "chromeos/dbus/cros_disks_client.h"
#include "chromeos/dbus/cryptohome_client.h"
#include "chromeos/dbus/dbus_client_implementation_type.h"
@@ -90,7 +89,6 @@ class DBusThreadManagerImpl : public DBusThreadManager {
client_type, system_bus_.get(), bluetooth_device_client_.get()));
bluetooth_out_of_band_client_.reset(BluetoothOutOfBandClient::Create(
client_type, system_bus_.get()));
- cashew_client_.reset(CashewClient::Create(client_type, system_bus_.get()));
cros_disks_client_.reset(
CrosDisksClient::Create(client_type, system_bus_.get()));
cryptohome_client_.reset(
@@ -228,10 +226,6 @@ class DBusThreadManagerImpl : public DBusThreadManager {
return bluetooth_out_of_band_client_.get();
}
- virtual CashewClient* GetCashewClient() OVERRIDE {
- return cashew_client_.get();
- }
-
virtual CrosDisksClient* GetCrosDisksClient() OVERRIDE {
return cros_disks_client_.get();
}
@@ -362,7 +356,6 @@ class DBusThreadManagerImpl : public DBusThreadManager {
scoped_ptr<BluetoothManagerClient> bluetooth_manager_client_;
scoped_ptr<BluetoothNodeClient> bluetooth_node_client_;
scoped_ptr<BluetoothOutOfBandClient> bluetooth_out_of_band_client_;
- scoped_ptr<CashewClient> cashew_client_;
scoped_ptr<CrosDisksClient> cros_disks_client_;
scoped_ptr<CryptohomeClient> cryptohome_client_;
scoped_ptr<DebugDaemonClient> debug_daemon_client_;
diff --git a/chromeos/dbus/dbus_thread_manager.h b/chromeos/dbus/dbus_thread_manager.h
index b60d2e0..41afbc1 100644
--- a/chromeos/dbus/dbus_thread_manager.h
+++ b/chromeos/dbus/dbus_thread_manager.h
@@ -31,7 +31,6 @@ class BluetoothInputClient;
class BluetoothManagerClient;
class BluetoothNodeClient;
class BluetoothOutOfBandClient;
-class CashewClient;
class CrosDisksClient;
class CryptohomeClient;
class DebugDaemonClient;
@@ -127,7 +126,6 @@ class CHROMEOS_EXPORT DBusThreadManager {
virtual BluetoothManagerClient* GetBluetoothManagerClient() = 0;
virtual BluetoothNodeClient* GetBluetoothNodeClient() = 0;
virtual BluetoothOutOfBandClient* GetBluetoothOutOfBandClient() = 0;
- virtual CashewClient* GetCashewClient() = 0;
virtual CrosDisksClient* GetCrosDisksClient() = 0;
virtual CryptohomeClient* GetCryptohomeClient() = 0;
virtual DebugDaemonClient* GetDebugDaemonClient() = 0;
diff --git a/chromeos/dbus/mock_cashew_client.cc b/chromeos/dbus/mock_cashew_client.cc
deleted file mode 100644
index 1742ab2..0000000
--- a/chromeos/dbus/mock_cashew_client.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chromeos/dbus/mock_cashew_client.h"
-
-namespace chromeos {
-
-MockCashewClient::MockCashewClient() {}
-
-MockCashewClient::~MockCashewClient() {}
-
-} // namespace chromeos
diff --git a/chromeos/dbus/mock_cashew_client.h b/chromeos/dbus/mock_cashew_client.h
deleted file mode 100644
index d2b17e6..0000000
--- a/chromeos/dbus/mock_cashew_client.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROMEOS_DBUS_MOCK_CASHEW_CLIENT_H_
-#define CHROMEOS_DBUS_MOCK_CASHEW_CLIENT_H_
-
-#include "chromeos/dbus/cashew_client.h"
-#include "testing/gmock/include/gmock/gmock.h"
-
-namespace chromeos {
-
-class MockCashewClient : public CashewClient {
- public:
- MockCashewClient();
- virtual ~MockCashewClient();
-
- MOCK_METHOD1(SetDataPlansUpdateHandler,
- void(const DataPlansUpdateHandler& handler));
- MOCK_METHOD0(ResetDataPlansUpdateHandler, void());
- MOCK_METHOD1(RequestDataPlansUpdate, void(const std::string& service));
-};
-
-} // namespace chromeos
-
-#endif // CHROMEOS_DBUS_MOCK_CASHEW_CLIENT_H_
diff --git a/chromeos/dbus/mock_dbus_thread_manager.cc b/chromeos/dbus/mock_dbus_thread_manager.cc
index 2f5f646..e2a5b0d 100644
--- a/chromeos/dbus/mock_dbus_thread_manager.cc
+++ b/chromeos/dbus/mock_dbus_thread_manager.cc
@@ -11,7 +11,6 @@
#include "chromeos/dbus/mock_bluetooth_manager_client.h"
#include "chromeos/dbus/mock_bluetooth_node_client.h"
#include "chromeos/dbus/mock_bluetooth_out_of_band_client.h"
-#include "chromeos/dbus/mock_cashew_client.h"
#include "chromeos/dbus/mock_cros_disks_client.h"
#include "chromeos/dbus/mock_cryptohome_client.h"
#include "chromeos/dbus/mock_debug_daemon_client.h"
@@ -47,7 +46,6 @@ MockDBusThreadManager::MockDBusThreadManager()
mock_bluetooth_manager_client_(new MockBluetoothManagerClient),
mock_bluetooth_node_client_(new MockBluetoothNodeClient),
mock_bluetooth_out_of_band_client_(new MockBluetoothOutOfBandClient),
- mock_cashew_client_(new MockCashewClient),
mock_cros_disks_client_(new MockCrosDisksClient),
mock_cryptohome_client_(new MockCryptohomeClient),
mock_debugdaemon_client_(new MockDebugDaemonClient),
@@ -80,8 +78,6 @@ MockDBusThreadManager::MockDBusThreadManager()
.WillRepeatedly(Return(mock_bluetooth_node_client_.get()));
EXPECT_CALL(*this, GetBluetoothOutOfBandClient())
.WillRepeatedly(Return(mock_bluetooth_out_of_band_client_.get()));
- EXPECT_CALL(*this, GetCashewClient())
- .WillRepeatedly(Return(mock_cashew_client()));
EXPECT_CALL(*this, GetCrosDisksClient())
.WillRepeatedly(Return(mock_cros_disks_client()));
EXPECT_CALL(*this, GetCryptohomeClient())
diff --git a/chromeos/dbus/mock_dbus_thread_manager.h b/chromeos/dbus/mock_dbus_thread_manager.h
index 0bace79..7426b59 100644
--- a/chromeos/dbus/mock_dbus_thread_manager.h
+++ b/chromeos/dbus/mock_dbus_thread_manager.h
@@ -26,7 +26,6 @@ class MockBluetoothInputClient;
class MockBluetoothManagerClient;
class MockBluetoothNodeClient;
class MockBluetoothOutOfBandClient;
-class MockCashewClient;
class MockCrosDisksClient;
class MockCryptohomeClient;
class MockDebugDaemonClient;
@@ -67,7 +66,6 @@ class MockDBusThreadManager : public DBusThreadManager {
MOCK_METHOD0(GetBluetoothManagerClient, BluetoothManagerClient*(void));
MOCK_METHOD0(GetBluetoothNodeClient, BluetoothNodeClient*(void));
MOCK_METHOD0(GetBluetoothOutOfBandClient, BluetoothOutOfBandClient*(void));
- MOCK_METHOD0(GetCashewClient, CashewClient*(void));
MOCK_METHOD0(GetCrosDisksClient, CrosDisksClient*(void));
MOCK_METHOD0(GetCryptohomeClient, CryptohomeClient*(void));
MOCK_METHOD0(GetDebugDaemonClient, DebugDaemonClient*(void));
@@ -115,9 +113,6 @@ class MockDBusThreadManager : public DBusThreadManager {
MockBluetoothOutOfBandClient* mock_bluetooth_out_of_band_client() {
return mock_bluetooth_out_of_band_client_.get();
}
- MockCashewClient* mock_cashew_client() {
- return mock_cashew_client_.get();
- }
MockCrosDisksClient* mock_cros_disks_client() {
return mock_cros_disks_client_.get();
}
@@ -186,7 +181,6 @@ class MockDBusThreadManager : public DBusThreadManager {
scoped_ptr<MockBluetoothManagerClient> mock_bluetooth_manager_client_;
scoped_ptr<MockBluetoothNodeClient> mock_bluetooth_node_client_;
scoped_ptr<MockBluetoothOutOfBandClient> mock_bluetooth_out_of_band_client_;
- scoped_ptr<MockCashewClient> mock_cashew_client_;
scoped_ptr<MockCrosDisksClient> mock_cros_disks_client_;
scoped_ptr<MockCryptohomeClient> mock_cryptohome_client_;
scoped_ptr<MockDebugDaemonClient> mock_debugdaemon_client_;
diff --git a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc
index bf5d4a0..424392b 100644
--- a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc
+++ b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc
@@ -80,11 +80,6 @@ BluetoothNodeClient*
return NULL;
}
-CashewClient* MockDBusThreadManagerWithoutGMock::GetCashewClient() {
- NOTIMPLEMENTED();
- return NULL;
-}
-
CrosDisksClient* MockDBusThreadManagerWithoutGMock::GetCrosDisksClient() {
NOTIMPLEMENTED();
return NULL;
diff --git a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h
index 2f6d605..136dd1e 100644
--- a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h
+++ b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h
@@ -44,7 +44,6 @@ class MockDBusThreadManagerWithoutGMock : public DBusThreadManager {
virtual BluetoothInputClient* GetBluetoothInputClient() OVERRIDE;
virtual BluetoothManagerClient* GetBluetoothManagerClient() OVERRIDE;
virtual BluetoothNodeClient* GetBluetoothNodeClient() OVERRIDE;
- virtual CashewClient* GetCashewClient() OVERRIDE;
virtual CrosDisksClient* GetCrosDisksClient() OVERRIDE;
virtual CryptohomeClient* GetCryptohomeClient() OVERRIDE;
virtual DebugDaemonClient* GetDebugDaemonClient() OVERRIDE;