]> git.sesse.net Git - casparcg/blob - dependencies64/cef/include/cef_load_handler.h
* Merged html producer and updated to latest CEF version (does not have satisfactory...
[casparcg] / dependencies64 / cef / include / cef_load_handler.h
1 // Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
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
12 // distribution.
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.
17 //
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.
29 //
30 // ---------------------------------------------------------------------------
31 //
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.
35 //
36
37 #ifndef CEF_INCLUDE_CEF_LOAD_HANDLER_H_
38 #define CEF_INCLUDE_CEF_LOAD_HANDLER_H_
39 #pragma once
40
41 #include "include/cef_base.h"
42 #include "include/cef_browser.h"
43 #include "include/cef_frame.h"
44
45 ///
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).
49 ///
50 /*--cef(source=client)--*/
51 class CefLoadHandler : public virtual CefBase {
52  public:
53   typedef cef_errorcode_t ErrorCode;
54
55   ///
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
59   // of failure.
60   ///
61   /*--cef()--*/
62   virtual void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
63                                     bool isLoading,
64                                     bool canGoBack,
65                                     bool canGoForward) {}
66
67   ///
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.
75   ///
76   /*--cef()--*/
77   virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
78                            CefRefPtr<CefFrame> frame) {}
79
80   ///
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.
87   ///
88   /*--cef()--*/
89   virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,
90                          CefRefPtr<CefFrame> frame,
91                          int httpStatusCode) {}
92
93   ///
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.
98   ///
99   /*--cef(optional_param=errorText)--*/
100   virtual void OnLoadError(CefRefPtr<CefBrowser> browser,
101                            CefRefPtr<CefFrame> frame,
102                            ErrorCode errorCode,
103                            const CefString& errorText,
104                            const CefString& failedUrl) {}
105 };
106
107 #endif  // CEF_INCLUDE_CEF_LOAD_HANDLER_H_