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

Unified Diff: chromeos/dbus/gsm_sms_client.cc

Issue 10332152: Add TraySms for SMS messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix bubble sizing code Created 8 years, 7 months 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 | « ash/system/tray/tray_views.cc ('k') | ui/resources/aura/status_sms.png » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/gsm_sms_client.cc
diff --git a/chromeos/dbus/gsm_sms_client.cc b/chromeos/dbus/gsm_sms_client.cc
index 75d8466b1518266debf2a9495e1e7fe341eaeaf7..4eea3449edac9b7830e4d6346d0bcb79d1f9ac23 100644
--- a/chromeos/dbus/gsm_sms_client.cc
+++ b/chromeos/dbus/gsm_sms_client.cc
@@ -230,7 +230,7 @@ class GsmSMSClientImpl : public GsmSMSClient {
// A stub implementaion of GsmSMSClient.
class GsmSMSClientStubImpl : public GsmSMSClient {
public:
- GsmSMSClientStubImpl() : test_index_(0), weak_ptr_factory_(this) {
+ GsmSMSClientStubImpl() : test_index_(-1), weak_ptr_factory_(this) {
test_messages_.push_back("Test Message 0");
test_messages_.push_back("Test Message 1");
test_messages_.push_back("Test a relatively long message 2");
@@ -291,7 +291,15 @@ class GsmSMSClientStubImpl : public GsmSMSClient {
// GsmSMSClient override.
virtual void RequestUpdate(const std::string& service_name,
const dbus::ObjectPath& object_path) {
- PushTestMessageChain();
+ if (test_index_ >= 0)
+ return;
+ test_index_ = 0;
+ // Call PushTestMessageChain asynchronously so that the handler_ callback
+ // does not get called from the update request.
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&GsmSMSClientStubImpl::PushTestMessageChain,
+ weak_ptr_factory_.GetWeakPtr()));
}
private:
@@ -310,7 +318,7 @@ class GsmSMSClientStubImpl : public GsmSMSClient {
}
bool PushTestMessage() {
- if (test_index_ >= test_messages_.size())
+ if (test_index_ >= static_cast<int>(test_messages_.size()))
return false;
base::DictionaryValue* message = new base::DictionaryValue;
message->SetString("number", "000-000-0000");
@@ -324,7 +332,7 @@ class GsmSMSClientStubImpl : public GsmSMSClient {
return true;
}
- size_t test_index_;
+ int test_index_;
std::vector<std::string> test_messages_;
base::ListValue message_list_;
SmsReceivedHandler handler_;
« no previous file with comments | « ash/system/tray/tray_views.cc ('k') | ui/resources/aura/status_sms.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698