Revert 168224 - Update V8 to version 3.15.4.
[chromium-blink-merge.git] / chrome / browser / chromeos / contacts / contact_store.h
blobd9de02756fd3731bdc1e7bd3a62591f4f9f3ca40
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_CONTACTS_CONTACT_STORE_H_
6 #define CHROME_BROWSER_CHROMEOS_CONTACTS_CONTACT_STORE_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
13 class Profile;
15 namespace contacts {
17 class Contact;
18 typedef std::vector<const Contact*> ContactPointers;
19 class ContactStoreObserver;
21 // Interface for classes that store contacts from a particular source.
22 class ContactStore {
23 public:
24 ContactStore() {}
25 virtual ~ContactStore() {}
27 // Initializes the object.
28 virtual void Init() = 0;
30 // Appends all (non-deleted) contacts to |contacts_out|.
31 virtual void AppendContacts(ContactPointers* contacts_out) = 0;
33 // Returns the contact identified by |contact_id|.
34 // NULL is returned if the contact doesn't exist.
35 virtual const Contact* GetContactById(const std::string& contact_id) = 0;
37 // Adds or removes an observer.
38 virtual void AddObserver(ContactStoreObserver* observer) = 0;
39 virtual void RemoveObserver(ContactStoreObserver* observer) = 0;
41 private:
42 DISALLOW_COPY_AND_ASSIGN(ContactStore);
45 // Interface for factories that return ContactStore objects of a given type.
46 class ContactStoreFactory {
47 public:
48 ContactStoreFactory() {}
49 virtual ~ContactStoreFactory() {}
51 // Does |profile| support this type of ContactStore?
52 virtual bool CanCreateContactStoreForProfile(Profile* profile) = 0;
54 // Creates and returns a new, uninitialized ContactStore for |profile|.
55 // CanCreateContactStoreForProfile() should be called first.
56 // TODO(derat): Figure out how this should work if/when there are other
57 // ContactStore implementations that need additional information beyond the
58 // stuff contained in a Profile.
59 virtual ContactStore* CreateContactStore(Profile* profile) = 0;
61 private:
62 DISALLOW_COPY_AND_ASSIGN(ContactStoreFactory);
65 } // namespace contacts
67 #endif // CHROME_BROWSER_CHROMEOS_CONTACTS_CONTACT_STORE_H_