@@ -339,3 +339,161 @@ bool ClientHandler::OnKeyEvent(CefRefPtr<CefBrowser> browser,
339339 return KeyboardHandler_OnKeyEvent (browser, event, os_event);
340340 // Default: return false;
341341}
342+
343+ // --------------------------------------------------------------------------
344+ // CefRequestHandler
345+ // --------------------------------------------------------------------------
346+
347+ // /
348+ // Implement this interface to handle events related to browser requests. The
349+ // methods of this class will be called on the thread indicated.
350+ // /
351+
352+ // /
353+ // Called on the IO thread before a resource request is loaded. The |request|
354+ // object may be modified. To cancel the request return true otherwise return
355+ // false.
356+ // /
357+ /* --cef()--*/
358+ bool ClientHandler::OnBeforeResourceLoad (CefRefPtr<CefBrowser> browser,
359+ CefRefPtr<CefFrame> frame,
360+ CefRefPtr<CefRequest> request) {
361+ REQUIRE_IO_THREAD ();
362+ return RequestHandler_OnBeforeResourceLoad (browser, frame, request);
363+ // Default: return false;
364+ }
365+
366+ // /
367+ // Called on the IO thread before a resource is loaded. To allow the resource
368+ // to load normally return NULL. To specify a handler for the resource return
369+ // a CefResourceHandler object. The |request| object should not be modified in
370+ // this callback.
371+ // /
372+ /* --cef()--*/
373+ CefRefPtr<CefResourceHandler> ClientHandler::GetResourceHandler (
374+ CefRefPtr<CefBrowser> browser,
375+ CefRefPtr<CefFrame> frame,
376+ CefRefPtr<CefRequest> request) {
377+ REQUIRE_IO_THREAD ();
378+ // Not yet implemented.
379+ return NULL ;
380+ }
381+
382+ // /
383+ // Called on the IO thread when a resource load is redirected. The |old_url|
384+ // parameter will contain the old URL. The |new_url| parameter will contain
385+ // the new URL and can be changed if desired.
386+ // /
387+ /* --cef()--*/
388+ void ClientHandler::OnResourceRedirect (CefRefPtr<CefBrowser> browser,
389+ CefRefPtr<CefFrame> frame,
390+ const CefString& old_url,
391+ CefString& new_url) {
392+ REQUIRE_IO_THREAD ();
393+ RequestHandler_OnResourceRedirect (browser, frame, old_url, new_url);
394+ }
395+
396+ // /
397+ // Called on the IO thread when the browser needs credentials from the user.
398+ // |isProxy| indicates whether the host is a proxy server. |host| contains the
399+ // hostname and |port| contains the port number. Return true to continue the
400+ // request and call CefAuthCallback::Continue() when the authentication
401+ // information is available. Return false to cancel the request.
402+ // /
403+ /* --cef(optional_param=realm)--*/
404+ bool ClientHandler::GetAuthCredentials (CefRefPtr<CefBrowser> browser,
405+ CefRefPtr<CefFrame> frame,
406+ bool isProxy,
407+ const CefString& host,
408+ int port,
409+ const CefString& realm,
410+ const CefString& scheme,
411+ CefRefPtr<CefAuthCallback> callback) {
412+ REQUIRE_IO_THREAD ();
413+ return RequestHandler_GetAuthCredentials (browser, frame, isProxy, host,
414+ port, realm, scheme, callback);
415+ // Default: return false;
416+ }
417+
418+ // /
419+ // Called on the IO thread when JavaScript requests a specific storage quota
420+ // size via the webkitStorageInfo.requestQuota function. |origin_url| is the
421+ // origin of the page making the request. |new_size| is the requested quota
422+ // size in bytes. Return true and call CefQuotaCallback::Continue() either in
423+ // this method or at a later time to grant or deny the request. Return false
424+ // to cancel the request.
425+ // /
426+ /* --cef(optional_param=realm)--*/
427+ bool ClientHandler::OnQuotaRequest (CefRefPtr<CefBrowser> browser,
428+ const CefString& origin_url,
429+ int64 new_size,
430+ CefRefPtr<CefQuotaCallback> callback) {
431+ REQUIRE_IO_THREAD ();
432+ return RequestHandler_OnQuotaRequest (browser, origin_url, new_size,
433+ callback);
434+ // Default: return false;
435+ }
436+
437+ // /
438+ // Called on the IO thread to retrieve the cookie manager. |main_url| is the
439+ // URL of the top-level frame. Cookies managers can be unique per browser or
440+ // shared across multiple browsers. The global cookie manager will be used if
441+ // this method returns NULL.
442+ // /
443+ /* --cef()--*/
444+ CefRefPtr<CefCookieManager> ClientHandler::GetCookieManager (
445+ CefRefPtr<CefBrowser> browser,
446+ const CefString& main_url) {
447+ REQUIRE_IO_THREAD ();
448+ return RequestHandler_GetCookieManager (browser, main_url);
449+ // Default: return NULL.
450+ }
451+
452+ // /
453+ // Called on the UI thread to handle requests for URLs with an unknown
454+ // protocol component. Set |allow_os_execution| to true to attempt execution
455+ // via the registered OS protocol handler, if any.
456+ // SECURITY WARNING: YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED
457+ // ON SCHEME, HOST OR OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION.
458+ // /
459+ /* --cef()--*/
460+ void ClientHandler::OnProtocolExecution (CefRefPtr<CefBrowser> browser,
461+ const CefString& url,
462+ bool & allow_os_execution) {
463+ REQUIRE_UI_THREAD ();
464+ RequestHandler_OnProtocolExecution (browser, url, allow_os_execution);
465+ }
466+
467+ // /
468+ // Called on the browser process IO thread before a plugin is loaded. Return
469+ // true to block loading of the plugin.
470+ // /
471+ /* --cef(optional_param=url,optional_param=policy_url)--*/
472+ bool ClientHandler::OnBeforePluginLoad (CefRefPtr<CefBrowser> browser,
473+ const CefString& url,
474+ const CefString& policy_url,
475+ CefRefPtr<CefWebPluginInfo> info) {
476+ REQUIRE_IO_THREAD ();
477+ return RequestHandler_OnBeforePluginLoad (browser, url, policy_url, info);
478+ // Default: return false;
479+ }
480+
481+ // /
482+ // Called on the UI thread to handle requests for URLs with an invalid
483+ // SSL certificate. Return true and call CefAllowCertificateErrorCallback::
484+ // Continue() either in this method or at a later time to continue or cancel
485+ // the request. Return false to cancel the request immediately. If |callback|
486+ // is empty the error cannot be recovered from and the request will be
487+ // canceled automatically. If CefSettings.ignore_certificate_errors is set
488+ // all invalid certificates will be accepted without calling this method.
489+ // /
490+ /* --cef()--*/
491+ bool ClientHandler::OnCertificateError (
492+ cef_errorcode_t cert_error,
493+ const CefString& request_url,
494+ CefRefPtr<CefAllowCertificateErrorCallback> callback) {
495+ REQUIRE_UI_THREAD ();
496+ return RequestHandler_OnCertificateError (
497+ cert_error, request_url, callback);
498+ // Default: return false;
499+ }
0 commit comments