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_LOAD_HANDLER_H_
38 #define CEF_INCLUDE_CEF_LOAD_HANDLER_H_
41 #include "include/cef_base.h"
42 #include "include/cef_browser.h"
43 #include "include/cef_frame.h"
46 // Implement this interface to handle events related to browser load status. The
47 // methods of this class will be called on the browser process UI thread or
48 // render process main thread (TID_RENDERER).
50 /*--cef(source=client)--*/
51 class CefLoadHandler : public virtual CefBase {
53 typedef cef_errorcode_t ErrorCode;
56 // Called when the loading state has changed. This callback will be executed
57 // twice -- once when loading is initiated either programmatically or by user
58 // action, and once when loading is terminated due to completion, cancellation
62 virtual void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
68 // Called when the browser begins loading a frame. The |frame| value will
69 // never be empty -- call the IsMain() method to check if this frame is the
70 // main frame. Multiple frames may be loading at the same time. Sub-frames may
71 // start or continue loading after the main frame load has ended. This method
72 // may not be called for a particular frame if the load request for that frame
73 // fails. For notification of overall browser load status use
74 // OnLoadingStateChange instead.
77 virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
78 CefRefPtr<CefFrame> frame) {}
81 // Called when the browser is done loading a frame. The |frame| value will
82 // never be empty -- call the IsMain() method to check if this frame is the
83 // main frame. Multiple frames may be loading at the same time. Sub-frames may
84 // start or continue loading after the main frame load has ended. This method
85 // will always be called for all frames irrespective of whether the request
86 // completes successfully.
89 virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,
90 CefRefPtr<CefFrame> frame,
91 int httpStatusCode) {}
94 // Called when the resource load for a navigation fails or is canceled.
95 // |errorCode| is the error code number, |errorText| is the error text and
96 // |failedUrl| is the URL that failed to load. See net\base\net_error_list.h
97 // for complete descriptions of the error codes.
99 /*--cef(optional_param=errorText)--*/
100 virtual void OnLoadError(CefRefPtr<CefBrowser> browser,
101 CefRefPtr<CefFrame> frame,
103 const CefString& errorText,
104 const CefString& failedUrl) {}
107 #endif // CEF_INCLUDE_CEF_LOAD_HANDLER_H_