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

Side by Side Diff: Source/bindings/v8/V8WindowShell.h

Issue 17031006: Rename DOMWindow interface to Window (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/V8Initializer.cpp ('k') | Source/bindings/v8/V8WindowShell.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 * copyright notice, this list of conditions and the following disclaimer 11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the 12 * in the documentation and/or other materials provided with the
13 * distribution. 13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its 14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from 15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission. 16 * this software without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef V8DOMWindowShell_h 31 #ifndef V8WindowShell_h
32 #define V8DOMWindowShell_h 32 #define V8WindowShell_h
33 33
34 #include "bindings/v8/DOMWrapperWorld.h" 34 #include "bindings/v8/DOMWrapperWorld.h"
35 #include "bindings/v8/ScopedPersistent.h" 35 #include "bindings/v8/ScopedPersistent.h"
36 #include "bindings/v8/V8PerContextData.h" 36 #include "bindings/v8/V8PerContextData.h"
37 #include "bindings/v8/WrapperTypeInfo.h" 37 #include "bindings/v8/WrapperTypeInfo.h"
38 #include "weborigin/SecurityOrigin.h" 38 #include "weborigin/SecurityOrigin.h"
39 #include <v8.h>
40 #include "wtf/Forward.h" 39 #include "wtf/Forward.h"
41 #include "wtf/HashMap.h" 40 #include "wtf/HashMap.h"
42 #include "wtf/PassRefPtr.h" 41 #include "wtf/PassRefPtr.h"
43 #include "wtf/RefCounted.h" 42 #include "wtf/RefCounted.h"
44 #include "wtf/RefPtr.h" 43 #include "wtf/RefPtr.h"
45 #include "wtf/text/AtomicString.h" 44 #include "wtf/text/AtomicString.h"
45 #include <v8.h>
46 46
47 namespace WebCore { 47 namespace WebCore {
48 48
49 class DOMWindow; 49 class DOMWindow;
50 class Frame; 50 class Frame;
51 class HTMLDocument; 51 class HTMLDocument;
52 52
53 // V8WindowShell represents all the per-global object state for a Frame that 53 // V8WindowShell represents all the per-global object state for a Frame that
54 // persist between navigations. 54 // persist between navigations.
55 class V8DOMWindowShell { 55 class V8WindowShell {
56 public: 56 public:
57 static PassOwnPtr<V8DOMWindowShell> create(Frame*, PassRefPtr<DOMWrapperWorl d>, v8::Isolate*); 57 static PassOwnPtr<V8WindowShell> create(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*);
58 58
59 v8::Local<v8::Context> context() const { return v8::Local<v8::Context>::New( m_context.get()); } 59 v8::Local<v8::Context> context() const { return v8::Local<v8::Context>::New( m_context.get()); }
60 60
61 // Update document object of the frame. 61 // Update document object of the frame.
62 void updateDocument(); 62 void updateDocument();
63 63
64 void namedItemAdded(HTMLDocument*, const AtomicString&); 64 void namedItemAdded(HTMLDocument*, const AtomicString&);
65 void namedItemRemoved(HTMLDocument*, const AtomicString&); 65 void namedItemRemoved(HTMLDocument*, const AtomicString&);
66 66
67 // Update the security origin of a document 67 // Update the security origin of a document
68 // (e.g., after setting docoument.domain). 68 // (e.g., after setting docoument.domain).
69 void updateSecurityOrigin(); 69 void updateSecurityOrigin();
70 70
71 bool isContextInitialized() { return !m_context.isEmpty(); } 71 bool isContextInitialized() { return !m_context.isEmpty(); }
72 bool isGlobalInitialized() { return !m_global.isEmpty(); } 72 bool isGlobalInitialized() { return !m_global.isEmpty(); }
73 73
74 bool initializeIfNeeded(); 74 bool initializeIfNeeded();
75 void updateDocumentWrapper(v8::Handle<v8::Object> wrapper); 75 void updateDocumentWrapper(v8::Handle<v8::Object> wrapper);
76 76
77 void clearForNavigation(); 77 void clearForNavigation();
78 void clearForClose(bool destroyGlobal); 78 void clearForClose(bool destroyGlobal);
79 79
80 DOMWrapperWorld* world() { return m_world.get(); } 80 DOMWrapperWorld* world() { return m_world.get(); }
81 81
82 private: 82 private:
83 V8DOMWindowShell(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*); 83 V8WindowShell(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*);
84 84
85 void disposeContext(); 85 void disposeContext();
86 86
87 void setSecurityToken(); 87 void setSecurityToken();
88 88
89 // The JavaScript wrapper for the document object is cached on the global 89 // The JavaScript wrapper for the document object is cached on the global
90 // object for fast access. UpdateDocumentProperty sets the wrapper 90 // object for fast access. UpdateDocumentProperty sets the wrapper
91 // for the current document on the global object. ClearDocumentProperty 91 // for the current document on the global object. ClearDocumentProperty
92 // deletes the document wrapper from the global object. 92 // deletes the document wrapper from the global object.
93 void updateDocumentProperty(); 93 void updateDocumentProperty();
94 void clearDocumentProperty(); 94 void clearDocumentProperty();
95 95
96 void createContext(); 96 void createContext();
97 bool installDOMWindow(); 97 bool installDOMWindow();
98 98
99 static V8DOMWindowShell* enteredIsolatedWorldContext(); 99 static V8WindowShell* enteredIsolatedWorldContext();
100 100
101 Frame* m_frame; 101 Frame* m_frame;
102 RefPtr<DOMWrapperWorld> m_world; 102 RefPtr<DOMWrapperWorld> m_world;
103 v8::Isolate* m_isolate; 103 v8::Isolate* m_isolate;
104 104
105 OwnPtr<V8PerContextData> m_perContextData; 105 OwnPtr<V8PerContextData> m_perContextData;
106 106
107 ScopedPersistent<v8::Context> m_context; 107 ScopedPersistent<v8::Context> m_context;
108 ScopedPersistent<v8::Object> m_global; 108 ScopedPersistent<v8::Object> m_global;
109 ScopedPersistent<v8::Object> m_document; 109 ScopedPersistent<v8::Object> m_document;
110 }; 110 };
111 111
112 } // namespace WebCore 112 } // namespace WebCore
113 113
114 #endif // V8DOMWindowShell_h 114 #endif // V8WindowShell_h
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8Initializer.cpp ('k') | Source/bindings/v8/V8WindowShell.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698