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

Side by Side Diff: chrome/browser/chromeos/contacts/google_contact_store.h

Issue 10882017: contacts: Make GoogleContactStore own GDataContactsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/contacts/google_contact_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_CONTACTS_GOOGLE_CONTACT_STORE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_CONTACTS_GOOGLE_CONTACT_STORE_H_
6 #define CHROME_BROWSER_CHROMEOS_CONTACTS_GOOGLE_CONTACT_STORE_H_ 6 #define CHROME_BROWSER_CHROMEOS_CONTACTS_GOOGLE_CONTACT_STORE_H_
7 7
8 #include "chrome/browser/chromeos/contacts/contact_store.h" 8 #include "chrome/browser/chromeos/contacts/contact_store.h"
9 9
10 #include <map> 10 #include <map>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 bool update_scheduled() { return store_->update_timer_.IsRunning(); } 47 bool update_scheduled() { return store_->update_timer_.IsRunning(); }
48 48
49 void set_current_time(const base::Time& time) { 49 void set_current_time(const base::Time& time) {
50 store_->current_time_for_testing_ = time; 50 store_->current_time_for_testing_ = time;
51 } 51 }
52 52
53 // Takes ownership of |db|. Must be called before Init(). 53 // Takes ownership of |db|. Must be called before Init().
54 void SetDatabase(ContactDatabaseInterface* db); 54 void SetDatabase(ContactDatabaseInterface* db);
55 55
56 // Takes ownership of |service|. Must be called before Init(). 56 // Takes ownership of |service|. Must be called before Init(). The caller is
57 // responsible for calling |service|'s Initialize() method.
57 void SetGDataService(gdata::GDataContactsServiceInterface* service); 58 void SetGDataService(gdata::GDataContactsServiceInterface* service);
58 59
59 // Triggers an update, similar to what happens when the update timer fires. 60 // Triggers an update, similar to what happens when the update timer fires.
60 void DoUpdate(); 61 void DoUpdate();
61 62
62 // Notifies the store that the system has gone online or offline. 63 // Notifies the store that the system has gone online or offline.
63 void NotifyAboutNetworkStateChange(bool online); 64 void NotifyAboutNetworkStateChange(bool online);
64 65
65 private: 66 private:
66 GoogleContactStore* store_; // not owned 67 GoogleContactStore* store_; // not owned
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // Owns the pointed-to Contact values. 137 // Owns the pointed-to Contact values.
137 ContactMap contacts_; 138 ContactMap contacts_;
138 139
139 // Deletes values in |contacts_|. 140 // Deletes values in |contacts_|.
140 STLValueDeleter<ContactMap> contacts_deleter_; 141 STLValueDeleter<ContactMap> contacts_deleter_;
141 142
142 // Most-recent time that an entry in |contacts_| has been updated (as reported 143 // Most-recent time that an entry in |contacts_| has been updated (as reported
143 // by Google). 144 // by Google).
144 base::Time last_contact_update_time_; 145 base::Time last_contact_update_time_;
145 146
147 // Used to download contacts.
148 scoped_ptr<gdata::GDataContactsServiceInterface> gdata_service_;
kochi 2012/08/24 01:40:51 Maybe contacts_service_ a better name?
Daniel Erat 2012/08/24 16:52:30 I think I still prefer leaving gdata in the name -
149
146 // Used to save contacts to disk and load them at startup. Owns the object. 150 // Used to save contacts to disk and load them at startup. Owns the object.
147 ContactDatabaseInterface* db_; 151 ContactDatabaseInterface* db_;
148 152
149 // If non-NULL, used in place of the real GData service to download contacts.
150 scoped_ptr<gdata::GDataContactsServiceInterface> gdata_service_for_testing_;
151
152 // Used to schedule calls to UpdateContacts(). 153 // Used to schedule calls to UpdateContacts().
153 base::OneShotTimer<GoogleContactStore> update_timer_; 154 base::OneShotTimer<GoogleContactStore> update_timer_;
154 155
155 // Time at which the last successful update was started. 156 // Time at which the last successful update was started.
156 base::Time last_successful_update_start_time_; 157 base::Time last_successful_update_start_time_;
157 158
158 // Amount of time that we'll wait before retrying the next time that an update 159 // Amount of time that we'll wait before retrying the next time that an update
159 // fails. 160 // fails.
160 base::TimeDelta update_delay_on_next_failure_; 161 base::TimeDelta update_delay_on_next_failure_;
161 162
(...skipping 26 matching lines...) Expand all
188 virtual bool CanCreateContactStoreForProfile(Profile* profile) OVERRIDE; 189 virtual bool CanCreateContactStoreForProfile(Profile* profile) OVERRIDE;
189 virtual ContactStore* CreateContactStore(Profile* profile) OVERRIDE; 190 virtual ContactStore* CreateContactStore(Profile* profile) OVERRIDE;
190 191
191 private: 192 private:
192 DISALLOW_COPY_AND_ASSIGN(GoogleContactStoreFactory); 193 DISALLOW_COPY_AND_ASSIGN(GoogleContactStoreFactory);
193 }; 194 };
194 195
195 } // namespace contacts 196 } // namespace contacts
196 197
197 #endif // CHROME_BROWSER_CHROMEOS_CONTACTS_GOOGLE_CONTACT_STORE_H_ 198 #endif // CHROME_BROWSER_CHROMEOS_CONTACTS_GOOGLE_CONTACT_STORE_H_
OLDNEW
« 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