Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: bindings/v8/custom/V8DOMWindowCustom.cpp

Issue 155477: Dom Storage (webkit side) (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/WebCore/
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 ACCESSOR_GETTER(DOMWindowEvent) 146 ACCESSOR_GETTER(DOMWindowEvent)
147 { 147 {
148 v8::Local<v8::String> eventSymbol = v8::String::NewSymbol("event"); 148 v8::Local<v8::String> eventSymbol = v8::String::NewSymbol("event");
149 v8::Local<v8::Context> context = v8::Context::GetCurrent(); 149 v8::Local<v8::Context> context = v8::Context::GetCurrent();
150 v8::Handle<v8::Value> jsEvent = context->Global()->GetHiddenValue(eventSymbo l); 150 v8::Handle<v8::Value> jsEvent = context->Global()->GetHiddenValue(eventSymbo l);
151 if (jsEvent.IsEmpty()) 151 if (jsEvent.IsEmpty())
152 return v8::Undefined(); 152 return v8::Undefined();
153 return jsEvent; 153 return jsEvent;
154 } 154 }
155 155
156 #if ENABLE(DOM_STORAGE)
157 static bool enableLocalStorage = false;
158 static bool enableSessionStorage = false;
159
160 void V8Custom::setEnableLocalStorage(bool setting)
161 {
162 enableLocalStorage = setting;
163 }
164
165 void V8Custom::setEnableSessionStorage(bool setting)
166 {
167 enableSessionStorage = setting;
168 }
169
170 ACCESSOR_GETTER(DOMWindowLocalStorage)
171 {
172 INC_STATS("DOM.DOMWindow.localStorage._get");
173 if (!enableLocalStorage)
174 return v8::Undefined();
175 v8::Handle<v8::Object> holder = info.Holder();
176 DOMWindow* imp = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex ::DOMWINDOW, holder);
177 Storage* storage = imp->localStorage();
178 if (!storage)
179 return v8::Undefined();
180 return V8DOMWrapper::convertToV8Object(V8ClassIndex::STORAGE, storage);
181 }
182
183 ACCESSOR_GETTER(DOMWindowSessionStorage)
184 {
185 INC_STATS("DOM.DOMWindow.sessionStorage._get");
186 if (!enableSessionStorage)
187 return v8::Undefined();
188 v8::Handle<v8::Object> holder = info.Holder();
189 DOMWindow* imp = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex ::DOMWINDOW, holder);
190 Storage* storage = imp->sessionStorage();
191 if (!storage)
192 return v8::Undefined();
193 return V8DOMWrapper::convertToV8Object(V8ClassIndex::STORAGE, storage);
194 }
195 #endif
196
156 ACCESSOR_GETTER(DOMWindowCrypto) 197 ACCESSOR_GETTER(DOMWindowCrypto)
157 { 198 {
158 // FIXME: Implement me. 199 // FIXME: Implement me.
159 return v8::Undefined(); 200 return v8::Undefined();
160 } 201 }
161 202
162 ACCESSOR_SETTER(DOMWindowLocation) 203 ACCESSOR_SETTER(DOMWindowLocation)
163 { 204 {
164 v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex: :DOMWINDOW, info.This()); 205 v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex: :DOMWINDOW, info.This());
165 if (holder.IsEmpty()) 206 if (holder.IsEmpty())
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 return false; 962 return false;
922 963
923 // Allow access of GET and HAS if index is a subframe. 964 // Allow access of GET and HAS if index is a subframe.
924 if ((type == v8::ACCESS_GET || type == v8::ACCESS_HAS) && target->tree()->ch ild(index)) 965 if ((type == v8::ACCESS_GET || type == v8::ACCESS_HAS) && target->tree()->ch ild(index))
925 return true; 966 return true;
926 967
927 return V8Proxy::canAccessFrame(target, false); 968 return V8Proxy::canAccessFrame(target, false);
928 } 969 }
929 970
930 } // namespace WebCore 971 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698