Best JavaScript code snippet using wpt
manifest.mojom.js
Source:manifest.mojom.js
1// third_party/blink/public/mojom/manifest/manifest.mojom.js is auto generated by mojom_bindings_generator.py, do not edit2// Copyright 2014 The Chromium Authors. All rights reserved.3// Use of this source code is governed by a BSD-style license that can be4// found in the LICENSE file.5'use strict';6(function() {7 var mojomId = 'third_party/blink/public/mojom/manifest/manifest.mojom';8 if (mojo.internal.isMojomLoaded(mojomId)) {9 console.warn('The following mojom is loaded multiple times: ' + mojomId);10 return;11 }12 mojo.internal.markMojomLoaded(mojomId);13 var bindings = mojo;14 var associatedBindings = mojo;15 var codec = mojo.internal;16 var validator = mojo.internal;17 var exports = mojo.internal.exposeNamespace('blink.mojom');18 var screen_orientation_lock_types$ =19 mojo.internal.exposeNamespace('device.mojom');20 if (mojo.config.autoLoadMojomDeps) {21 mojo.internal.loadMojomIfNecessary(22 'services/device/public/mojom/screen_orientation_lock_types.mojom', '../../../../../services/device/public/mojom/screen_orientation_lock_types.mojom.js');23 }24 var string16$ =25 mojo.internal.exposeNamespace('mojoBase.mojom');26 if (mojo.config.autoLoadMojomDeps) {27 mojo.internal.loadMojomIfNecessary(28 'mojo/public/mojom/base/string16.mojom', '../../../../../mojo/public/mojom/base/string16.mojom.js');29 }30 var display_mode$ =31 mojo.internal.exposeNamespace('blink.mojom');32 if (mojo.config.autoLoadMojomDeps) {33 mojo.internal.loadMojomIfNecessary(34 'third_party/blink/public/mojom/manifest/display_mode.mojom', 'display_mode.mojom.js');35 }36 var capture_links$ =37 mojo.internal.exposeNamespace('blink.mojom');38 if (mojo.config.autoLoadMojomDeps) {39 mojo.internal.loadMojomIfNecessary(40 'third_party/blink/public/mojom/manifest/capture_links.mojom', 'capture_links.mojom.js');41 }42 var geometry$ =43 mojo.internal.exposeNamespace('gfx.mojom');44 if (mojo.config.autoLoadMojomDeps) {45 mojo.internal.loadMojomIfNecessary(46 'ui/gfx/geometry/mojom/geometry.mojom', '../../../../../ui/gfx/geometry/mojom/geometry.mojom.js');47 }48 var url$ =49 mojo.internal.exposeNamespace('url.mojom');50 if (mojo.config.autoLoadMojomDeps) {51 mojo.internal.loadMojomIfNecessary(52 'url/mojom/url.mojom', '../../../../../url/mojom/url.mojom.js');53 }54 var origin$ =55 mojo.internal.exposeNamespace('url.mojom');56 if (mojo.config.autoLoadMojomDeps) {57 mojo.internal.loadMojomIfNecessary(58 'url/mojom/origin.mojom', '../../../../../url/mojom/origin.mojom.js');59 }60 function Manifest(values) {61 this.initDefaults_();62 this.initFields_(values);63 }64 Manifest.prototype.initDefaults_ = function() {65 this.name = null;66 this.shortName = null;67 this.description = null;68 this.startUrl = null;69 this.display = 0;70 this.orientation = 0;71 this.displayOverride = null;72 this.icons = null;73 this.screenshots = null;74 this.shortcuts = null;75 this.shareTarget = null;76 this.fileHandlers = null;77 this.protocolHandlers = null;78 this.urlHandlers = null;79 this.relatedApplications = null;80 this.preferRelatedApplications = false;81 this.hasThemeColor = false;82 this.hasBackgroundColor = false;83 this.themeColor = 0;84 this.backgroundColor = 0;85 this.captureLinks = 0;86 this.gcmSenderId = null;87 this.scope = null;88 };89 Manifest.prototype.initFields_ = function(fields) {90 for(var field in fields) {91 if (this.hasOwnProperty(field))92 this[field] = fields[field];93 }94 };95 Manifest.validate = function(messageValidator, offset) {96 var err;97 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);98 if (err !== validator.validationError.NONE)99 return err;100 var kVersionSizes = [101 {version: 0, numBytes: 152}102 ];103 err = messageValidator.validateStructVersion(offset, kVersionSizes);104 if (err !== validator.validationError.NONE)105 return err;106 // validate Manifest.name107 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, string16$.String16, true);108 if (err !== validator.validationError.NONE)109 return err;110 // validate Manifest.shortName111 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 8, string16$.String16, true);112 if (err !== validator.validationError.NONE)113 return err;114 // validate Manifest.description115 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 16, string16$.String16, true);116 if (err !== validator.validationError.NONE)117 return err;118 // validate Manifest.startUrl119 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 24, url$.Url, false);120 if (err !== validator.validationError.NONE)121 return err;122 // validate Manifest.display123 err = messageValidator.validateEnum(offset + codec.kStructHeaderSize + 32, display_mode$.DisplayMode);124 if (err !== validator.validationError.NONE)125 return err;126 // validate Manifest.displayOverride127 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 40, 4, new codec.Enum(display_mode$.DisplayMode), false, [0], 0);128 if (err !== validator.validationError.NONE)129 return err;130 // validate Manifest.orientation131 err = messageValidator.validateEnum(offset + codec.kStructHeaderSize + 36, screen_orientation_lock_types$.ScreenOrientationLockType);132 if (err !== validator.validationError.NONE)133 return err;134 // validate Manifest.icons135 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 48, 8, new codec.PointerTo(ManifestImageResource), false, [0], 0);136 if (err !== validator.validationError.NONE)137 return err;138 // validate Manifest.screenshots139 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 56, 8, new codec.PointerTo(ManifestImageResource), false, [0], 0);140 if (err !== validator.validationError.NONE)141 return err;142 // validate Manifest.shortcuts143 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 64, 8, new codec.PointerTo(ManifestShortcutItem), false, [0], 0);144 if (err !== validator.validationError.NONE)145 return err;146 // validate Manifest.shareTarget147 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 72, ManifestShareTarget, true);148 if (err !== validator.validationError.NONE)149 return err;150 // validate Manifest.fileHandlers151 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 80, 8, new codec.PointerTo(ManifestFileHandler), false, [0], 0);152 if (err !== validator.validationError.NONE)153 return err;154 // validate Manifest.protocolHandlers155 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 88, 8, new codec.PointerTo(ManifestProtocolHandler), false, [0], 0);156 if (err !== validator.validationError.NONE)157 return err;158 // validate Manifest.urlHandlers159 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 96, 8, new codec.PointerTo(ManifestUrlHandler), false, [0], 0);160 if (err !== validator.validationError.NONE)161 return err;162 // validate Manifest.relatedApplications163 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 104, 8, new codec.PointerTo(ManifestRelatedApplication), false, [0], 0);164 if (err !== validator.validationError.NONE)165 return err;166 // validate Manifest.gcmSenderId167 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 128, string16$.String16, true);168 if (err !== validator.validationError.NONE)169 return err;170 // validate Manifest.scope171 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 136, url$.Url, false);172 if (err !== validator.validationError.NONE)173 return err;174 // validate Manifest.captureLinks175 err = messageValidator.validateEnum(offset + codec.kStructHeaderSize + 124, capture_links$.CaptureLinks);176 if (err !== validator.validationError.NONE)177 return err;178 return validator.validationError.NONE;179 };180 Manifest.encodedSize = codec.kStructHeaderSize + 144;181 Manifest.decode = function(decoder) {182 var packed;183 var val = new Manifest();184 var numberOfBytes = decoder.readUint32();185 var version = decoder.readUint32();186 val.name =187 decoder.decodeStructPointer(string16$.String16);188 val.shortName =189 decoder.decodeStructPointer(string16$.String16);190 val.description =191 decoder.decodeStructPointer(string16$.String16);192 val.startUrl =193 decoder.decodeStructPointer(url$.Url);194 val.display =195 decoder.decodeStruct(codec.Int32);196 val.orientation =197 decoder.decodeStruct(codec.Int32);198 val.displayOverride =199 decoder.decodeArrayPointer(new codec.Enum(display_mode$.DisplayMode));200 val.icons =201 decoder.decodeArrayPointer(new codec.PointerTo(ManifestImageResource));202 val.screenshots =203 decoder.decodeArrayPointer(new codec.PointerTo(ManifestImageResource));204 val.shortcuts =205 decoder.decodeArrayPointer(new codec.PointerTo(ManifestShortcutItem));206 val.shareTarget =207 decoder.decodeStructPointer(ManifestShareTarget);208 val.fileHandlers =209 decoder.decodeArrayPointer(new codec.PointerTo(ManifestFileHandler));210 val.protocolHandlers =211 decoder.decodeArrayPointer(new codec.PointerTo(ManifestProtocolHandler));212 val.urlHandlers =213 decoder.decodeArrayPointer(new codec.PointerTo(ManifestUrlHandler));214 val.relatedApplications =215 decoder.decodeArrayPointer(new codec.PointerTo(ManifestRelatedApplication));216 packed = decoder.readUint8();217 val.preferRelatedApplications = (packed >> 0) & 1 ? true : false;218 val.hasThemeColor = (packed >> 1) & 1 ? true : false;219 val.hasBackgroundColor = (packed >> 2) & 1 ? true : false;220 decoder.skip(1);221 decoder.skip(1);222 decoder.skip(1);223 val.themeColor =224 decoder.decodeStruct(codec.Uint32);225 val.backgroundColor =226 decoder.decodeStruct(codec.Uint32);227 val.captureLinks =228 decoder.decodeStruct(codec.Int32);229 val.gcmSenderId =230 decoder.decodeStructPointer(string16$.String16);231 val.scope =232 decoder.decodeStructPointer(url$.Url);233 return val;234 };235 Manifest.encode = function(encoder, val) {236 var packed;237 encoder.writeUint32(Manifest.encodedSize);238 encoder.writeUint32(0);239 encoder.encodeStructPointer(string16$.String16, val.name);240 encoder.encodeStructPointer(string16$.String16, val.shortName);241 encoder.encodeStructPointer(string16$.String16, val.description);242 encoder.encodeStructPointer(url$.Url, val.startUrl);243 encoder.encodeStruct(codec.Int32, val.display);244 encoder.encodeStruct(codec.Int32, val.orientation);245 encoder.encodeArrayPointer(new codec.Enum(display_mode$.DisplayMode), val.displayOverride);246 encoder.encodeArrayPointer(new codec.PointerTo(ManifestImageResource), val.icons);247 encoder.encodeArrayPointer(new codec.PointerTo(ManifestImageResource), val.screenshots);248 encoder.encodeArrayPointer(new codec.PointerTo(ManifestShortcutItem), val.shortcuts);249 encoder.encodeStructPointer(ManifestShareTarget, val.shareTarget);250 encoder.encodeArrayPointer(new codec.PointerTo(ManifestFileHandler), val.fileHandlers);251 encoder.encodeArrayPointer(new codec.PointerTo(ManifestProtocolHandler), val.protocolHandlers);252 encoder.encodeArrayPointer(new codec.PointerTo(ManifestUrlHandler), val.urlHandlers);253 encoder.encodeArrayPointer(new codec.PointerTo(ManifestRelatedApplication), val.relatedApplications);254 packed = 0;255 packed |= (val.preferRelatedApplications & 1) << 0256 packed |= (val.hasThemeColor & 1) << 1257 packed |= (val.hasBackgroundColor & 1) << 2258 encoder.writeUint8(packed);259 encoder.skip(1);260 encoder.skip(1);261 encoder.skip(1);262 encoder.encodeStruct(codec.Uint32, val.themeColor);263 encoder.encodeStruct(codec.Uint32, val.backgroundColor);264 encoder.encodeStruct(codec.Int32, val.captureLinks);265 encoder.encodeStructPointer(string16$.String16, val.gcmSenderId);266 encoder.encodeStructPointer(url$.Url, val.scope);267 };268 function ManifestShortcutItem(values) {269 this.initDefaults_();270 this.initFields_(values);271 }272 ManifestShortcutItem.prototype.initDefaults_ = function() {273 this.name = null;274 this.shortName = null;275 this.description = null;276 this.url = null;277 this.icons = null;278 };279 ManifestShortcutItem.prototype.initFields_ = function(fields) {280 for(var field in fields) {281 if (this.hasOwnProperty(field))282 this[field] = fields[field];283 }284 };285 ManifestShortcutItem.validate = function(messageValidator, offset) {286 var err;287 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);288 if (err !== validator.validationError.NONE)289 return err;290 var kVersionSizes = [291 {version: 0, numBytes: 48}292 ];293 err = messageValidator.validateStructVersion(offset, kVersionSizes);294 if (err !== validator.validationError.NONE)295 return err;296 // validate ManifestShortcutItem.name297 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, string16$.String16, false);298 if (err !== validator.validationError.NONE)299 return err;300 // validate ManifestShortcutItem.shortName301 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 8, string16$.String16, true);302 if (err !== validator.validationError.NONE)303 return err;304 // validate ManifestShortcutItem.description305 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 16, string16$.String16, true);306 if (err !== validator.validationError.NONE)307 return err;308 // validate ManifestShortcutItem.url309 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 24, url$.Url, false);310 if (err !== validator.validationError.NONE)311 return err;312 // validate ManifestShortcutItem.icons313 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 32, 8, new codec.PointerTo(ManifestImageResource), false, [0], 0);314 if (err !== validator.validationError.NONE)315 return err;316 return validator.validationError.NONE;317 };318 ManifestShortcutItem.encodedSize = codec.kStructHeaderSize + 40;319 ManifestShortcutItem.decode = function(decoder) {320 var packed;321 var val = new ManifestShortcutItem();322 var numberOfBytes = decoder.readUint32();323 var version = decoder.readUint32();324 val.name =325 decoder.decodeStructPointer(string16$.String16);326 val.shortName =327 decoder.decodeStructPointer(string16$.String16);328 val.description =329 decoder.decodeStructPointer(string16$.String16);330 val.url =331 decoder.decodeStructPointer(url$.Url);332 val.icons =333 decoder.decodeArrayPointer(new codec.PointerTo(ManifestImageResource));334 return val;335 };336 ManifestShortcutItem.encode = function(encoder, val) {337 var packed;338 encoder.writeUint32(ManifestShortcutItem.encodedSize);339 encoder.writeUint32(0);340 encoder.encodeStructPointer(string16$.String16, val.name);341 encoder.encodeStructPointer(string16$.String16, val.shortName);342 encoder.encodeStructPointer(string16$.String16, val.description);343 encoder.encodeStructPointer(url$.Url, val.url);344 encoder.encodeArrayPointer(new codec.PointerTo(ManifestImageResource), val.icons);345 };346 function ManifestImageResource(values) {347 this.initDefaults_();348 this.initFields_(values);349 }350 ManifestImageResource.Purpose = {};351 ManifestImageResource.Purpose.ANY = 0;352 ManifestImageResource.Purpose.MONOCHROME = 1;353 ManifestImageResource.Purpose.MASKABLE = 2;354 ManifestImageResource.Purpose.MIN_VALUE = 0,355 ManifestImageResource.Purpose.MAX_VALUE = 2,356 ManifestImageResource.Purpose.isKnownEnumValue = function(value) {357 switch (value) {358 case 0:359 case 1:360 case 2:361 return true;362 }363 return false;364 };365 ManifestImageResource.Purpose.validate = function(enumValue) {366 var isExtensible = false;367 if (isExtensible || this.isKnownEnumValue(enumValue))368 return validator.validationError.NONE;369 return validator.validationError.UNKNOWN_ENUM_VALUE;370 };371 ManifestImageResource.prototype.initDefaults_ = function() {372 this.src = null;373 this.type = null;374 this.sizes = null;375 this.purpose = null;376 };377 ManifestImageResource.prototype.initFields_ = function(fields) {378 for(var field in fields) {379 if (this.hasOwnProperty(field))380 this[field] = fields[field];381 }382 };383 ManifestImageResource.validate = function(messageValidator, offset) {384 var err;385 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);386 if (err !== validator.validationError.NONE)387 return err;388 var kVersionSizes = [389 {version: 0, numBytes: 40}390 ];391 err = messageValidator.validateStructVersion(offset, kVersionSizes);392 if (err !== validator.validationError.NONE)393 return err;394 // validate ManifestImageResource.src395 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, url$.Url, false);396 if (err !== validator.validationError.NONE)397 return err;398 // validate ManifestImageResource.type399 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 8, string16$.String16, true);400 if (err !== validator.validationError.NONE)401 return err;402 // validate ManifestImageResource.sizes403 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 16, 8, new codec.PointerTo(geometry$.Size), false, [0], 0);404 if (err !== validator.validationError.NONE)405 return err;406 // validate ManifestImageResource.purpose407 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 24, 4, new codec.Enum(ManifestImageResource.Purpose), false, [0], 0);408 if (err !== validator.validationError.NONE)409 return err;410 return validator.validationError.NONE;411 };412 ManifestImageResource.encodedSize = codec.kStructHeaderSize + 32;413 ManifestImageResource.decode = function(decoder) {414 var packed;415 var val = new ManifestImageResource();416 var numberOfBytes = decoder.readUint32();417 var version = decoder.readUint32();418 val.src =419 decoder.decodeStructPointer(url$.Url);420 val.type =421 decoder.decodeStructPointer(string16$.String16);422 val.sizes =423 decoder.decodeArrayPointer(new codec.PointerTo(geometry$.Size));424 val.purpose =425 decoder.decodeArrayPointer(new codec.Enum(ManifestImageResource.Purpose));426 return val;427 };428 ManifestImageResource.encode = function(encoder, val) {429 var packed;430 encoder.writeUint32(ManifestImageResource.encodedSize);431 encoder.writeUint32(0);432 encoder.encodeStructPointer(url$.Url, val.src);433 encoder.encodeStructPointer(string16$.String16, val.type);434 encoder.encodeArrayPointer(new codec.PointerTo(geometry$.Size), val.sizes);435 encoder.encodeArrayPointer(new codec.Enum(ManifestImageResource.Purpose), val.purpose);436 };437 function ManifestFileFilter(values) {438 this.initDefaults_();439 this.initFields_(values);440 }441 ManifestFileFilter.prototype.initDefaults_ = function() {442 this.name = null;443 this.accept = null;444 };445 ManifestFileFilter.prototype.initFields_ = function(fields) {446 for(var field in fields) {447 if (this.hasOwnProperty(field))448 this[field] = fields[field];449 }450 };451 ManifestFileFilter.validate = function(messageValidator, offset) {452 var err;453 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);454 if (err !== validator.validationError.NONE)455 return err;456 var kVersionSizes = [457 {version: 0, numBytes: 24}458 ];459 err = messageValidator.validateStructVersion(offset, kVersionSizes);460 if (err !== validator.validationError.NONE)461 return err;462 // validate ManifestFileFilter.name463 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, string16$.String16, true);464 if (err !== validator.validationError.NONE)465 return err;466 // validate ManifestFileFilter.accept467 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 8, 8, new codec.PointerTo(string16$.String16), false, [0], 0);468 if (err !== validator.validationError.NONE)469 return err;470 return validator.validationError.NONE;471 };472 ManifestFileFilter.encodedSize = codec.kStructHeaderSize + 16;473 ManifestFileFilter.decode = function(decoder) {474 var packed;475 var val = new ManifestFileFilter();476 var numberOfBytes = decoder.readUint32();477 var version = decoder.readUint32();478 val.name =479 decoder.decodeStructPointer(string16$.String16);480 val.accept =481 decoder.decodeArrayPointer(new codec.PointerTo(string16$.String16));482 return val;483 };484 ManifestFileFilter.encode = function(encoder, val) {485 var packed;486 encoder.writeUint32(ManifestFileFilter.encodedSize);487 encoder.writeUint32(0);488 encoder.encodeStructPointer(string16$.String16, val.name);489 encoder.encodeArrayPointer(new codec.PointerTo(string16$.String16), val.accept);490 };491 function ManifestProtocolHandler(values) {492 this.initDefaults_();493 this.initFields_(values);494 }495 ManifestProtocolHandler.prototype.initDefaults_ = function() {496 this.protocol = null;497 this.url = null;498 };499 ManifestProtocolHandler.prototype.initFields_ = function(fields) {500 for(var field in fields) {501 if (this.hasOwnProperty(field))502 this[field] = fields[field];503 }504 };505 ManifestProtocolHandler.validate = function(messageValidator, offset) {506 var err;507 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);508 if (err !== validator.validationError.NONE)509 return err;510 var kVersionSizes = [511 {version: 0, numBytes: 24}512 ];513 err = messageValidator.validateStructVersion(offset, kVersionSizes);514 if (err !== validator.validationError.NONE)515 return err;516 // validate ManifestProtocolHandler.protocol517 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, string16$.String16, false);518 if (err !== validator.validationError.NONE)519 return err;520 // validate ManifestProtocolHandler.url521 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 8, url$.Url, false);522 if (err !== validator.validationError.NONE)523 return err;524 return validator.validationError.NONE;525 };526 ManifestProtocolHandler.encodedSize = codec.kStructHeaderSize + 16;527 ManifestProtocolHandler.decode = function(decoder) {528 var packed;529 var val = new ManifestProtocolHandler();530 var numberOfBytes = decoder.readUint32();531 var version = decoder.readUint32();532 val.protocol =533 decoder.decodeStructPointer(string16$.String16);534 val.url =535 decoder.decodeStructPointer(url$.Url);536 return val;537 };538 ManifestProtocolHandler.encode = function(encoder, val) {539 var packed;540 encoder.writeUint32(ManifestProtocolHandler.encodedSize);541 encoder.writeUint32(0);542 encoder.encodeStructPointer(string16$.String16, val.protocol);543 encoder.encodeStructPointer(url$.Url, val.url);544 };545 function ManifestUrlHandler(values) {546 this.initDefaults_();547 this.initFields_(values);548 }549 ManifestUrlHandler.prototype.initDefaults_ = function() {550 this.origin = null;551 };552 ManifestUrlHandler.prototype.initFields_ = function(fields) {553 for(var field in fields) {554 if (this.hasOwnProperty(field))555 this[field] = fields[field];556 }557 };558 ManifestUrlHandler.validate = function(messageValidator, offset) {559 var err;560 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);561 if (err !== validator.validationError.NONE)562 return err;563 var kVersionSizes = [564 {version: 0, numBytes: 16}565 ];566 err = messageValidator.validateStructVersion(offset, kVersionSizes);567 if (err !== validator.validationError.NONE)568 return err;569 // validate ManifestUrlHandler.origin570 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, origin$.Origin, false);571 if (err !== validator.validationError.NONE)572 return err;573 return validator.validationError.NONE;574 };575 ManifestUrlHandler.encodedSize = codec.kStructHeaderSize + 8;576 ManifestUrlHandler.decode = function(decoder) {577 var packed;578 var val = new ManifestUrlHandler();579 var numberOfBytes = decoder.readUint32();580 var version = decoder.readUint32();581 val.origin =582 decoder.decodeStructPointer(origin$.Origin);583 return val;584 };585 ManifestUrlHandler.encode = function(encoder, val) {586 var packed;587 encoder.writeUint32(ManifestUrlHandler.encodedSize);588 encoder.writeUint32(0);589 encoder.encodeStructPointer(origin$.Origin, val.origin);590 };591 function ManifestRelatedApplication(values) {592 this.initDefaults_();593 this.initFields_(values);594 }595 ManifestRelatedApplication.prototype.initDefaults_ = function() {596 this.platform = null;597 this.url = null;598 this.id = null;599 };600 ManifestRelatedApplication.prototype.initFields_ = function(fields) {601 for(var field in fields) {602 if (this.hasOwnProperty(field))603 this[field] = fields[field];604 }605 };606 ManifestRelatedApplication.validate = function(messageValidator, offset) {607 var err;608 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);609 if (err !== validator.validationError.NONE)610 return err;611 var kVersionSizes = [612 {version: 0, numBytes: 32}613 ];614 err = messageValidator.validateStructVersion(offset, kVersionSizes);615 if (err !== validator.validationError.NONE)616 return err;617 // validate ManifestRelatedApplication.platform618 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, string16$.String16, true);619 if (err !== validator.validationError.NONE)620 return err;621 // validate ManifestRelatedApplication.url622 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 8, url$.Url, true);623 if (err !== validator.validationError.NONE)624 return err;625 // validate ManifestRelatedApplication.id626 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 16, string16$.String16, true);627 if (err !== validator.validationError.NONE)628 return err;629 return validator.validationError.NONE;630 };631 ManifestRelatedApplication.encodedSize = codec.kStructHeaderSize + 24;632 ManifestRelatedApplication.decode = function(decoder) {633 var packed;634 var val = new ManifestRelatedApplication();635 var numberOfBytes = decoder.readUint32();636 var version = decoder.readUint32();637 val.platform =638 decoder.decodeStructPointer(string16$.String16);639 val.url =640 decoder.decodeStructPointer(url$.Url);641 val.id =642 decoder.decodeStructPointer(string16$.String16);643 return val;644 };645 ManifestRelatedApplication.encode = function(encoder, val) {646 var packed;647 encoder.writeUint32(ManifestRelatedApplication.encodedSize);648 encoder.writeUint32(0);649 encoder.encodeStructPointer(string16$.String16, val.platform);650 encoder.encodeStructPointer(url$.Url, val.url);651 encoder.encodeStructPointer(string16$.String16, val.id);652 };653 function ManifestShareTargetParams(values) {654 this.initDefaults_();655 this.initFields_(values);656 }657 ManifestShareTargetParams.prototype.initDefaults_ = function() {658 this.title = null;659 this.text = null;660 this.url = null;661 this.files = null;662 };663 ManifestShareTargetParams.prototype.initFields_ = function(fields) {664 for(var field in fields) {665 if (this.hasOwnProperty(field))666 this[field] = fields[field];667 }668 };669 ManifestShareTargetParams.validate = function(messageValidator, offset) {670 var err;671 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);672 if (err !== validator.validationError.NONE)673 return err;674 var kVersionSizes = [675 {version: 0, numBytes: 40}676 ];677 err = messageValidator.validateStructVersion(offset, kVersionSizes);678 if (err !== validator.validationError.NONE)679 return err;680 // validate ManifestShareTargetParams.title681 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, string16$.String16, true);682 if (err !== validator.validationError.NONE)683 return err;684 // validate ManifestShareTargetParams.text685 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 8, string16$.String16, true);686 if (err !== validator.validationError.NONE)687 return err;688 // validate ManifestShareTargetParams.url689 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 16, string16$.String16, true);690 if (err !== validator.validationError.NONE)691 return err;692 // validate ManifestShareTargetParams.files693 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 24, 8, new codec.PointerTo(ManifestFileFilter), true, [0], 0);694 if (err !== validator.validationError.NONE)695 return err;696 return validator.validationError.NONE;697 };698 ManifestShareTargetParams.encodedSize = codec.kStructHeaderSize + 32;699 ManifestShareTargetParams.decode = function(decoder) {700 var packed;701 var val = new ManifestShareTargetParams();702 var numberOfBytes = decoder.readUint32();703 var version = decoder.readUint32();704 val.title =705 decoder.decodeStructPointer(string16$.String16);706 val.text =707 decoder.decodeStructPointer(string16$.String16);708 val.url =709 decoder.decodeStructPointer(string16$.String16);710 val.files =711 decoder.decodeArrayPointer(new codec.PointerTo(ManifestFileFilter));712 return val;713 };714 ManifestShareTargetParams.encode = function(encoder, val) {715 var packed;716 encoder.writeUint32(ManifestShareTargetParams.encodedSize);717 encoder.writeUint32(0);718 encoder.encodeStructPointer(string16$.String16, val.title);719 encoder.encodeStructPointer(string16$.String16, val.text);720 encoder.encodeStructPointer(string16$.String16, val.url);721 encoder.encodeArrayPointer(new codec.PointerTo(ManifestFileFilter), val.files);722 };723 function ManifestShareTarget(values) {724 this.initDefaults_();725 this.initFields_(values);726 }727 ManifestShareTarget.Method = {};728 ManifestShareTarget.Method.kGet = 0;729 ManifestShareTarget.Method.kPost = 1;730 ManifestShareTarget.Method.MIN_VALUE = 0,731 ManifestShareTarget.Method.MAX_VALUE = 1,732 ManifestShareTarget.Method.isKnownEnumValue = function(value) {733 switch (value) {734 case 0:735 case 1:736 return true;737 }738 return false;739 };740 ManifestShareTarget.Method.validate = function(enumValue) {741 var isExtensible = false;742 if (isExtensible || this.isKnownEnumValue(enumValue))743 return validator.validationError.NONE;744 return validator.validationError.UNKNOWN_ENUM_VALUE;745 };746 ManifestShareTarget.Enctype = {};747 ManifestShareTarget.Enctype.kFormUrlEncoded = 0;748 ManifestShareTarget.Enctype.kMultipartFormData = 1;749 ManifestShareTarget.Enctype.MIN_VALUE = 0,750 ManifestShareTarget.Enctype.MAX_VALUE = 1,751 ManifestShareTarget.Enctype.isKnownEnumValue = function(value) {752 switch (value) {753 case 0:754 case 1:755 return true;756 }757 return false;758 };759 ManifestShareTarget.Enctype.validate = function(enumValue) {760 var isExtensible = false;761 if (isExtensible || this.isKnownEnumValue(enumValue))762 return validator.validationError.NONE;763 return validator.validationError.UNKNOWN_ENUM_VALUE;764 };765 ManifestShareTarget.prototype.initDefaults_ = function() {766 this.action = null;767 this.method = 0;768 this.enctype = 0;769 this.params = null;770 };771 ManifestShareTarget.prototype.initFields_ = function(fields) {772 for(var field in fields) {773 if (this.hasOwnProperty(field))774 this[field] = fields[field];775 }776 };777 ManifestShareTarget.validate = function(messageValidator, offset) {778 var err;779 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);780 if (err !== validator.validationError.NONE)781 return err;782 var kVersionSizes = [783 {version: 0, numBytes: 32}784 ];785 err = messageValidator.validateStructVersion(offset, kVersionSizes);786 if (err !== validator.validationError.NONE)787 return err;788 // validate ManifestShareTarget.action789 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, url$.Url, false);790 if (err !== validator.validationError.NONE)791 return err;792 // validate ManifestShareTarget.method793 err = messageValidator.validateEnum(offset + codec.kStructHeaderSize + 8, ManifestShareTarget.Method);794 if (err !== validator.validationError.NONE)795 return err;796 // validate ManifestShareTarget.enctype797 err = messageValidator.validateEnum(offset + codec.kStructHeaderSize + 12, ManifestShareTarget.Enctype);798 if (err !== validator.validationError.NONE)799 return err;800 // validate ManifestShareTarget.params801 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 16, ManifestShareTargetParams, false);802 if (err !== validator.validationError.NONE)803 return err;804 return validator.validationError.NONE;805 };806 ManifestShareTarget.encodedSize = codec.kStructHeaderSize + 24;807 ManifestShareTarget.decode = function(decoder) {808 var packed;809 var val = new ManifestShareTarget();810 var numberOfBytes = decoder.readUint32();811 var version = decoder.readUint32();812 val.action =813 decoder.decodeStructPointer(url$.Url);814 val.method =815 decoder.decodeStruct(codec.Int32);816 val.enctype =817 decoder.decodeStruct(codec.Int32);818 val.params =819 decoder.decodeStructPointer(ManifestShareTargetParams);820 return val;821 };822 ManifestShareTarget.encode = function(encoder, val) {823 var packed;824 encoder.writeUint32(ManifestShareTarget.encodedSize);825 encoder.writeUint32(0);826 encoder.encodeStructPointer(url$.Url, val.action);827 encoder.encodeStruct(codec.Int32, val.method);828 encoder.encodeStruct(codec.Int32, val.enctype);829 encoder.encodeStructPointer(ManifestShareTargetParams, val.params);830 };831 function ManifestFileHandler(values) {832 this.initDefaults_();833 this.initFields_(values);834 }835 ManifestFileHandler.prototype.initDefaults_ = function() {836 this.action = null;837 this.name = null;838 this.accept = null;839 };840 ManifestFileHandler.prototype.initFields_ = function(fields) {841 for(var field in fields) {842 if (this.hasOwnProperty(field))843 this[field] = fields[field];844 }845 };846 ManifestFileHandler.validate = function(messageValidator, offset) {847 var err;848 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);849 if (err !== validator.validationError.NONE)850 return err;851 var kVersionSizes = [852 {version: 0, numBytes: 32}853 ];854 err = messageValidator.validateStructVersion(offset, kVersionSizes);855 if (err !== validator.validationError.NONE)856 return err;857 // validate ManifestFileHandler.action858 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, url$.Url, false);859 if (err !== validator.validationError.NONE)860 return err;861 // validate ManifestFileHandler.name862 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 8, string16$.String16, false);863 if (err !== validator.validationError.NONE)864 return err;865 // validate ManifestFileHandler.accept866 err = messageValidator.validateMapPointer(offset + codec.kStructHeaderSize + 16, false, new codec.PointerTo(string16$.String16), new codec.ArrayOf(new codec.PointerTo(string16$.String16)), false);867 if (err !== validator.validationError.NONE)868 return err;869 return validator.validationError.NONE;870 };871 ManifestFileHandler.encodedSize = codec.kStructHeaderSize + 24;872 ManifestFileHandler.decode = function(decoder) {873 var packed;874 var val = new ManifestFileHandler();875 var numberOfBytes = decoder.readUint32();876 var version = decoder.readUint32();877 val.action =878 decoder.decodeStructPointer(url$.Url);879 val.name =880 decoder.decodeStructPointer(string16$.String16);881 val.accept =882 decoder.decodeMapPointer(new codec.PointerTo(string16$.String16), new codec.ArrayOf(new codec.PointerTo(string16$.String16)));883 return val;884 };885 ManifestFileHandler.encode = function(encoder, val) {886 var packed;887 encoder.writeUint32(ManifestFileHandler.encodedSize);888 encoder.writeUint32(0);889 encoder.encodeStructPointer(url$.Url, val.action);890 encoder.encodeStructPointer(string16$.String16, val.name);891 encoder.encodeMapPointer(new codec.PointerTo(string16$.String16), new codec.ArrayOf(new codec.PointerTo(string16$.String16)), val.accept);892 };893 function ManifestDebugInfo(values) {894 this.initDefaults_();895 this.initFields_(values);896 }897 ManifestDebugInfo.prototype.initDefaults_ = function() {898 this.errors = null;899 this.rawManifest = null;900 };901 ManifestDebugInfo.prototype.initFields_ = function(fields) {902 for(var field in fields) {903 if (this.hasOwnProperty(field))904 this[field] = fields[field];905 }906 };907 ManifestDebugInfo.validate = function(messageValidator, offset) {908 var err;909 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);910 if (err !== validator.validationError.NONE)911 return err;912 var kVersionSizes = [913 {version: 0, numBytes: 24}914 ];915 err = messageValidator.validateStructVersion(offset, kVersionSizes);916 if (err !== validator.validationError.NONE)917 return err;918 // validate ManifestDebugInfo.errors919 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 0, 8, new codec.PointerTo(ManifestError), false, [0], 0);920 if (err !== validator.validationError.NONE)921 return err;922 // validate ManifestDebugInfo.rawManifest923 err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 8, false)924 if (err !== validator.validationError.NONE)925 return err;926 return validator.validationError.NONE;927 };928 ManifestDebugInfo.encodedSize = codec.kStructHeaderSize + 16;929 ManifestDebugInfo.decode = function(decoder) {930 var packed;931 var val = new ManifestDebugInfo();932 var numberOfBytes = decoder.readUint32();933 var version = decoder.readUint32();934 val.errors =935 decoder.decodeArrayPointer(new codec.PointerTo(ManifestError));936 val.rawManifest =937 decoder.decodeStruct(codec.String);938 return val;939 };940 ManifestDebugInfo.encode = function(encoder, val) {941 var packed;942 encoder.writeUint32(ManifestDebugInfo.encodedSize);943 encoder.writeUint32(0);944 encoder.encodeArrayPointer(new codec.PointerTo(ManifestError), val.errors);945 encoder.encodeStruct(codec.String, val.rawManifest);946 };947 function ManifestError(values) {948 this.initDefaults_();949 this.initFields_(values);950 }951 ManifestError.prototype.initDefaults_ = function() {952 this.message = null;953 this.critical = false;954 this.line = 0;955 this.column = 0;956 };957 ManifestError.prototype.initFields_ = function(fields) {958 for(var field in fields) {959 if (this.hasOwnProperty(field))960 this[field] = fields[field];961 }962 };963 ManifestError.validate = function(messageValidator, offset) {964 var err;965 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);966 if (err !== validator.validationError.NONE)967 return err;968 var kVersionSizes = [969 {version: 0, numBytes: 32}970 ];971 err = messageValidator.validateStructVersion(offset, kVersionSizes);972 if (err !== validator.validationError.NONE)973 return err;974 // validate ManifestError.message975 err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 0, false)976 if (err !== validator.validationError.NONE)977 return err;978 return validator.validationError.NONE;979 };980 ManifestError.encodedSize = codec.kStructHeaderSize + 24;981 ManifestError.decode = function(decoder) {982 var packed;983 var val = new ManifestError();984 var numberOfBytes = decoder.readUint32();985 var version = decoder.readUint32();986 val.message =987 decoder.decodeStruct(codec.String);988 packed = decoder.readUint8();989 val.critical = (packed >> 0) & 1 ? true : false;990 decoder.skip(1);991 decoder.skip(1);992 decoder.skip(1);993 val.line =994 decoder.decodeStruct(codec.Uint32);995 val.column =996 decoder.decodeStruct(codec.Uint32);997 decoder.skip(1);998 decoder.skip(1);999 decoder.skip(1);1000 decoder.skip(1);1001 return val;1002 };1003 ManifestError.encode = function(encoder, val) {1004 var packed;1005 encoder.writeUint32(ManifestError.encodedSize);1006 encoder.writeUint32(0);1007 encoder.encodeStruct(codec.String, val.message);1008 packed = 0;1009 packed |= (val.critical & 1) << 01010 encoder.writeUint8(packed);1011 encoder.skip(1);1012 encoder.skip(1);1013 encoder.skip(1);1014 encoder.encodeStruct(codec.Uint32, val.line);1015 encoder.encodeStruct(codec.Uint32, val.column);1016 encoder.skip(1);1017 encoder.skip(1);1018 encoder.skip(1);1019 encoder.skip(1);1020 };1021 exports.Manifest = Manifest;1022 exports.ManifestShortcutItem = ManifestShortcutItem;1023 exports.ManifestImageResource = ManifestImageResource;1024 exports.ManifestFileFilter = ManifestFileFilter;1025 exports.ManifestProtocolHandler = ManifestProtocolHandler;1026 exports.ManifestUrlHandler = ManifestUrlHandler;1027 exports.ManifestRelatedApplication = ManifestRelatedApplication;1028 exports.ManifestShareTargetParams = ManifestShareTargetParams;1029 exports.ManifestShareTarget = ManifestShareTarget;1030 exports.ManifestFileHandler = ManifestFileHandler;1031 exports.ManifestDebugInfo = ManifestDebugInfo;1032 exports.ManifestError = ManifestError;...
omnibox.mojom.js
Source:omnibox.mojom.js
1// chrome/common/search/omnibox.mojom.js is auto generated by mojom_bindings_generator.py, do not edit2// Copyright 2014 The Chromium Authors. All rights reserved.3// Use of this source code is governed by a BSD-style license that can be4// found in the LICENSE file.5'use strict';6(function() {7 var mojomId = 'chrome/common/search/omnibox.mojom';8 if (mojo.internal.isMojomLoaded(mojomId)) {9 console.warn('The following mojom is loaded multiple times: ' + mojomId);10 return;11 }12 mojo.internal.markMojomLoaded(mojomId);13 var bindings = mojo;14 var associatedBindings = mojo;15 var codec = mojo.internal;16 var validator = mojo.internal;17 var exports = mojo.internal.exposeNamespace('search.mojom');18 var string16$ =19 mojo.internal.exposeNamespace('mojoBase.mojom');20 if (mojo.config.autoLoadMojomDeps) {21 mojo.internal.loadMojomIfNecessary(22 'mojo/public/mojom/base/string16.mojom', '../../../mojo/public/mojom/base/string16.mojom.js');23 }24 var url$ =25 mojo.internal.exposeNamespace('url.mojom');26 if (mojo.config.autoLoadMojomDeps) {27 mojo.internal.loadMojomIfNecessary(28 'url/mojom/url.mojom', '../../../url/mojom/url.mojom.js');29 }30 function ACMatchClassification(values) {31 this.initDefaults_();32 this.initFields_(values);33 }34 ACMatchClassification.prototype.initDefaults_ = function() {35 this.offset = 0;36 this.style = 0;37 };38 ACMatchClassification.prototype.initFields_ = function(fields) {39 for(var field in fields) {40 if (this.hasOwnProperty(field))41 this[field] = fields[field];42 }43 };44 ACMatchClassification.validate = function(messageValidator, offset) {45 var err;46 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);47 if (err !== validator.validationError.NONE)48 return err;49 var kVersionSizes = [50 {version: 0, numBytes: 16}51 ];52 err = messageValidator.validateStructVersion(offset, kVersionSizes);53 if (err !== validator.validationError.NONE)54 return err;55 return validator.validationError.NONE;56 };57 ACMatchClassification.encodedSize = codec.kStructHeaderSize + 8;58 ACMatchClassification.decode = function(decoder) {59 var packed;60 var val = new ACMatchClassification();61 var numberOfBytes = decoder.readUint32();62 var version = decoder.readUint32();63 val.offset =64 decoder.decodeStruct(codec.Uint32);65 val.style =66 decoder.decodeStruct(codec.Int32);67 return val;68 };69 ACMatchClassification.encode = function(encoder, val) {70 var packed;71 encoder.writeUint32(ACMatchClassification.encodedSize);72 encoder.writeUint32(0);73 encoder.encodeStruct(codec.Uint32, val.offset);74 encoder.encodeStruct(codec.Int32, val.style);75 };76 function AutocompleteMatch(values) {77 this.initDefaults_();78 this.initFields_(values);79 }80 AutocompleteMatch.prototype.initDefaults_ = function() {81 this.allowedToBeDefaultMatch = false;82 this.isSearchType = false;83 this.swapContentsAndDescription = false;84 this.supportsDeletion = false;85 this.suggestionGroupId = 0;86 this.contents = null;87 this.contentsClass = null;88 this.description = null;89 this.descriptionClass = null;90 this.destinationUrl = null;91 this.inlineAutocompletion = null;92 this.fillIntoEdit = null;93 this.iconUrl = null;94 this.imageDominantColor = null;95 this.imageUrl = null;96 this.type = null;97 };98 AutocompleteMatch.prototype.initFields_ = function(fields) {99 for(var field in fields) {100 if (this.hasOwnProperty(field))101 this[field] = fields[field];102 }103 };104 AutocompleteMatch.validate = function(messageValidator, offset) {105 var err;106 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);107 if (err !== validator.validationError.NONE)108 return err;109 var kVersionSizes = [110 {version: 0, numBytes: 104}111 ];112 err = messageValidator.validateStructVersion(offset, kVersionSizes);113 if (err !== validator.validationError.NONE)114 return err;115 // validate AutocompleteMatch.contents116 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 8, string16$.String16, false);117 if (err !== validator.validationError.NONE)118 return err;119 // validate AutocompleteMatch.contentsClass120 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 16, 8, new codec.PointerTo(ACMatchClassification), false, [0], 0);121 if (err !== validator.validationError.NONE)122 return err;123 // validate AutocompleteMatch.description124 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 24, string16$.String16, false);125 if (err !== validator.validationError.NONE)126 return err;127 // validate AutocompleteMatch.descriptionClass128 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 32, 8, new codec.PointerTo(ACMatchClassification), false, [0], 0);129 if (err !== validator.validationError.NONE)130 return err;131 // validate AutocompleteMatch.destinationUrl132 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 40, url$.Url, false);133 if (err !== validator.validationError.NONE)134 return err;135 // validate AutocompleteMatch.inlineAutocompletion136 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 48, string16$.String16, false);137 if (err !== validator.validationError.NONE)138 return err;139 // validate AutocompleteMatch.fillIntoEdit140 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 56, string16$.String16, false);141 if (err !== validator.validationError.NONE)142 return err;143 // validate AutocompleteMatch.iconUrl144 err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 64, false)145 if (err !== validator.validationError.NONE)146 return err;147 // validate AutocompleteMatch.imageDominantColor148 err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 72, false)149 if (err !== validator.validationError.NONE)150 return err;151 // validate AutocompleteMatch.imageUrl152 err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 80, false)153 if (err !== validator.validationError.NONE)154 return err;155 // validate AutocompleteMatch.type156 err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 88, false)157 if (err !== validator.validationError.NONE)158 return err;159 return validator.validationError.NONE;160 };161 AutocompleteMatch.encodedSize = codec.kStructHeaderSize + 96;162 AutocompleteMatch.decode = function(decoder) {163 var packed;164 var val = new AutocompleteMatch();165 var numberOfBytes = decoder.readUint32();166 var version = decoder.readUint32();167 packed = decoder.readUint8();168 val.allowedToBeDefaultMatch = (packed >> 0) & 1 ? true : false;169 val.isSearchType = (packed >> 1) & 1 ? true : false;170 val.swapContentsAndDescription = (packed >> 2) & 1 ? true : false;171 val.supportsDeletion = (packed >> 3) & 1 ? true : false;172 decoder.skip(1);173 decoder.skip(1);174 decoder.skip(1);175 val.suggestionGroupId =176 decoder.decodeStruct(codec.Int32);177 val.contents =178 decoder.decodeStructPointer(string16$.String16);179 val.contentsClass =180 decoder.decodeArrayPointer(new codec.PointerTo(ACMatchClassification));181 val.description =182 decoder.decodeStructPointer(string16$.String16);183 val.descriptionClass =184 decoder.decodeArrayPointer(new codec.PointerTo(ACMatchClassification));185 val.destinationUrl =186 decoder.decodeStructPointer(url$.Url);187 val.inlineAutocompletion =188 decoder.decodeStructPointer(string16$.String16);189 val.fillIntoEdit =190 decoder.decodeStructPointer(string16$.String16);191 val.iconUrl =192 decoder.decodeStruct(codec.String);193 val.imageDominantColor =194 decoder.decodeStruct(codec.String);195 val.imageUrl =196 decoder.decodeStruct(codec.String);197 val.type =198 decoder.decodeStruct(codec.String);199 return val;200 };201 AutocompleteMatch.encode = function(encoder, val) {202 var packed;203 encoder.writeUint32(AutocompleteMatch.encodedSize);204 encoder.writeUint32(0);205 packed = 0;206 packed |= (val.allowedToBeDefaultMatch & 1) << 0207 packed |= (val.isSearchType & 1) << 1208 packed |= (val.swapContentsAndDescription & 1) << 2209 packed |= (val.supportsDeletion & 1) << 3210 encoder.writeUint8(packed);211 encoder.skip(1);212 encoder.skip(1);213 encoder.skip(1);214 encoder.encodeStruct(codec.Int32, val.suggestionGroupId);215 encoder.encodeStructPointer(string16$.String16, val.contents);216 encoder.encodeArrayPointer(new codec.PointerTo(ACMatchClassification), val.contentsClass);217 encoder.encodeStructPointer(string16$.String16, val.description);218 encoder.encodeArrayPointer(new codec.PointerTo(ACMatchClassification), val.descriptionClass);219 encoder.encodeStructPointer(url$.Url, val.destinationUrl);220 encoder.encodeStructPointer(string16$.String16, val.inlineAutocompletion);221 encoder.encodeStructPointer(string16$.String16, val.fillIntoEdit);222 encoder.encodeStruct(codec.String, val.iconUrl);223 encoder.encodeStruct(codec.String, val.imageDominantColor);224 encoder.encodeStruct(codec.String, val.imageUrl);225 encoder.encodeStruct(codec.String, val.type);226 };227 function SuggestionGroup(values) {228 this.initDefaults_();229 this.initFields_(values);230 }231 SuggestionGroup.prototype.initDefaults_ = function() {232 this.header = null;233 this.hidden = false;234 };235 SuggestionGroup.prototype.initFields_ = function(fields) {236 for(var field in fields) {237 if (this.hasOwnProperty(field))238 this[field] = fields[field];239 }240 };241 SuggestionGroup.validate = function(messageValidator, offset) {242 var err;243 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);244 if (err !== validator.validationError.NONE)245 return err;246 var kVersionSizes = [247 {version: 0, numBytes: 24}248 ];249 err = messageValidator.validateStructVersion(offset, kVersionSizes);250 if (err !== validator.validationError.NONE)251 return err;252 // validate SuggestionGroup.header253 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, string16$.String16, false);254 if (err !== validator.validationError.NONE)255 return err;256 return validator.validationError.NONE;257 };258 SuggestionGroup.encodedSize = codec.kStructHeaderSize + 16;259 SuggestionGroup.decode = function(decoder) {260 var packed;261 var val = new SuggestionGroup();262 var numberOfBytes = decoder.readUint32();263 var version = decoder.readUint32();264 val.header =265 decoder.decodeStructPointer(string16$.String16);266 packed = decoder.readUint8();267 val.hidden = (packed >> 0) & 1 ? true : false;268 decoder.skip(1);269 decoder.skip(1);270 decoder.skip(1);271 decoder.skip(1);272 decoder.skip(1);273 decoder.skip(1);274 decoder.skip(1);275 return val;276 };277 SuggestionGroup.encode = function(encoder, val) {278 var packed;279 encoder.writeUint32(SuggestionGroup.encodedSize);280 encoder.writeUint32(0);281 encoder.encodeStructPointer(string16$.String16, val.header);282 packed = 0;283 packed |= (val.hidden & 1) << 0284 encoder.writeUint8(packed);285 encoder.skip(1);286 encoder.skip(1);287 encoder.skip(1);288 encoder.skip(1);289 encoder.skip(1);290 encoder.skip(1);291 encoder.skip(1);292 };293 function AutocompleteResult(values) {294 this.initDefaults_();295 this.initFields_(values);296 }297 AutocompleteResult.prototype.initDefaults_ = function() {298 this.input = null;299 this.suggestionGroupsMap = null;300 this.matches = null;301 };302 AutocompleteResult.prototype.initFields_ = function(fields) {303 for(var field in fields) {304 if (this.hasOwnProperty(field))305 this[field] = fields[field];306 }307 };308 AutocompleteResult.validate = function(messageValidator, offset) {309 var err;310 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);311 if (err !== validator.validationError.NONE)312 return err;313 var kVersionSizes = [314 {version: 0, numBytes: 32}315 ];316 err = messageValidator.validateStructVersion(offset, kVersionSizes);317 if (err !== validator.validationError.NONE)318 return err;319 // validate AutocompleteResult.input320 err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, string16$.String16, false);321 if (err !== validator.validationError.NONE)322 return err;323 // validate AutocompleteResult.suggestionGroupsMap324 err = messageValidator.validateMapPointer(offset + codec.kStructHeaderSize + 8, false, codec.Int32, new codec.PointerTo(SuggestionGroup), false);325 if (err !== validator.validationError.NONE)326 return err;327 // validate AutocompleteResult.matches328 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 16, 8, new codec.PointerTo(AutocompleteMatch), false, [0], 0);329 if (err !== validator.validationError.NONE)330 return err;331 return validator.validationError.NONE;332 };333 AutocompleteResult.encodedSize = codec.kStructHeaderSize + 24;334 AutocompleteResult.decode = function(decoder) {335 var packed;336 var val = new AutocompleteResult();337 var numberOfBytes = decoder.readUint32();338 var version = decoder.readUint32();339 val.input =340 decoder.decodeStructPointer(string16$.String16);341 val.suggestionGroupsMap =342 decoder.decodeMapPointer(codec.Int32, new codec.PointerTo(SuggestionGroup));343 val.matches =344 decoder.decodeArrayPointer(new codec.PointerTo(AutocompleteMatch));345 return val;346 };347 AutocompleteResult.encode = function(encoder, val) {348 var packed;349 encoder.writeUint32(AutocompleteResult.encodedSize);350 encoder.writeUint32(0);351 encoder.encodeStructPointer(string16$.String16, val.input);352 encoder.encodeMapPointer(codec.Int32, new codec.PointerTo(SuggestionGroup), val.suggestionGroupsMap);353 encoder.encodeArrayPointer(new codec.PointerTo(AutocompleteMatch), val.matches);354 };355 exports.ACMatchClassification = ACMatchClassification;356 exports.AutocompleteMatch = AutocompleteMatch;357 exports.SuggestionGroup = SuggestionGroup;358 exports.AutocompleteResult = AutocompleteResult;...
string16.mojom.js
Source:string16.mojom.js
1// mojo/public/mojom/base/string16.mojom.js is auto generated by mojom_bindings_generator.py, do not edit2// Copyright 2014 The Chromium Authors. All rights reserved.3// Use of this source code is governed by a BSD-style license that can be4// found in the LICENSE file.5'use strict';6(function() {7 var mojomId = 'mojo/public/mojom/base/string16.mojom';8 if (mojo.internal.isMojomLoaded(mojomId)) {9 console.warn('The following mojom is loaded multiple times: ' + mojomId);10 return;11 }12 mojo.internal.markMojomLoaded(mojomId);13 var bindings = mojo;14 var associatedBindings = mojo;15 var codec = mojo.internal;16 var validator = mojo.internal;17 var exports = mojo.internal.exposeNamespace('mojoBase.mojom');18 var big_buffer$ =19 mojo.internal.exposeNamespace('mojoBase.mojom');20 if (mojo.config.autoLoadMojomDeps) {21 mojo.internal.loadMojomIfNecessary(22 'mojo/public/mojom/base/big_buffer.mojom', 'big_buffer.mojom.js');23 }24 function String16(values) {25 this.initDefaults_();26 this.initFields_(values);27 }28 String16.prototype.initDefaults_ = function() {29 this.data = null;30 };31 String16.prototype.initFields_ = function(fields) {32 for(var field in fields) {33 if (this.hasOwnProperty(field))34 this[field] = fields[field];35 }36 };37 String16.validate = function(messageValidator, offset) {38 var err;39 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);40 if (err !== validator.validationError.NONE)41 return err;42 var kVersionSizes = [43 {version: 0, numBytes: 16}44 ];45 err = messageValidator.validateStructVersion(offset, kVersionSizes);46 if (err !== validator.validationError.NONE)47 return err;48 // validate String16.data49 err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 0, 2, codec.Uint16, false, [0], 0);50 if (err !== validator.validationError.NONE)51 return err;52 return validator.validationError.NONE;53 };54 String16.encodedSize = codec.kStructHeaderSize + 8;55 String16.decode = function(decoder) {56 var packed;57 var val = new String16();58 var numberOfBytes = decoder.readUint32();59 var version = decoder.readUint32();60 val.data =61 decoder.decodeArrayPointer(codec.Uint16);62 return val;63 };64 String16.encode = function(encoder, val) {65 var packed;66 encoder.writeUint32(String16.encodedSize);67 encoder.writeUint32(0);68 encoder.encodeArrayPointer(codec.Uint16, val.data);69 };70 function BigString16(values) {71 this.initDefaults_();72 this.initFields_(values);73 }74 BigString16.prototype.initDefaults_ = function() {75 this.data = null;76 };77 BigString16.prototype.initFields_ = function(fields) {78 for(var field in fields) {79 if (this.hasOwnProperty(field))80 this[field] = fields[field];81 }82 };83 BigString16.validate = function(messageValidator, offset) {84 var err;85 err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);86 if (err !== validator.validationError.NONE)87 return err;88 var kVersionSizes = [89 {version: 0, numBytes: 24}90 ];91 err = messageValidator.validateStructVersion(offset, kVersionSizes);92 if (err !== validator.validationError.NONE)93 return err;94 // validate BigString16.data95 err = messageValidator.validateUnion(offset + codec.kStructHeaderSize + 0, big_buffer$.BigBuffer, false);96 if (err !== validator.validationError.NONE)97 return err;98 return validator.validationError.NONE;99 };100 BigString16.encodedSize = codec.kStructHeaderSize + 16;101 BigString16.decode = function(decoder) {102 var packed;103 var val = new BigString16();104 var numberOfBytes = decoder.readUint32();105 var version = decoder.readUint32();106 val.data =107 decoder.decodeStruct(big_buffer$.BigBuffer);108 return val;109 };110 BigString16.encode = function(encoder, val) {111 var packed;112 encoder.writeUint32(BigString16.encodedSize);113 encoder.writeUint32(0);114 encoder.encodeStruct(big_buffer$.BigBuffer, val.data);115 };116 exports.String16 = String16;117 exports.BigString16 = BigString16;...
Using AI Code Generation
1var wptexturize = require('wptexturize');2console.log(wptexturize.string16('This is a test'));3var wptexturize = require('wptexturize');4console.log(wptexturize.string('This is a test'));5var wptexturize = require('wptexturize');6console.log(wptexturize.string('This is a test'));7var wptexturize = require('wptexturize');8console.log(wptexturize.string('This is a test'));9var wptexturize = require('wptexturize');10console.log(wptexturize.string('This is a test'));11var wptexturize = require('wptexturize');12console.log(wptexturize.string('This is a test'));13var wptexturize = require('wptexturize');14console.log(wptexturize.string('This is a test'));15var wptexturize = require('wptexturize');16console.log(wptexturize.string('This is a test'));17var wptexturize = require('wptexturize');18console.log(wptexturize.string('This is a test'));19var wptexturize = require('wptexturize');20console.log(wptexturize.string('This is a test'));21var wptexturize = require('wptexturize
Using AI Code Generation
1var string16 = require('wptextpattern').string16;2var str = "hello";3console.log(string16(str, 4));4var string16 = require('wptextpattern').string16;5var str = "hello world";6console.log(string16(str, 4));7var string16 = require('wptextpattern').string16;8var str = "hello world";9console.log(string16(str, 4, true));10var string16 = require('wptextpattern').string16;11var str = "hello world";12console.log(string16(str, 4, false));13var string16 = require('wptextpattern').string16;14var str = "hello world";15console.log(string16(str, 4, false, true));16var string16 = require('wptextpattern').string16;17var str = "hello world";18console.log(string16(str, 4, false, false));19var string16 = require('wptextpattern').string16;20var str = "hello world";21console.log(string16(str, 4, false, false, true));22var string16 = require('wptextpattern').string16;23var str = "hello world";24console.log(string16(str, 4, false, false, false));25var string16 = require('wptextpattern').string16;26var str = "hello world";27console.log(string16(str, 4, false, false, false, true));
Using AI Code Generation
1var textpattern = require('wptextpattern').string16;2var text = "Hello World";3console.log(textpattern.toHex(text));4console.log(textpattern.toBase64(text));5console.log(textpattern.toBase32(text));6console.log(textpattern.toBase16(text));7console.log(textpattern.toBase36(text));8console.log(textpattern.toBase58(text));9console.log(textpattern.toBase62(text));10console.log(textpattern.toBase64Url(text));11console.log(textpattern.toBase32Url(text));12console.log(textpattern.toBase16Url(text));13console.log(textpattern.toBase36Url(text));14console.log(textpattern.toBase58Url(text));15console.log(textpattern.toBase62Url(text));16var textpattern = require('wptextpattern').string32;17var text = "Hello World";18console.log(textpattern.toHex(text));19console.log(textpattern.toBase64(text));20console.log(textpattern.toBase32(text));21console.log(textpattern.toBase16(text));22console.log(textpattern.toBase36(text));23console.log(textpattern.toBase58(text));24console.log(textpattern.toBase62(text));25console.log(textpattern.toBase64Url(text));26console.log(textpattern.toBase32Url(text));27console.log(textpattern.toBase16Url(text));28console.log(textpattern.toBase36Url(text));29console.log(textpattern.toBase58Url(text));30console.log(textpattern.toBase62Url(text));31var textpattern = require('wptextpattern').string36;32var text = "Hello World";33console.log(textpattern.toHex(text));34console.log(textpattern.toBase64(text));35console.log(textpattern.toBase32(text));36console.log(textpattern.toBase16(text));37console.log(textpattern.toBase36(text));38console.log(textpattern.toBase58(text));39console.log(textpattern.toBase62(text));40console.log(textpattern.toBase64Url(text));41console.log(textpattern.toBase32Url(text));42console.log(textpattern.toBase16Url(text));43console.log(textpattern.toBase36Url(text));44console.log(textpattern.toBase58Url(text));45console.log(textpattern.toBase62Url(text));46var textpattern = require('wptextpattern
Using AI Code Generation
1var wptools = require('wptools');2var myWiki = wptools.page('Albert_Einstein');3myWiki.string16('infobox').then(function (result) {4 console.log(result);5});6var wptools = require('wptools');7var myWiki = wptools.page('Albert_Einstein');8myWiki.string16('infobox').then(function (result) {9 console.log(result);10});11var wptools = require('wptools');12var myWiki = wptools.page('Albert_Einstein');13myWiki.string16('infobox').then(function (result) {14 console.log(result);15});16var wptools = require('wptools');17var myWiki = wptools.page('Albert_Einstein');18myWiki.string16('infobox').then(function (result) {19 console.log(result);20});21var wptools = require('wptools');22var myWiki = wptools.page('Albert_Einstein');23myWiki.string16('infobox').then(function (result) {24 console.log(result);25});26var wptools = require('wptools');27var myWiki = wptools.page('Albert_Einstein');28myWiki.string16('infobox').then(function (result) {29 console.log(result);30});31var wptools = require('wptools');32var myWiki = wptools.page('Albert_Einstein');33myWiki.string16('infobox').then(function (result) {34 console.log(result);35});36var wptools = require('wptools');37var myWiki = wptools.page('Albert_Einstein');38myWiki.string16('infobox').then(function (result) {39 console.log(result);40});41var wptools = require('wptools');42var myWiki = wptools.page('Albert_Einstein');43myWiki.string16('infobox').then(function (result) {44 console.log(result);45});
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!