OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 enum Result { | 45 enum Result { |
46 ResultOK = 0, | 46 ResultOK = 0, |
47 ResultBlockedByQuota, | 47 ResultBlockedByQuota, |
48 ResultLast = ResultBlockedByQuota | 48 ResultLast = ResultBlockedByQuota |
49 }; | 49 }; |
50 | 50 |
51 // The number of key/value pairs in the storage area. | 51 // The number of key/value pairs in the storage area. |
52 virtual unsigned length() = 0; | 52 virtual unsigned length() = 0; |
53 | 53 |
54 // Get a value for a specific key. Valid key indices are 0 through length() -
1. | 54 // Get a value for a specific key. Valid key indices are 0 through |
55 // Indexes may change on any set/removeItem call. Will return null if the inde
x | 55 // length() - 1. Indexes may change on any set/removeItem call. Will return |
56 // provided is out of range. | 56 // null if the index provided is out of range. |
57 virtual WebString key(unsigned index) = 0; | 57 virtual WebString key(unsigned index) = 0; |
58 | 58 |
59 // Get the value that corresponds to a specific key. This returns null if ther
e is | 59 // Get the value that corresponds to a specific key. This returns null if |
60 // no entry for that key. | 60 // there is no entry for that key. |
61 virtual WebString getItem(const WebString& key) = 0; | 61 virtual WebString getItem(const WebString& key) = 0; |
62 | 62 |
63 // Set the value that corresponds to a specific key. Result will either be Res
ultOK | 63 // Set the value that corresponds to a specific key. Result will either be |
64 // or some particular error. The value is NOT set when there's an error. |page
Url| is the | 64 // ResultOK or some particular error. The value is NOT set when there's an |
65 // url that should be used if a storage event fires. | 65 // error. |pageUrl| is the url that should be used if a storage event fires. |
66 virtual void setItem(const WebString& key, | 66 virtual void setItem(const WebString& key, |
67 const WebString& newValue, | 67 const WebString& newValue, |
68 const WebURL& pageUrl, | 68 const WebURL& pageUrl, |
69 Result& result) { | 69 Result& result) { |
70 WebString unused; | 70 WebString unused; |
71 setItem(key, newValue, pageUrl, result, unused); | 71 setItem(key, newValue, pageUrl, result, unused); |
72 } | 72 } |
73 | 73 |
74 // Remove the value associated with a particular key. |pageUrl| is the url tha
t should be used | 74 // Remove the value associated with a particular key. |pageUrl| is the url |
75 // if a storage event fires. | 75 // that should be used if a storage event fires. |
76 virtual void removeItem(const WebString& key, const WebURL& pageUrl) { | 76 virtual void removeItem(const WebString& key, const WebURL& pageUrl) { |
77 WebString unused; | 77 WebString unused; |
78 removeItem(key, pageUrl, unused); | 78 removeItem(key, pageUrl, unused); |
79 } | 79 } |
80 | 80 |
81 // Clear all key/value pairs. |pageUrl| is the url that should be used if a st
orage event fires. | 81 // Clear all key/value pairs. |pageUrl| is the url that should be used if a |
| 82 // storage event fires. |
82 virtual void clear(const WebURL& pageUrl) { | 83 virtual void clear(const WebURL& pageUrl) { |
83 bool unused; | 84 bool unused; |
84 clear(pageUrl, unused); | 85 clear(pageUrl, unused); |
85 } | 86 } |
86 | 87 |
87 // DEPRECATED - being replaced by the async variants above which do not return
oldValues or block until completion. | 88 // DEPRECATED - being replaced by the async variants above which do not return |
| 89 // oldValues or block until completion. |
88 virtual void setItem(const WebString& key, | 90 virtual void setItem(const WebString& key, |
89 const WebString& newValue, | 91 const WebString& newValue, |
90 const WebURL&, | 92 const WebURL&, |
91 Result&, | 93 Result&, |
92 WebString& oldValue) {} | 94 WebString& oldValue) {} |
93 virtual void removeItem(const WebString& key, | 95 virtual void removeItem(const WebString& key, |
94 const WebURL& pageUrl, | 96 const WebURL& pageUrl, |
95 WebString& oldValue) {} | 97 WebString& oldValue) {} |
96 virtual void clear(const WebURL& pageUrl, bool& somethingCleared) {} | 98 virtual void clear(const WebURL& pageUrl, bool& somethingCleared) {} |
97 }; | 99 }; |
98 | 100 |
99 } // namespace blink | 101 } // namespace blink |
100 | 102 |
101 #endif // WebStorageArea_h | 103 #endif // WebStorageArea_h |
OLD | NEW |