/** * Creates a {@link SafeStyleSheetProto} wrapping the given {@code string}. No validation is * performed. * * <p>If possible please use the production API in * {@link com.google.common.html.types.SafeStyleSheets} * instead. */ public static SafeStyleSheetProto newSafeStyleSheetProtoForTest(String string) { return SafeStyleSheets.toProto(newSafeStyleSheetForTest(string)); }
/** * Converts a Soy {@link SanitizedContent} of kind CSS into a {@link SafeStyleSheetProto}. * * <p>To ensure correct behavior and usage, the SanitizedContent object should fulfill the * contract of SafeStyleSheet - the CSS content should represent the top-level content of a style * element within HTML. * * @throws IllegalStateException if this SanitizedContent's content kind is not {@link * ContentKind#CSS}. */ public SafeStyleSheetProto toSafeStyleSheetProto() { Preconditions.checkState( getContentKind() == ContentKind.CSS, "toSafeStyleSheetProto() only valid for SanitizedContent of kind CSS, is: %s", getContentKind()); return SafeStyleSheets.toProto(toSafeStyleSheet()); }
/** * Converts a Soy {@link SanitizedContent} of kind CSS into a {@link SafeStyleSheetProto}. * * <p>To ensure correct behavior and usage, the SanitizedContent object should fulfill the * contract of SafeStyleSheet - the CSS content should represent the top-level content of a style * element within HTML. * * @throws IllegalStateException if this SanitizedContent's content kind is not {@link * ContentKind#CSS}. */ public SafeStyleSheetProto toSafeStyleSheetProto() { Preconditions.checkState( getContentKind() == ContentKind.CSS, "toSafeStyleSheetProto() only valid for SanitizedContent of kind CSS, is: %s", getContentKind()); return SafeStyleSheets.toProto(toSafeStyleSheet()); }