| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_WEBDATA_AUTOFILL_CHANGE_H__ | 5 #ifndef CHROME_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__ |
| 6 #define CHROME_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__ | 6 #define CHROME_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__ |
| 7 | 7 |
| 8 #include <vector> |
| 9 |
| 8 #include "chrome/browser/webdata/autofill_entry.h" | 10 #include "chrome/browser/webdata/autofill_entry.h" |
| 9 | 11 |
| 10 class AutofillProfile; | 12 class AutofillProfile; |
| 11 class CreditCard; | 13 class CreditCard; |
| 12 | 14 |
| 13 // For classic Autofill form fields, the KeyType is AutofillKey. | 15 // For classic Autofill form fields, the KeyType is AutofillKey. |
| 14 // Autofill++ types such as AutofillProfile and CreditCard simply use an int. | 16 // Autofill++ types such as AutofillProfile and CreditCard simply use an int. |
| 15 template <typename KeyType> | 17 template <typename KeyType> |
| 16 class GenericAutofillChange { | 18 class GenericAutofillChange { |
| 17 public: | 19 public: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 37 | 39 |
| 38 class AutofillChange : public GenericAutofillChange<AutofillKey> { | 40 class AutofillChange : public GenericAutofillChange<AutofillKey> { |
| 39 public: | 41 public: |
| 40 AutofillChange(Type type, const AutofillKey& key); | 42 AutofillChange(Type type, const AutofillKey& key); |
| 41 virtual ~AutofillChange(); | 43 virtual ~AutofillChange(); |
| 42 bool operator==(const AutofillChange& change) const { | 44 bool operator==(const AutofillChange& change) const { |
| 43 return type() == change.type() && key() == change.key(); | 45 return type() == change.type() && key() == change.key(); |
| 44 } | 46 } |
| 45 }; | 47 }; |
| 46 | 48 |
| 49 typedef std::vector<AutofillChange> AutofillChangeList; |
| 50 |
| 47 // Change notification details for Autofill profile changes. | 51 // Change notification details for Autofill profile changes. |
| 48 class AutofillProfileChange : public GenericAutofillChange<std::string> { | 52 class AutofillProfileChange : public GenericAutofillChange<std::string> { |
| 49 public: | 53 public: |
| 50 // The |type| input specifies the change type. The |key| input is the key, | 54 // The |type| input specifies the change type. The |key| input is the key, |
| 51 // which is expected to be the GUID identifying the |profile|. | 55 // which is expected to be the GUID identifying the |profile|. |
| 52 // When |type| == ADD, |profile| should be non-NULL. | 56 // When |type| == ADD, |profile| should be non-NULL. |
| 53 // When |type| == UPDATE, |profile| should be non-NULL. | 57 // When |type| == UPDATE, |profile| should be non-NULL. |
| 54 // When |type| == REMOVE, |profile| should be NULL. | 58 // When |type| == REMOVE, |profile| should be NULL. |
| 55 AutofillProfileChange(Type type, | 59 AutofillProfileChange(Type type, |
| 56 const std::string& key, | 60 const std::string& key, |
| 57 const AutofillProfile* profile); | 61 const AutofillProfile* profile); |
| 58 virtual ~AutofillProfileChange(); | 62 virtual ~AutofillProfileChange(); |
| 59 | 63 |
| 60 const AutofillProfile* profile() const { return profile_; } | 64 const AutofillProfile* profile() const { return profile_; } |
| 61 bool operator==(const AutofillProfileChange& change) const; | 65 bool operator==(const AutofillProfileChange& change) const; |
| 62 | 66 |
| 63 private: | 67 private: |
| 64 // Weak reference, can be NULL. | 68 // Weak reference, can be NULL. |
| 65 const AutofillProfile* profile_; | 69 const AutofillProfile* profile_; |
| 66 }; | 70 }; |
| 67 | 71 |
| 68 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__ | 72 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__ |
| OLD | NEW |