OLD | NEW |
1 // Copyright (c) 2008, Google Inc. | 1 // Copyright (c) 2008, Google Inc. |
2 // All rights reserved. | 2 // 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 }; | 73 }; |
74 | 74 |
75 | 75 |
76 namespace WebCore { | 76 namespace WebCore { |
77 | 77 |
78 void ScriptController::setFlags(const char* str, int length) | 78 void ScriptController::setFlags(const char* str, int length) |
79 { | 79 { |
80 v8::V8::SetFlagsFromString(str, length); | 80 v8::V8::SetFlagsFromString(str, length); |
81 } | 81 } |
82 | 82 |
83 Frame* ScriptController::retrieveActiveFrame() | 83 Frame* ScriptController::retrieveFrameForEnteredContext() |
84 { | 84 { |
85 return V8Proxy::retrieveActiveFrame(); | 85 return V8Proxy::retrieveFrameForEnteredContext(); |
| 86 } |
| 87 |
| 88 Frame* ScriptController::retrieveFrameForCurrentContext() |
| 89 { |
| 90 return V8Proxy::retrieveFrameForCurrentContext(); |
86 } | 91 } |
87 | 92 |
88 bool ScriptController::isSafeScript(Frame* target) | 93 bool ScriptController::isSafeScript(Frame* target) |
89 { | 94 { |
90 return V8Proxy::CanAccessFrame(target, true); | 95 return V8Proxy::CanAccessFrame(target, true); |
91 } | 96 } |
92 | 97 |
93 void ScriptController::gcProtectJSWrapper(void* dom_object) | 98 void ScriptController::gcProtectJSWrapper(void* dom_object) |
94 { | 99 { |
95 V8Proxy::GCProtect(dom_object); | 100 V8Proxy::GCProtect(dom_object); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 153 } |
149 | 154 |
150 // Disconnect the proxy from its owner frame; | 155 // Disconnect the proxy from its owner frame; |
151 void ScriptController::disconnectFrame() | 156 void ScriptController::disconnectFrame() |
152 { | 157 { |
153 m_proxy->disconnectFrame(); | 158 m_proxy->disconnectFrame(); |
154 } | 159 } |
155 | 160 |
156 bool ScriptController::processingUserGesture() const | 161 bool ScriptController::processingUserGesture() const |
157 { | 162 { |
158 Frame* active_frame = V8Proxy::retrieveActiveFrame(); | 163 Frame* active_frame = V8Proxy::retrieveFrameForEnteredContext(); |
159 // No script is running, must be run by users. | 164 // No script is running, must be run by users. |
160 if (!active_frame) | 165 if (!active_frame) |
161 return true; | 166 return true; |
162 | 167 |
163 V8Proxy* active_proxy = active_frame->script()->proxy(); | 168 V8Proxy* active_proxy = active_frame->script()->proxy(); |
164 | 169 |
165 v8::HandleScope handle_scope; | 170 v8::HandleScope handle_scope; |
166 v8::Handle<v8::Context> context = V8Proxy::GetContext(active_frame); | 171 v8::Handle<v8::Context> context = V8Proxy::GetContext(active_frame); |
167 // TODO(fqian): find all cases context can be empty: | 172 // TODO(fqian): find all cases context can be empty: |
168 // 1) JS is disabled; | 173 // 1) JS is disabled; |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 { | 424 { |
420 notImplemented(); | 425 notImplemented(); |
421 } | 426 } |
422 | 427 |
423 void ScriptController::updateDocument() | 428 void ScriptController::updateDocument() |
424 { | 429 { |
425 m_proxy->updateDocument(); | 430 m_proxy->updateDocument(); |
426 } | 431 } |
427 | 432 |
428 } // namespace WebCpre | 433 } // namespace WebCpre |
OLD | NEW |