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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 // Get a value for a specific key. Valid key indices are 0 through length()
- 1. | 53 // Get a value for a specific key. Valid key indices are 0 through length()
- 1. |
54 // Indexes may change on any set/removeItem call. Will return null if the in
dex | 54 // Indexes may change on any set/removeItem call. Will return null if the in
dex |
55 // provided is out of range. | 55 // provided is out of range. |
56 virtual WebString key(unsigned index) = 0; | 56 virtual WebString key(unsigned index) = 0; |
57 | 57 |
58 // Get the value that corresponds to a specific key. This returns null if th
ere is | 58 // Get the value that corresponds to a specific key. This returns null if th
ere is |
59 // no entry for that key. | 59 // no entry for that key. |
60 virtual WebString getItem(const WebString& key) = 0; | 60 virtual WebString getItem(const WebString& key) = 0; |
61 | 61 |
| 62 // Returns |true| if the the area contains a value that corresponds to |key|
. |
| 63 virtual bool containsItem(const WebString& key) { return !getItem(key).isNul
l(); } |
| 64 |
62 // Set the value that corresponds to a specific key. Result will either be R
esultOK | 65 // Set the value that corresponds to a specific key. Result will either be R
esultOK |
63 // or some particular error. The value is NOT set when there's an error. |pa
geUrl| is the | 66 // or some particular error. The value is NOT set when there's an error. |pa
geUrl| is the |
64 // url that should be used if a storage event fires. | 67 // url that should be used if a storage event fires. |
65 virtual void setItem(const WebString& key, const WebString& newValue, const
WebURL& pageUrl, Result& result) | 68 virtual void setItem(const WebString& key, const WebString& newValue, const
WebURL& pageUrl, Result& result) { } |
66 { | |
67 WebString unused; | |
68 setItem(key, newValue, pageUrl, result, unused); | |
69 } | |
70 | |
71 | 69 |
72 // Remove the value associated with a particular key. |pageUrl| is the url t
hat should be used | 70 // Remove the value associated with a particular key. |pageUrl| is the url t
hat should be used |
73 // if a storage event fires. | 71 // if a storage event fires. |
74 virtual void removeItem(const WebString& key, const WebURL& pageUrl) | 72 virtual void removeItem(const WebString& key, const WebURL& pageUrl) { } |
75 { | |
76 WebString unused; | |
77 removeItem(key, pageUrl, unused); | |
78 } | |
79 | 73 |
80 // Clear all key/value pairs. |pageUrl| is the url that should be used if a
storage event fires. | 74 // Clear all key/value pairs. |pageUrl| is the url that should be used if a
storage event fires. |
81 virtual void clear(const WebURL& pageUrl) | 75 virtual void clear(const WebURL& pageUrl) { } |
82 { | |
83 bool unused; | |
84 clear(pageUrl, unused); | |
85 } | |
86 | |
87 // DEPRECATED - being replaced by the async variants above which do not retu
rn oldValues or block until completion. | |
88 virtual void setItem(const WebString& key, const WebString& newValue, const
WebURL&, Result&, WebString& oldValue) { } | |
89 virtual void removeItem(const WebString& key, const WebURL& pageUrl, WebStri
ng& oldValue) { } | |
90 virtual void clear(const WebURL& pageUrl, bool& somethingCleared) { } | |
91 }; | 76 }; |
92 | 77 |
93 } // namespace WebKit | 78 } // namespace WebKit |
94 | 79 |
95 #endif // WebStorageArea_h | 80 #endif // WebStorageArea_h |
OLD | NEW |