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

Unified Diff: chrome/browser/chromeos/contacts/google_contact_store.h

Issue 10829247: contacts: Defer updates when offline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « no previous file | chrome/browser/chromeos/contacts/google_contact_store.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/contacts/google_contact_store.h
diff --git a/chrome/browser/chromeos/contacts/google_contact_store.h b/chrome/browser/chromeos/contacts/google_contact_store.h
index c51fca472026393bfbe31cbd295498b4eade6462..f38d787bbb28fc2eeeab91bcf83700652675e391 100644
--- a/chrome/browser/chromeos/contacts/google_contact_store.h
+++ b/chrome/browser/chromeos/contacts/google_contact_store.h
@@ -20,6 +20,7 @@
#include "base/stl_util.h"
#include "base/time.h"
#include "base/timer.h"
+#include "net/base/network_change_notifier.h"
class Profile;
@@ -34,7 +35,9 @@ class ContactDatabaseInterface;
class UpdateMetadata;
// A collection of contacts from a Google account.
-class GoogleContactStore : public ContactStore {
+class GoogleContactStore
+ : public ContactStore,
+ public net::NetworkChangeNotifier::ConnectionTypeObserver {
satorux1 2012/08/08 21:42:27 I didn't know about this. in gdata_sync_client.cc,
public:
class TestAPI {
public:
@@ -56,6 +59,9 @@ class GoogleContactStore : public ContactStore {
// Triggers an update, similar to what happens when the update timer fires.
void DoUpdate();
+ // Notifies the store that the system has gone online or offline.
+ void NotifyAboutNetworkStateChange(bool online);
+
private:
GoogleContactStore* store_; // not owned
@@ -73,6 +79,10 @@ class GoogleContactStore : public ContactStore {
virtual void AddObserver(ContactStoreObserver* observer) OVERRIDE;
virtual void RemoveObserver(ContactStoreObserver* observer) OVERRIDE;
+ // net::NetworkChangeNotifier::ConnectionTypeObserver implementation:
+ virtual void OnConnectionTypeChanged(
+ net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
+
private:
// Map from a contact's Google-assigned ID to the contact itself.
typedef std::map<std::string, Contact*> ContactMap;
@@ -150,6 +160,14 @@ class GoogleContactStore : public ContactStore {
// fails.
base::TimeDelta update_delay_on_next_failure_;
+ // Do we believe that it's likely that we'll be able to make network
+ // connections?
+ bool is_online_;
+
+ // Should we call UpdateContacts() when |is_online_| becomes true? Set when
+ // UpdateContacts() is called while we're offline.
+ bool should_update_when_online_;
+
// If non-null, used in place of base::Time::Now() when the current time is
// needed.
base::Time current_time_for_testing_;
« no previous file with comments | « no previous file | chrome/browser/chromeos/contacts/google_contact_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698