1 // Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
13 // * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
30 // ---------------------------------------------------------------------------
32 // The contents of this file must follow a specific format in order to
33 // support the CEF translator tool. See the translator.README.txt file in the
34 // tools directory for more information.
37 #ifndef CEF_INCLUDE_CEF_FRAME_H_
38 #define CEF_INCLUDE_CEF_FRAME_H_
41 #include "include/cef_base.h"
42 #include "include/cef_dom.h"
43 #include "include/cef_request.h"
44 #include "include/cef_stream.h"
45 #include "include/cef_string_visitor.h"
51 // Class used to represent a frame in the browser window. When used in the
52 // browser process the methods of this class may be called on any thread unless
53 // otherwise indicated in the comments. When used in the render process the
54 // methods of this class may only be called on the main thread.
56 /*--cef(source=library)--*/
57 class CefFrame : public virtual CefBase {
60 // True if this object is currently attached to a valid frame.
63 virtual bool IsValid() =0;
66 // Execute undo in this frame.
69 virtual void Undo() =0;
72 // Execute redo in this frame.
75 virtual void Redo() =0;
78 // Execute cut in this frame.
81 virtual void Cut() =0;
84 // Execute copy in this frame.
87 virtual void Copy() =0;
90 // Execute paste in this frame.
93 virtual void Paste() =0;
96 // Execute delete in this frame.
98 /*--cef(capi_name=del)--*/
99 virtual void Delete() =0;
102 // Execute select all in this frame.
105 virtual void SelectAll() =0;
108 // Save this frame's HTML source to a temporary file and open it in the
109 // default text viewing application. This method can only be called from the
113 virtual void ViewSource() =0;
116 // Retrieve this frame's HTML source as a string sent to the specified
120 virtual void GetSource(CefRefPtr<CefStringVisitor> visitor) =0;
123 // Retrieve this frame's display text as a string sent to the specified
127 virtual void GetText(CefRefPtr<CefStringVisitor> visitor) =0;
130 // Load the request represented by the |request| object.
133 virtual void LoadRequest(CefRefPtr<CefRequest> request) =0;
136 // Load the specified |url|.
139 virtual void LoadURL(const CefString& url) =0;
142 // Load the contents of |string_val| with the specified dummy |url|. |url|
143 // should have a standard scheme (for example, http scheme) or behaviors like
144 // link clicks and web security restrictions may not behave as expected.
147 virtual void LoadString(const CefString& string_val,
148 const CefString& url) =0;
151 // Execute a string of JavaScript code in this frame. The |script_url|
152 // parameter is the URL where the script in question can be found, if any.
153 // The renderer may request this URL to show the developer the source of the
154 // error. The |start_line| parameter is the base line number to use for error
157 /*--cef(optional_param=script_url)--*/
158 virtual void ExecuteJavaScript(const CefString& code,
159 const CefString& script_url,
163 // Returns true if this is the main (top-level) frame.
166 virtual bool IsMain() =0;
169 // Returns true if this is the focused frame.
172 virtual bool IsFocused() =0;
175 // Returns the name for this frame. If the frame has an assigned name (for
176 // example, set via the iframe "name" attribute) then that value will be
177 // returned. Otherwise a unique name will be constructed based on the frame
178 // parent hierarchy. The main (top-level) frame will always have an empty name
182 virtual CefString GetName() =0;
185 // Returns the globally unique identifier for this frame.
188 virtual int64 GetIdentifier() =0;
191 // Returns the parent of this frame or NULL if this is the main (top-level)
195 virtual CefRefPtr<CefFrame> GetParent() =0;
198 // Returns the URL currently loaded in this frame.
201 virtual CefString GetURL() =0;
204 // Returns the browser that this frame belongs to.
207 virtual CefRefPtr<CefBrowser> GetBrowser() =0;
210 // Get the V8 context associated with the frame. This method can only be
211 // called from the render process.
214 virtual CefRefPtr<CefV8Context> GetV8Context() =0;
217 // Visit the DOM document. This method can only be called from the render
221 virtual void VisitDOM(CefRefPtr<CefDOMVisitor> visitor) =0;
224 #endif // CEF_INCLUDE_CEF_FRAME_H_