-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create RequestEventArgs.cs * Create RequestEventHandler * Update RequestEventArgs.cs corrected namespace * removed regions, splitted up classes per file * reformatted code * removed wrong class doc * deleted empty line * removed TODOs (moved them in pr comments) * adapted @amaitland 's pr notes * made code backwards compatible to c# < 6 * made code backwards compatible to c# < 6 ++ (moved default values for event args to ctor) * made code backwards compatible to c# < 6 ++ (added private setters to properties)
- Loading branch information
1 parent
4d697e0
commit ee56382
Showing
17 changed files
with
700 additions
and
0 deletions.
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
18 changes: 18 additions & 0 deletions
18
CefSharp.Example/RequestEventHandler/EventArgs/BaseRequestEventArgs.cs
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,18 @@ | ||
// 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. | ||
|
||
namespace CefSharp.Example.RequestEventHandler | ||
{ | ||
public abstract class BaseRequestEventArgs : System.EventArgs | ||
{ | ||
protected BaseRequestEventArgs(IWebBrowser browserControl, IBrowser browser) | ||
{ | ||
BrowserControl = browserControl; | ||
Browser = browser; | ||
} | ||
|
||
public IWebBrowser BrowserControl { get; private set; } | ||
public IBrowser Browser { get; private set; } | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
CefSharp.Example/RequestEventHandler/EventArgs/GetAuthCredentialsEventArgs.cs
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,41 @@ | ||
// 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. | ||
|
||
namespace CefSharp.Example.RequestEventHandler | ||
{ | ||
public class GetAuthCredentialsEventArgs : BaseRequestEventArgs | ||
{ | ||
public GetAuthCredentialsEventArgs(IWebBrowser browserControl, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback) : base(browserControl, browser) | ||
{ | ||
Frame = frame; | ||
IsProxy = isProxy; | ||
Host = host; | ||
Port = port; | ||
Realm = realm; | ||
Scheme = scheme; | ||
Callback = callback; | ||
|
||
ContinueAsync = false; // default | ||
} | ||
|
||
public IFrame Frame { get; private set; } | ||
public bool IsProxy { get; private set; } | ||
public string Host { get; private set; } | ||
public int Port { get; private set; } | ||
public string Realm { get; private set; } | ||
public string Scheme { get; private set; } | ||
|
||
/// <summary> | ||
/// Callback interface used for asynchronous continuation of authentication requests. | ||
/// </summary> | ||
public IAuthCallback Callback { get; private set; } | ||
|
||
/// <summary> | ||
/// Set to true to continue the request and call | ||
/// <see cref="T:CefSharp.GetAuthCredentialsEventArgs.Continue(System.String, System.String)" /> when the authentication information | ||
/// is available. Set to false to cancel the request. | ||
/// </summary> | ||
public bool ContinueAsync { get; set; } | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
CefSharp.Example/RequestEventHandler/EventArgs/GetResourceResponseFilterEventArgs.cs
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,27 @@ | ||
// 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. | ||
|
||
namespace CefSharp.Example.RequestEventHandler | ||
{ | ||
public class GetResourceResponseFilterEventArgs : BaseRequestEventArgs | ||
{ | ||
public GetResourceResponseFilterEventArgs(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response) : base(browserControl, browser) | ||
{ | ||
Frame = frame; | ||
Request = request; | ||
Response = response; | ||
|
||
ResponseFilter = null; // default | ||
} | ||
|
||
public IFrame Frame { get; private set; } | ||
public IRequest Request { get; private set; } | ||
public IResponse Response { get; private set; } | ||
|
||
/// <summary> | ||
/// Set a ResponseFilter to intercept this response, leave it null otherwise. | ||
/// </summary> | ||
public IResponseFilter ResponseFilter { get; set; } | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
CefSharp.Example/RequestEventHandler/EventArgs/OnBeforeBrowseEventArgs.cs
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,28 @@ | ||
// 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. | ||
|
||
namespace CefSharp.Example.RequestEventHandler | ||
{ | ||
public class OnBeforeBrowseEventArgs : BaseRequestEventArgs | ||
{ | ||
public OnBeforeBrowseEventArgs(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, bool isRedirect) | ||
: base(browserControl, browser) | ||
{ | ||
Frame = frame; | ||
Request = request; | ||
IsRedirect = isRedirect; | ||
|
||
CancelNavigation = false; // default | ||
} | ||
|
||
public IFrame Frame { get; private set; } | ||
public IRequest Request { get; private set; } | ||
public bool IsRedirect { get; private set; } | ||
|
||
/// <summary> | ||
/// Set to true to cancel the navigation or false to allow the navigation to proceed. | ||
/// </summary> | ||
public bool CancelNavigation { get; set; } | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
CefSharp.Example/RequestEventHandler/EventArgs/OnBeforeResourceLoadEventArgs.cs
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,35 @@ | ||
// 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. | ||
|
||
namespace CefSharp.Example.RequestEventHandler | ||
{ | ||
public class OnBeforeResourceLoadEventArgs : BaseRequestEventArgs | ||
{ | ||
public OnBeforeResourceLoadEventArgs(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback) | ||
: base(browserControl, browser) | ||
{ | ||
Frame = frame; | ||
Request = request; | ||
Callback = callback; | ||
|
||
ContinuationHandling = CefReturnValue.Continue; // default | ||
} | ||
|
||
public IFrame Frame { get; private set; } | ||
public IRequest Request { get; private set; } | ||
|
||
/// <summary> | ||
/// Callback interface used for asynchronous continuation of url requests. | ||
/// </summary> | ||
public IRequestCallback Callback { get; private set; } | ||
|
||
/// <summary> | ||
/// To cancel loading of the resource return <see cref="F:CefSharp.CefReturnValue.Cancel" /> | ||
/// or <see cref="F:CefSharp.CefReturnValue.Continue" /> to allow the resource to load normally. For async | ||
/// return <see cref="F:CefSharp.CefReturnValue.ContinueAsync" /> and use | ||
/// <see cref="OnBeforeResourceLoadEventArgs.Callback" /> to handle continuation. | ||
/// </summary> | ||
public CefReturnValue ContinuationHandling { get; set; } | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
CefSharp.Example/RequestEventHandler/EventArgs/OnCertificateErrorEventArgs.cs
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,36 @@ | ||
// 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. | ||
|
||
namespace CefSharp.Example.RequestEventHandler | ||
{ | ||
public class OnCertificateErrorEventArgs : BaseRequestEventArgs | ||
{ | ||
public OnCertificateErrorEventArgs(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback) | ||
: base(browserControl, browser) | ||
{ | ||
ErrorCode = errorCode; | ||
RequestUrl = requestUrl; | ||
SSLInfo = sslInfo; | ||
Callback = callback; | ||
|
||
ContinueAsync = false; // default | ||
} | ||
|
||
public CefErrorCode ErrorCode { get; private set; } | ||
public string RequestUrl { get; private set; } | ||
public ISslInfo SSLInfo { get; private set; } | ||
|
||
/// <summary> | ||
/// Callback interface used for asynchronous continuation of url requests. | ||
/// If empty the error cannot be recovered from and the request will be canceled automatically. | ||
/// </summary> | ||
public IRequestCallback Callback { get; private set; } | ||
|
||
/// <summary> | ||
/// Set to false to cancel the request immediately. Set to true and use <see cref="T:CefSharp.IRequestCallback" /> to | ||
/// execute in an async fashion. | ||
/// </summary> | ||
public bool ContinueAsync { get; set; } | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
CefSharp.Example/RequestEventHandler/EventArgs/OnOpenUrlFromTabEventArgs.cs
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,30 @@ | ||
// 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. | ||
|
||
namespace CefSharp.Example.RequestEventHandler | ||
{ | ||
public class OnOpenUrlFromTabEventArgs : BaseRequestEventArgs | ||
{ | ||
public OnOpenUrlFromTabEventArgs(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture) | ||
: base(browserControl, browser) | ||
{ | ||
Frame = frame; | ||
TargetUrl = targetUrl; | ||
TargetDisposition = targetDisposition; | ||
UserGesture = userGesture; | ||
|
||
CancelNavigation = false; // default | ||
} | ||
|
||
public IFrame Frame { get; private set; } | ||
public string TargetUrl { get; private set; } | ||
public WindowOpenDisposition TargetDisposition { get; private set; } | ||
public bool UserGesture { get; private set; } | ||
|
||
/// <summary> | ||
/// Set to true to cancel the navigation or false to allow the navigation to proceed. | ||
/// </summary> | ||
public bool CancelNavigation { get; set; } | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
CefSharp.Example/RequestEventHandler/EventArgs/OnPluginCrashedEventArgs.cs
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,16 @@ | ||
// 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. | ||
|
||
namespace CefSharp.Example.RequestEventHandler | ||
{ | ||
public class OnPluginCrashedEventArgs : BaseRequestEventArgs | ||
{ | ||
public OnPluginCrashedEventArgs(IWebBrowser browserControl, IBrowser browser, string pluginPath) : base(browserControl, browser) | ||
{ | ||
PluginPath = pluginPath; | ||
} | ||
|
||
public string PluginPath { get; private set; } | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
CefSharp.Example/RequestEventHandler/EventArgs/OnProtocolExecutionEventArgs.cs
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,23 @@ | ||
// 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. | ||
|
||
namespace CefSharp.Example.RequestEventHandler | ||
{ | ||
public class OnProtocolExecutionEventArgs : BaseRequestEventArgs | ||
{ | ||
public OnProtocolExecutionEventArgs(IWebBrowser browserControl, IBrowser browser, string url) : base(browserControl, browser) | ||
{ | ||
Url = url; | ||
|
||
AttemptExecution = false; // default | ||
} | ||
|
||
public string Url { get; private set; } | ||
|
||
/// <summary> | ||
/// Set to true to attempt execution via the registered OS protocol handler, if any. Otherwise set to false. | ||
/// </summary> | ||
public bool AttemptExecution { get; set; } | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
CefSharp.Example/RequestEventHandler/EventArgs/OnQuotaRequestEventArgs.cs
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,34 @@ | ||
// 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. | ||
|
||
namespace CefSharp.Example.RequestEventHandler | ||
{ | ||
public class OnQuotaRequestEventArgs : BaseRequestEventArgs | ||
{ | ||
public OnQuotaRequestEventArgs(IWebBrowser browserControl, IBrowser browser, string originUrl, long newSize, IRequestCallback callback) | ||
: base(browserControl, browser) | ||
{ | ||
OriginUrl = originUrl; | ||
NewSize = newSize; | ||
Callback = callback; | ||
|
||
ContinueAsync = false; // default | ||
} | ||
|
||
public string OriginUrl { get; private set; } | ||
public long NewSize { get; private set; } | ||
|
||
/// <summary> | ||
/// Callback interface used for asynchronous continuation of url requests. | ||
/// </summary> | ||
public IRequestCallback Callback { get; private set; } | ||
|
||
/// <summary> | ||
/// Set to false to cancel the request immediately. Set to true to continue the request | ||
/// and call <see cref="T:OnQuotaRequestEventArgs.Callback.Continue(System.Boolean)" /> either in this method or at a later | ||
/// time to grant or deny the request. | ||
/// </summary> | ||
public bool ContinueAsync { get; set; } | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
CefSharp.Example/RequestEventHandler/EventArgs/OnRenderProcessTerminatedEventArgs.cs
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,17 @@ | ||
// 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. | ||
|
||
namespace CefSharp.Example.RequestEventHandler | ||
{ | ||
public class OnRenderProcessTerminatedEventArgs : BaseRequestEventArgs | ||
{ | ||
public OnRenderProcessTerminatedEventArgs(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status) | ||
: base(browserControl, browser) | ||
{ | ||
Status = status; | ||
} | ||
|
||
public CefTerminationStatus Status { get; private set; } | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
CefSharp.Example/RequestEventHandler/EventArgs/OnRenderViewReadyEventArgs.cs
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,13 @@ | ||
// 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. | ||
|
||
namespace CefSharp.Example.RequestEventHandler | ||
{ | ||
public class OnRenderViewReadyEventArgs : BaseRequestEventArgs | ||
{ | ||
public OnRenderViewReadyEventArgs(IWebBrowser browserControl, IBrowser browser) : base(browserControl, browser) | ||
{ | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
CefSharp.Example/RequestEventHandler/EventArgs/OnResourceLoadCompleteEventArgs.cs
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,25 @@ | ||
// 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. | ||
|
||
namespace CefSharp.Example.RequestEventHandler | ||
{ | ||
public class OnResourceLoadCompleteEventArgs : BaseRequestEventArgs | ||
{ | ||
public OnResourceLoadCompleteEventArgs(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response, UrlRequestStatus status, long receivedContentLength) | ||
: base(browserControl, browser) | ||
{ | ||
Frame = frame; | ||
Request = request; | ||
Response = response; | ||
Status = status; | ||
ReceivedContentLength = receivedContentLength; | ||
} | ||
|
||
public IFrame Frame { get; private set; } | ||
public IRequest Request { get; private set; } | ||
public IResponse Response { get; private set; } | ||
public UrlRequestStatus Status { get; private set; } | ||
public long ReceivedContentLength { get; private set; } | ||
} | ||
} |
Oops, something went wrong.