| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 GoogleContactStore* store_; // not owned | 60 GoogleContactStore* store_; // not owned |
| 61 | 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(TestAPI); | 62 DISALLOW_COPY_AND_ASSIGN(TestAPI); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 explicit GoogleContactStore(Profile* profile); | 65 explicit GoogleContactStore(Profile* profile); |
| 66 virtual ~GoogleContactStore(); | 66 virtual ~GoogleContactStore(); |
| 67 | 67 |
| 68 void Init(); | |
| 69 | |
| 70 // ContactStore implementation: | 68 // ContactStore implementation: |
| 69 virtual void Init() OVERRIDE; |
| 71 virtual void AppendContacts(ContactPointers* contacts_out) OVERRIDE; | 70 virtual void AppendContacts(ContactPointers* contacts_out) OVERRIDE; |
| 72 virtual const Contact* GetContactByProviderId( | 71 virtual const Contact* GetContactByProviderId( |
| 73 const std::string& provider_id) OVERRIDE; | 72 const std::string& provider_id) OVERRIDE; |
| 74 virtual void AddObserver(ContactStoreObserver* observer) OVERRIDE; | 73 virtual void AddObserver(ContactStoreObserver* observer) OVERRIDE; |
| 75 virtual void RemoveObserver(ContactStoreObserver* observer) OVERRIDE; | 74 virtual void RemoveObserver(ContactStoreObserver* observer) OVERRIDE; |
| 76 | 75 |
| 77 private: | 76 private: |
| 78 // Map from a contact's Google-assigned ID to the contact itself. | 77 // Map from a contact's Google-assigned ID to the contact itself. |
| 79 typedef std::map<std::string, Contact*> ContactMap; | 78 typedef std::map<std::string, Contact*> ContactMap; |
| 80 | 79 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // needed. | 154 // needed. |
| 156 base::Time current_time_for_testing_; | 155 base::Time current_time_for_testing_; |
| 157 | 156 |
| 158 // Note: This should remain the last member so it'll be destroyed and | 157 // Note: This should remain the last member so it'll be destroyed and |
| 159 // invalidate its weak pointers before any other members are destroyed. | 158 // invalidate its weak pointers before any other members are destroyed. |
| 160 base::WeakPtrFactory<GoogleContactStore> weak_ptr_factory_; | 159 base::WeakPtrFactory<GoogleContactStore> weak_ptr_factory_; |
| 161 | 160 |
| 162 DISALLOW_COPY_AND_ASSIGN(GoogleContactStore); | 161 DISALLOW_COPY_AND_ASSIGN(GoogleContactStore); |
| 163 }; | 162 }; |
| 164 | 163 |
| 164 // ContactStoreFactory implementation that returns GoogleContactStores. |
| 165 class GoogleContactStoreFactory : public ContactStoreFactory { |
| 166 public: |
| 167 GoogleContactStoreFactory(); |
| 168 virtual ~GoogleContactStoreFactory(); |
| 169 |
| 170 // ContactStoreFactory implementation: |
| 171 virtual bool CanCreateContactStoreForProfile(Profile* profile) OVERRIDE; |
| 172 virtual ContactStore* CreateContactStore(Profile* profile) OVERRIDE; |
| 173 |
| 174 private: |
| 175 DISALLOW_COPY_AND_ASSIGN(GoogleContactStoreFactory); |
| 176 }; |
| 177 |
| 165 } // namespace contacts | 178 } // namespace contacts |
| 166 | 179 |
| 167 #endif // CHROME_BROWSER_CHROMEOS_CONTACTS_GOOGLE_CONTACT_STORE_H_ | 180 #endif // CHROME_BROWSER_CHROMEOS_CONTACTS_GOOGLE_CONTACT_STORE_H_ |
| OLD | NEW |