CefNavigationEntry.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. namespace Xilium.CefGlue
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.Runtime.InteropServices;
  7. using Xilium.CefGlue.Interop;
  8. /// <summary>
  9. /// Class used to represent an entry in navigation history.
  10. /// </summary>
  11. public sealed unsafe partial class CefNavigationEntry
  12. {
  13. /// <summary>
  14. /// Returns true if this object is valid. Do not call any other methods if this
  15. /// function returns false.
  16. /// </summary>
  17. public bool IsValid
  18. {
  19. get { return cef_navigation_entry_t.is_valid(_self) != 0; }
  20. }
  21. /// <summary>
  22. /// Returns the actual URL of the page. For some pages this may be data: URL or
  23. /// similar. Use GetDisplayURL() to return a display-friendly version.
  24. /// </summary>
  25. public string Url
  26. {
  27. get
  28. {
  29. var n_value = cef_navigation_entry_t.get_url(_self);
  30. return cef_string_userfree.ToString(n_value);
  31. }
  32. }
  33. /// <summary>
  34. /// Returns a display-friendly version of the URL.
  35. /// </summary>
  36. public string DisplayUrl
  37. {
  38. get
  39. {
  40. var n_value = cef_navigation_entry_t.get_display_url(_self);
  41. return cef_string_userfree.ToString(n_value);
  42. }
  43. }
  44. /// <summary>
  45. /// Returns the original URL that was entered by the user before any redirects.
  46. /// </summary>
  47. public string OriginalUrl
  48. {
  49. get
  50. {
  51. var n_value = cef_navigation_entry_t.get_original_url(_self);
  52. return cef_string_userfree.ToString(n_value);
  53. }
  54. }
  55. /// <summary>
  56. /// Returns the title set by the page. This value may be empty.
  57. /// </summary>
  58. public string Title
  59. {
  60. get
  61. {
  62. var n_value = cef_navigation_entry_t.get_title(_self);
  63. return cef_string_userfree.ToString(n_value);
  64. }
  65. }
  66. /// <summary>
  67. /// Returns the transition type which indicates what the user did to move to
  68. /// this page from the previous page.
  69. /// </summary>
  70. public CefTransitionType TransitionType
  71. {
  72. get { return cef_navigation_entry_t.get_transition_type(_self); }
  73. }
  74. /// <summary>
  75. /// Returns true if this navigation includes post data.
  76. /// </summary>
  77. public bool HasPostData
  78. {
  79. get { return cef_navigation_entry_t.has_post_data(_self) != 0; }
  80. }
  81. /// <summary>
  82. /// Returns the time for the last known successful navigation completion. A
  83. /// navigation may be completed more than once if the page is reloaded. May be
  84. /// 0 if the navigation has not yet completed.
  85. /// </summary>
  86. public DateTime CompletionTime
  87. {
  88. get
  89. {
  90. var n_value = cef_navigation_entry_t.get_completion_time(_self);
  91. return n_value.ToDateTime();
  92. }
  93. }
  94. /// <summary>
  95. /// Returns the HTTP status code for the last known successful navigation
  96. /// response. May be 0 if the response has not yet been received or if the
  97. /// navigation has not yet completed.
  98. /// </summary>
  99. public int HttpStatusCode
  100. {
  101. get { return cef_navigation_entry_t.get_http_status_code(_self); }
  102. }
  103. /// <summary>
  104. /// Returns the SSL information for this navigation entry.
  105. /// </summary>
  106. public CefSslStatus GetSslStatus()
  107. {
  108. return CefSslStatus.FromNative(
  109. cef_navigation_entry_t.get_sslstatus(_self)
  110. );
  111. }
  112. }
  113. }