Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: chromeos/dbus/sms_client.cc

Issue 91373004: Move DBusClient stub implementations into separate files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/dbus/sms_client.h ('k') | chromeos/network/network_sms_handler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/sms_client.cc
diff --git a/chromeos/dbus/sms_client.cc b/chromeos/dbus/sms_client.cc
index cd867a58f51782025b012ff68fa849c3be850f1c..2e7b9717a5eb1d15040fc3213859d2291d0744fd 100644
--- a/chromeos/dbus/sms_client.cc
+++ b/chromeos/dbus/sms_client.cc
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/command_line.h"
+#include "base/location.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
@@ -85,49 +86,6 @@ class SMSClientImpl : public SMSClient {
DISALLOW_COPY_AND_ASSIGN(SMSClientImpl);
};
-class SMSClientStubImpl : public SMSClient {
- public:
- SMSClientStubImpl() : weak_ptr_factory_(this) {}
- virtual ~SMSClientStubImpl() {}
-
- virtual void Init(dbus::Bus* bus) OVERRIDE {}
-
- virtual void GetAll(const std::string& service_name,
- const dbus::ObjectPath& object_path,
- const GetAllCallback& callback) OVERRIDE {
- if (!CommandLine::ForCurrentProcess()->HasSwitch(
- chromeos::switches::kSmsTestMessages))
- return;
-
- // Ownership passed to callback
- base::DictionaryValue *sms = new base::DictionaryValue();
- sms->SetString("Number", "000-000-0000");
- sms->SetString("Text",
- "SMSClientStubImpl: Test Message: " + object_path.value());
- sms->SetString("Timestamp", "Fri Jun 8 13:26:04 EDT 2012");
-
- // Run callback asynchronously.
- if (callback.is_null())
- return;
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&SMSClientStubImpl::OnGetAll,
- weak_ptr_factory_.GetWeakPtr(),
- base::Owned(sms),
- callback));
- }
-
- private:
- void OnGetAll(base::DictionaryValue *sms,
- const GetAllCallback& callback) {
- callback.Run(*sms);
- }
-
- base::WeakPtrFactory<SMSClientStubImpl> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(SMSClientStubImpl);
-};
-
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -139,12 +97,8 @@ SMSClient::~SMSClient() {}
// static
-SMSClient* SMSClient::Create(DBusClientImplementationType type) {
- if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) {
- return new SMSClientImpl();
- }
- DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type);
- return new SMSClientStubImpl();
+SMSClient* SMSClient::Create() {
+ return new SMSClientImpl();
}
} // namespace chromeos
« no previous file with comments | « chromeos/dbus/sms_client.h ('k') | chromeos/network/network_sms_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698