| OLD | NEW |
| 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 27 matching lines...) Expand all Loading... |
| 38 class GoogleContactStore | 38 class GoogleContactStore |
| 39 : public ContactStore, | 39 : public ContactStore, |
| 40 public net::NetworkChangeNotifier::ConnectionTypeObserver { | 40 public net::NetworkChangeNotifier::ConnectionTypeObserver { |
| 41 public: | 41 public: |
| 42 class TestAPI { | 42 class TestAPI { |
| 43 public: | 43 public: |
| 44 explicit TestAPI(GoogleContactStore* store); | 44 explicit TestAPI(GoogleContactStore* store); |
| 45 ~TestAPI(); | 45 ~TestAPI(); |
| 46 | 46 |
| 47 bool update_scheduled() { return store_->update_timer_.IsRunning(); } | 47 bool update_scheduled() { return store_->update_timer_.IsRunning(); } |
| 48 | 48 base::Time last_contact_update_time() const { |
| 49 return store_->last_contact_update_time_; |
| 50 } |
| 49 void set_current_time(const base::Time& time) { | 51 void set_current_time(const base::Time& time) { |
| 50 store_->current_time_for_testing_ = time; | 52 store_->current_time_for_testing_ = time; |
| 51 } | 53 } |
| 52 | 54 |
| 53 // Takes ownership of |db|. Must be called before Init(). | 55 // Takes ownership of |db|. Must be called before Init(). |
| 54 void SetDatabase(ContactDatabaseInterface* db); | 56 void SetDatabase(ContactDatabaseInterface* db); |
| 55 | 57 |
| 56 // Takes ownership of |service|. Must be called before Init(). The caller is | 58 // Takes ownership of |service|. Must be called before Init(). The caller is |
| 57 // responsible for calling |service|'s Initialize() method. | 59 // responsible for calling |service|'s Initialize() method. |
| 58 void SetGDataService(gdata::GDataContactsServiceInterface* service); | 60 void SetGDataService(gdata::GDataContactsServiceInterface* service); |
| 59 | 61 |
| 60 // Triggers an update, similar to what happens when the update timer fires. | 62 // Triggers an update, similar to what happens when the update timer fires. |
| 61 void DoUpdate(); | 63 void DoUpdate(); |
| 62 | 64 |
| 63 // Notifies the store that the system has gone online or offline. | 65 // Notifies the store that the system has gone online or offline. |
| 64 void NotifyAboutNetworkStateChange(bool online); | 66 void NotifyAboutNetworkStateChange(bool online); |
| 65 | 67 |
| 68 // Returns pointers to all of the contacts in the store's |contacts_| |
| 69 // member. |
| 70 scoped_ptr<ContactPointers> GetLoadedContacts(); |
| 71 |
| 66 private: | 72 private: |
| 67 GoogleContactStore* store_; // not owned | 73 GoogleContactStore* store_; // not owned |
| 68 | 74 |
| 69 DISALLOW_COPY_AND_ASSIGN(TestAPI); | 75 DISALLOW_COPY_AND_ASSIGN(TestAPI); |
| 70 }; | 76 }; |
| 71 | 77 |
| 72 explicit GoogleContactStore(Profile* profile); | 78 explicit GoogleContactStore(Profile* profile); |
| 73 virtual ~GoogleContactStore(); | 79 virtual ~GoogleContactStore(); |
| 74 | 80 |
| 75 // ContactStore implementation: | 81 // ContactStore implementation: |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 virtual bool CanCreateContactStoreForProfile(Profile* profile) OVERRIDE; | 189 virtual bool CanCreateContactStoreForProfile(Profile* profile) OVERRIDE; |
| 184 virtual ContactStore* CreateContactStore(Profile* profile) OVERRIDE; | 190 virtual ContactStore* CreateContactStore(Profile* profile) OVERRIDE; |
| 185 | 191 |
| 186 private: | 192 private: |
| 187 DISALLOW_COPY_AND_ASSIGN(GoogleContactStoreFactory); | 193 DISALLOW_COPY_AND_ASSIGN(GoogleContactStoreFactory); |
| 188 }; | 194 }; |
| 189 | 195 |
| 190 } // namespace contacts | 196 } // namespace contacts |
| 191 | 197 |
| 192 #endif // CHROME_BROWSER_CHROMEOS_CONTACTS_GOOGLE_CONTACT_STORE_H_ | 198 #endif // CHROME_BROWSER_CHROMEOS_CONTACTS_GOOGLE_CONTACT_STORE_H_ |
| OLD | NEW |