// Copyright © 2015 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; namespace CefSharp { /// /// Represents a new V8 extension to be registered. /// public sealed class V8Extension { /// /// Gets the name of the extension. /// public string Name { get; private set; } /// /// Gets the javascript extension code /// public string JavascriptCode { get; private set; } /// /// Creates a new CwefExtension instance with a given name. /// /// Name of the CefExtension /// The javascript extension code. public V8Extension(string name, string javascriptCode) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } if (string.IsNullOrEmpty(javascriptCode)) { throw new ArgumentNullException("javascriptCode"); } Name = name; JavascriptCode = javascriptCode; } /// /// Determines whether the specified object is equal to the current object. /// /// The object to compare with the current object. /// /// true if the specified object is equal to the current object; otherwise, false. /// public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return false; } var ext = (V8Extension)obj; return Name.Equals(ext.Name); } /// /// Serves as the default hash function. /// /// /// A hash code for the current object. /// public override int GetHashCode() { return Name.GetHashCode(); } } }