| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_CONTACTS_CONTACT_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_CONTACTS_CONTACT_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/time.h" | |
| 13 #include "third_party/skia/include/core/SkBitmap.h" | |
| 14 | |
| 15 namespace contacts { | |
| 16 | |
| 17 // Struct representing a contact, roughly based on the GData Contact kind: | |
| 18 // https://developers.google.com/gdata/docs/2.0/elements#gdContactKind | |
| 19 // All strings are UTF-8. | |
| 20 struct Contact { | |
| 21 // Describes an address-like field's type. | |
| 22 struct AddressType { | |
| 23 enum Relation { | |
| 24 RELATION_HOME = 0, | |
| 25 RELATION_WORK = 1, | |
| 26 RELATION_MOBILE = 2, | |
| 27 RELATION_OTHER = 3, | |
| 28 }; | |
| 29 | |
| 30 AddressType(); | |
| 31 Relation relation; | |
| 32 std::string label; | |
| 33 }; | |
| 34 | |
| 35 struct EmailAddress { | |
| 36 EmailAddress(); | |
| 37 std::string address; | |
| 38 AddressType type; | |
| 39 bool primary; | |
| 40 }; | |
| 41 | |
| 42 struct PhoneNumber { | |
| 43 PhoneNumber(); | |
| 44 std::string number; | |
| 45 AddressType type; | |
| 46 bool primary; | |
| 47 }; | |
| 48 | |
| 49 struct PostalAddress { | |
| 50 PostalAddress(); | |
| 51 std::string address; | |
| 52 AddressType type; | |
| 53 bool primary; | |
| 54 }; | |
| 55 | |
| 56 struct InstantMessagingAddress { | |
| 57 // Taken from https://developers.google.com/gdata/docs/2.0/elements#gdIm. | |
| 58 enum Protocol { | |
| 59 PROTOCOL_AIM = 0, | |
| 60 PROTOCOL_MSN = 1, | |
| 61 PROTOCOL_YAHOO = 2, | |
| 62 PROTOCOL_SKYPE = 3, | |
| 63 PROTOCOL_QQ = 4, | |
| 64 PROTOCOL_GOOGLE_TALK = 5, | |
| 65 PROTOCOL_ICQ = 6, | |
| 66 PROTOCOL_JABBER = 7, | |
| 67 PROTOCOL_OTHER = 8, | |
| 68 }; | |
| 69 | |
| 70 InstantMessagingAddress(); | |
| 71 std::string address; | |
| 72 Protocol protocol; | |
| 73 AddressType type; | |
| 74 bool primary; | |
| 75 }; | |
| 76 | |
| 77 Contact(); | |
| 78 ~Contact(); | |
| 79 | |
| 80 int64 serialized_update_time() const { | |
| 81 return update_time.ToInternalValue(); | |
| 82 } | |
| 83 void set_serialized_update_time(int64 serialized) { | |
| 84 update_time = base::Time::FromInternalValue(serialized); | |
| 85 } | |
| 86 | |
| 87 // NOTE: Any changes to the below fields must be reflected in | |
| 88 // contact_test_util.cc's CopyContact() function. | |
| 89 | |
| 90 // Provider-assigned unique identifier. | |
| 91 std::string provider_id; | |
| 92 | |
| 93 // Last time at which this contact was updated. | |
| 94 base::Time update_time; | |
| 95 | |
| 96 // Has the contact been deleted? | |
| 97 bool deleted; | |
| 98 | |
| 99 // Taken from https://developers.google.com/gdata/docs/2.0/elements#gdName. | |
| 100 std::string full_name; | |
| 101 std::string given_name; | |
| 102 std::string additional_name; | |
| 103 std::string family_name; | |
| 104 std::string name_prefix; | |
| 105 std::string name_suffix; | |
| 106 | |
| 107 SkBitmap photo; | |
| 108 | |
| 109 std::vector<EmailAddress> email_addresses; | |
| 110 std::vector<PhoneNumber> phone_numbers; | |
| 111 std::vector<PostalAddress> postal_addresses; | |
| 112 std::vector<InstantMessagingAddress> instant_messaging_addresses; | |
| 113 | |
| 114 DISALLOW_COPY_AND_ASSIGN(Contact); | |
| 115 }; | |
| 116 | |
| 117 typedef std::vector<const Contact*> ContactPointers; | |
| 118 | |
| 119 } // namespace contacts | |
| 120 | |
| 121 #endif // CHROME_BROWSER_CHROMEOS_CONTACTS_CONTACT_H_ | |
| OLD | NEW |