OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 WEBKIT_GLUE_WEBFRAME_H_ | 5 #ifndef WEBKIT_GLUE_WEBFRAME_H_ |
6 #define WEBKIT_GLUE_WEBFRAME_H_ | 6 #define WEBKIT_GLUE_WEBFRAME_H_ |
7 | 7 |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
10 #include "skia/ext/bitmap_platform_device.h" | 10 #include "skia/ext/bitmap_platform_device.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 struct WebScriptSource; | 25 struct WebScriptSource; |
26 struct WebSize; | 26 struct WebSize; |
27 } | 27 } |
28 | 28 |
29 // Every frame in a web page is represented by one WebFrame, including the | 29 // Every frame in a web page is represented by one WebFrame, including the |
30 // outermost frame. | 30 // outermost frame. |
31 class WebFrame { | 31 class WebFrame { |
32 public: | 32 public: |
33 WebFrame() {} | 33 WebFrame() {} |
34 | 34 |
35 static WebFrame* RetrieveActiveFrame(); | 35 // The two functions below retrieve WebFrame instances relating the currently |
| 36 // executing JavaScript. Since JavaScript can make function calls across |
| 37 // frames, though, we need to be more precise. |
| 38 // |
| 39 // For example, imagine that a JS function in frame A calls a function in |
| 40 // frame B, which calls native code, which wants to know what the 'active' |
| 41 // frame is. |
| 42 // |
| 43 // The 'entered context' is the context where execution first entered the |
| 44 // script engine; the context that is at the bottom of the JS function stack. |
| 45 // RetrieveFrameForEnteredContext() would return Frame A in our example. |
| 46 // |
| 47 // The 'current context' is the context the JS engine is currently inside of; |
| 48 // the context that is at the top of the JS function stack. |
| 49 // RetrieveFrameForCurrentContext() would return Frame B in our example. |
| 50 static WebFrame* RetrieveFrameForEnteredContext(); |
| 51 static WebFrame* RetrieveFrameForCurrentContext(); |
36 | 52 |
37 // Binds a C++ class to a JavaScript property of the window object. This | 53 // Binds a C++ class to a JavaScript property of the window object. This |
38 // should generally be used via CppBoundClass::BindToJavascript() instead of | 54 // should generally be used via CppBoundClass::BindToJavascript() instead of |
39 // calling it directly. | 55 // calling it directly. |
40 virtual void BindToWindowObject(const std::wstring& name, | 56 virtual void BindToWindowObject(const std::wstring& name, |
41 NPObject* object) = 0; | 57 NPObject* object) = 0; |
42 | 58 |
43 virtual void CallJSGC() = 0; | 59 virtual void CallJSGC() = 0; |
44 | 60 |
45 // WARNING: DON'T USE THIS METHOD unless you know what it is doing. | 61 // WARNING: DON'T USE THIS METHOD unless you know what it is doing. |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 virtual int PendingFrameUnloadEventCount() const = 0; | 414 virtual int PendingFrameUnloadEventCount() const = 0; |
399 | 415 |
400 protected: | 416 protected: |
401 virtual ~WebFrame() {} | 417 virtual ~WebFrame() {} |
402 | 418 |
403 private: | 419 private: |
404 DISALLOW_COPY_AND_ASSIGN(WebFrame); | 420 DISALLOW_COPY_AND_ASSIGN(WebFrame); |
405 }; | 421 }; |
406 | 422 |
407 #endif // WEBKIT_GLUE_WEBFRAME_H_ | 423 #endif // WEBKIT_GLUE_WEBFRAME_H_ |
OLD | NEW |