1 // Copyright (c) 2013 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_REQUEST_CONTEXT_HANDLER_H_ 38 #define CEF_INCLUDE_CEF_REQUEST_CONTEXT_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 #include "include/cef_request.h" 45 #include "include/cef_resource_request_handler.h" 46 #include "include/cef_web_plugin.h" 47 48 /// 49 // Implement this interface to provide handler implementations. The handler 50 // instance will not be released until all objects related to the context have 51 // been destroyed. 52 /// 53 /*--cef(source=client,no_debugct_check)--*/ 54 class CefRequestContextHandler : public virtual CefBaseRefCounted { 55 public: 56 typedef cef_plugin_policy_t PluginPolicy; 57 58 /// 59 // Called on the browser process UI thread immediately after the request 60 // context has been initialized. 61 /// 62 /*--cef()--*/ OnRequestContextInitialized(CefRefPtr<CefRequestContext> request_context)63 virtual void OnRequestContextInitialized( 64 CefRefPtr<CefRequestContext> request_context) {} 65 66 /// 67 // Called on the browser process IO thread before a resource request is 68 // initiated. The |browser| and |frame| values represent the source of the 69 // request, and may be NULL for requests originating from service workers or 70 // CefURLRequest. |request| represents the request contents and cannot be 71 // modified in this callback. |is_navigation| will be true if the resource 72 // request is a navigation. |is_download| will be true if the resource request 73 // is a download. |request_initiator| is the origin (scheme + domain) of the 74 // page that initiated the request. Set |disable_default_handling| to true to 75 // disable default handling of the request, in which case it will need to be 76 // handled via CefResourceRequestHandler::GetResourceHandler or it will be 77 // canceled. To allow the resource load to proceed with default handling 78 // return NULL. To specify a handler for the resource return a 79 // CefResourceRequestHandler object. This method will not be called if the 80 // client associated with |browser| returns a non-NULL value from 81 // CefRequestHandler::GetResourceRequestHandler for the same request 82 // (identified by CefRequest::GetIdentifier). 83 /// 84 /*--cef(optional_param=browser,optional_param=frame, 85 optional_param=request_initiator)--*/ GetResourceRequestHandler(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame,CefRefPtr<CefRequest> request,bool is_navigation,bool is_download,const CefString & request_initiator,bool & disable_default_handling)86 virtual CefRefPtr<CefResourceRequestHandler> GetResourceRequestHandler( 87 CefRefPtr<CefBrowser> browser, 88 CefRefPtr<CefFrame> frame, 89 CefRefPtr<CefRequest> request, 90 bool is_navigation, 91 bool is_download, 92 const CefString& request_initiator, 93 bool& disable_default_handling) { 94 return nullptr; 95 } 96 }; 97 98 #endif // CEF_INCLUDE_CEF_REQUEST_CONTEXT_HANDLER_H_ 99