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

Side by Side Diff: webkit/port/bindings/v8/v8_proxy.h

Issue 10687: Clean up the proxy code for handling frame navigation.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 V8_PROXY_H__ 5 #ifndef V8_PROXY_H__
6 #define V8_PROXY_H__ 6 #define V8_PROXY_H__
7 7
8 #include <v8.h> 8 #include <v8.h>
9 #include "v8_index.h" 9 #include "v8_index.h"
10 #include "v8_custom.h" 10 #include "v8_custom.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 : m_frame(frame), m_inlineCode(false), 157 : m_frame(frame), m_inlineCode(false),
158 m_timerCallback(false), m_recursion(0) { } 158 m_timerCallback(false), m_recursion(0) { }
159 159
160 ~V8Proxy(); 160 ~V8Proxy();
161 161
162 Frame* frame() { return m_frame; } 162 Frame* frame() { return m_frame; }
163 163
164 // Clear page-specific data, but keep the global object identify. 164 // Clear page-specific data, but keep the global object identify.
165 void clearForNavigation(); 165 void clearForNavigation();
166 166
167 // Clear data before closing the frame. 167 // Clear page-specific data before shutting down the proxy object.
168 void clearForClose(); 168 void clearForClose();
169 169
170 // Notify that a new DOMWindow object is ready. 170 // Update document object of the frame.
171 void domWindowReady(); 171 void updateDocument();
172 172
173 // Destroy the global object. 173 // Destroy the global object.
174 void DestroyGlobal(); 174 void DestroyGlobal();
175 175
176 // TODO(mpcomplete): Need comment. User Gesture related. 176 // TODO(mpcomplete): Need comment. User Gesture related.
177 bool inlineCode() const { return m_inlineCode; } 177 bool inlineCode() const { return m_inlineCode; }
178 void setInlineCode(bool value) { m_inlineCode = value; } 178 void setInlineCode(bool value) { m_inlineCode = value; }
179 179
180 bool timerCallback() const { return m_timerCallback; } 180 bool timerCallback() const { return m_timerCallback; }
181 void setTimerCallback(bool value) { m_timerCallback = value; } 181 void setTimerCallback(bool value) { m_timerCallback = value; }
182 182
183 // Has the context for this proxy been initialized? 183 // Has the context for this proxy been initialized?
184 bool ContextInitialized(); 184 bool ContextInitialized();
185 185
186 // Disconnects the proxy from its owner frame, 186 // Disconnects the proxy from its owner frame,
187 // and clears all timeouts on the DOM window. 187 // and clears all timeouts on the DOM window.
188 void disconnectFrame(); 188 void disconnectFrame();
189 189
190 bool isEnabled(); 190 bool isEnabled();
191 191
192 // Remove 'document' property from the global object.
193 void clearDocumentWrapper();
194
195 // Find/Create/Remove event listener wrappers. 192 // Find/Create/Remove event listener wrappers.
196 PassRefPtr<V8EventListener> FindV8EventListener(v8::Local<v8::Value> listener, 193 PassRefPtr<V8EventListener> FindV8EventListener(v8::Local<v8::Value> listener,
197 bool html); 194 bool html);
198 PassRefPtr<V8EventListener> FindOrCreateV8EventListener(v8::Local<v8::Value> l istener, 195 PassRefPtr<V8EventListener> FindOrCreateV8EventListener(v8::Local<v8::Value> l istener,
199 bool html); 196 bool html);
200 197
201 PassRefPtr<V8EventListener> FindObjectEventListener(v8::Local<v8::Value> liste ner, 198 PassRefPtr<V8EventListener> FindObjectEventListener(v8::Local<v8::Value> liste ner,
202 bool html); 199 bool html);
203 PassRefPtr<V8EventListener> FindOrCreateObjectEventListener(v8::Local<v8::Valu e> listener, 200 PassRefPtr<V8EventListener> FindOrCreateObjectEventListener(v8::Local<v8::Valu e> listener,
204 bool html); 201 bool html);
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 v8::Persistent<v8::Value> handle); 411 v8::Persistent<v8::Value> handle);
415 #endif 412 #endif
416 413
417 // Check whether a V8 value is a wrapper of type |classType|. 414 // Check whether a V8 value is a wrapper of type |classType|.
418 static bool IsWrapperOfType(v8::Handle<v8::Value> obj, 415 static bool IsWrapperOfType(v8::Handle<v8::Value> obj,
419 V8ClassIndex::V8WrapperType classType); 416 V8ClassIndex::V8WrapperType classType);
420 417
421 private: 418 private:
422 void initContextIfNeeded(); 419 void initContextIfNeeded();
423 void DisconnectEventListeners(); 420 void DisconnectEventListeners();
421 void SetSecurityToken();
424 422
425 static bool CanAccessPrivate(DOMWindow* target); 423 static bool CanAccessPrivate(DOMWindow* target);
426 424
427 // Check whether a V8 value is a DOM Event wrapper 425 // Check whether a V8 value is a DOM Event wrapper
428 static bool IsDOMEventWrapper(v8::Handle<v8::Value> obj); 426 static bool IsDOMEventWrapper(v8::Handle<v8::Value> obj);
429 427
430 static void* ToNativeObjectImpl(V8ClassIndex::V8WrapperType type, 428 static void* ToNativeObjectImpl(V8ClassIndex::V8WrapperType type,
431 v8::Handle<v8::Value> object); 429 v8::Handle<v8::Value> object);
432 430
433 // Take C pointer out of a v8 wrapper 431 // Take C pointer out of a v8 wrapper
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 475
478 #if ENABLE(XPATH) 476 #if ENABLE(XPATH)
479 static const char* GetXPathExceptionName(int exception_code); 477 static const char* GetXPathExceptionName(int exception_code);
480 #endif 478 #endif
481 479
482 #if ENABLE(SVG) 480 #if ENABLE(SVG)
483 static V8ClassIndex::V8WrapperType GetSVGElementType(SVGElement* elm); 481 static V8ClassIndex::V8WrapperType GetSVGElementType(SVGElement* elm);
484 static const char* GetSVGExceptionName(int exception_code); 482 static const char* GetSVGExceptionName(int exception_code);
485 #endif 483 #endif
486 484
487 // Update m_document field, dispose old one and create a string reference
488 // to the new one.
489 void UpdateDocumentHandle(v8::Local<v8::Object> handle);
490
491 // Returns a local handle of the context. 485 // Returns a local handle of the context.
492 v8::Local<v8::Context> GetContext() { 486 v8::Local<v8::Context> GetContext() {
493 return v8::Local<v8::Context>::New(m_context); 487 return v8::Local<v8::Context>::New(m_context);
494 } 488 }
495 489
496 Frame* m_frame; 490 Frame* m_frame;
497 v8::Persistent<v8::Context> m_context; 491 v8::Persistent<v8::Context> m_context;
498 v8::Persistent<v8::Object> m_global; 492 v8::Persistent<v8::Object> m_global;
499 493
500 // Special handling of document wrapper;
501 v8::Persistent<v8::Object> m_document;
502
503 int m_handlerLineno; 494 int m_handlerLineno;
504 495
505 // A list of event listeners created for this frame, 496 // A list of event listeners created for this frame,
506 // the list gets cleared when removing all timeouts. 497 // the list gets cleared when removing all timeouts.
507 V8EventListenerList m_event_listeners; 498 V8EventListenerList m_event_listeners;
508 499
509 // A list of event listeners create for XMLHttpRequest object for this frame, 500 // A list of event listeners create for XMLHttpRequest object for this frame,
510 // the list gets cleared when removing all timeouts. 501 // the list gets cleared when removing all timeouts.
511 V8EventListenerList m_xhr_listeners; 502 V8EventListenerList m_xhr_listeners;
512 503
(...skipping 26 matching lines...) Expand all
539 V8Proxy::SetDOMWrapper(args.Holder(), tag, obj.get()); 530 V8Proxy::SetDOMWrapper(args.Holder(), tag, obj.get());
540 V8Proxy::SetJSWrapperForDOMObject( 531 V8Proxy::SetJSWrapperForDOMObject(
541 obj.get(), v8::Persistent<v8::Object>::New(args.Holder())); 532 obj.get(), v8::Persistent<v8::Object>::New(args.Holder()));
542 return args.Holder(); 533 return args.Holder();
543 } 534 }
544 535
545 } // namespace WebCore 536 } // namespace WebCore
546 537
547 #endif // V8_PROXY_H__ 538 #endif // V8_PROXY_H__
548 539
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698