-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added default implementation of IRequestHandler #2157
Merged
amaitland
merged 6 commits into
cefsharp:master
from
martinekvili:feautre/irequesthandler-default-implementation
Dec 19, 2017
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9e6a975
Added default implementation of IRequestHandler
martinekvili 9dbf53e
Functions made virtual
martinekvili 6758a46
Merge branch 'master' into feautre/irequesthandler-default-implementa…
martinekvili 6bfc6dc
Merge branch 'master' into feautre/irequesthandler-default-implementa…
martinekvili 027906b
Include DefaultRequestHandler in csproj (merge fix)
martinekvili 09fb77a
Moved DefaultRequestHandler to CefSharp.Handler namespace; added comm…
martinekvili File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// Copyright © 2010-2017 The CefSharp Authors. All rights reserved. | ||
// | ||
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. | ||
|
||
using System.Security.Cryptography.X509Certificates; | ||
|
||
namespace CefSharp | ||
{ | ||
/// <summary> | ||
/// Default implementation of <see cref="IRequestHandler"/>. | ||
/// This class provides default implementations of the methods from <see cref="IRequestHandler"/>, | ||
/// therefore providing a convenience base class for any custom request handler. | ||
/// </summary> | ||
public class DefaultRequestHandler : IRequestHandler | ||
{ | ||
public virtual bool GetAuthCredentials(IWebBrowser browserControl, IBrowser browser, IFrame frame, bool isProxy, string host, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally the |
||
int port, string realm, string scheme, IAuthCallback callback) | ||
{ | ||
callback.Dispose(); | ||
return false; | ||
} | ||
|
||
public virtual IResponseFilter GetResourceResponseFilter(IWebBrowser browserControl, IBrowser browser, IFrame frame, | ||
IRequest request, IResponse response) | ||
{ | ||
return null; | ||
} | ||
|
||
public virtual bool OnBeforeBrowse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, bool isRedirect) | ||
{ | ||
return false; | ||
} | ||
|
||
public virtual CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, | ||
IRequestCallback callback) | ||
{ | ||
callback.Dispose(); | ||
return CefReturnValue.Continue; | ||
} | ||
|
||
public virtual bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, | ||
ISslInfo sslInfo, IRequestCallback callback) | ||
{ | ||
callback.Dispose(); | ||
return false; | ||
} | ||
|
||
public virtual bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, | ||
WindowOpenDisposition targetDisposition, bool userGesture) | ||
{ | ||
return false; | ||
} | ||
|
||
public virtual void OnPluginCrashed(IWebBrowser browserControl, IBrowser browser, string pluginPath) | ||
{ } | ||
|
||
public virtual bool OnProtocolExecution(IWebBrowser browserControl, IBrowser browser, string url) | ||
{ | ||
return false; | ||
} | ||
|
||
public virtual bool OnQuotaRequest(IWebBrowser browserControl, IBrowser browser, string originUrl, long newSize, | ||
IRequestCallback callback) | ||
{ | ||
callback.Dispose(); | ||
return false; | ||
} | ||
|
||
public virtual void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status) | ||
{ } | ||
|
||
public virtual void OnRenderViewReady(IWebBrowser browserControl, IBrowser browser) | ||
{ } | ||
|
||
public virtual void OnResourceLoadComplete(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, | ||
IResponse response, UrlRequestStatus status, long receivedContentLength) | ||
{ } | ||
|
||
public virtual void OnResourceRedirect(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, | ||
IResponse response, ref string newUrl) | ||
{ } | ||
|
||
public virtual bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, | ||
IResponse response) | ||
{ | ||
return false; | ||
} | ||
|
||
public virtual bool OnSelectClientCertificate(IWebBrowser browserControl, IBrowser browser, bool isProxy, string host, int port, | ||
X509Certificate2Collection certificates, ISelectClientCertificateCallback callback) | ||
{ | ||
callback.Dispose(); | ||
return false; | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At a minimum this should be in the
Handler
folder. Probably theCefSharp.Handler
namespace as well. (Ideally all the handlers should be in their own namespace, moving the interfaces is a massive breaking change, so probably won't happen).