text: // ui/webui/resources/cr_components/most_visited/most_visited.mojom.js is auto generated by mojom_bindings_generator.py, do not edit
  
  // Copyright 2014 The Chromium Authors. All rights reserved.
  // Use of this source code is governed by a BSD-style license that can be
  // found in the LICENSE file.
  
  'use strict';
  
  (function() {
    var mojomId = 'ui/webui/resources/cr_components/most_visited/most_visited.mojom';
    if (mojo.internal.isMojomLoaded(mojomId)) {
      console.warn('The following mojom is loaded multiple times: ' + mojomId);
      return;
    }
    mojo.internal.markMojomLoaded(mojomId);
    var bindings = mojo;
    var associatedBindings = mojo;
    var codec = mojo.internal;
    var validator = mojo.internal;
  
    var exports = mojo.internal.exposeNamespace('mostVisited.mojom');
    var text_direction$ =
        mojo.internal.exposeNamespace('mojoBase.mojom');
    if (mojo.config.autoLoadMojomDeps) {
      mojo.internal.loadMojomIfNecessary(
          'mojo/public/mojom/base/text_direction.mojom', '../../../../../mojo/public/mojom/base/text_direction.mojom.js');
    }
    var time$ =
        mojo.internal.exposeNamespace('mojoBase.mojom');
    if (mojo.config.autoLoadMojomDeps) {
      mojo.internal.loadMojomIfNecessary(
          'mojo/public/mojom/base/time.mojom', '../../../../../mojo/public/mojom/base/time.mojom.js');
    }
    var skcolor$ =
        mojo.internal.exposeNamespace('skia.mojom');
    if (mojo.config.autoLoadMojomDeps) {
      mojo.internal.loadMojomIfNecessary(
          'skia/public/mojom/skcolor.mojom', '../../../../../skia/public/mojom/skcolor.mojom.js');
    }
    var url$ =
        mojo.internal.exposeNamespace('url.mojom');
    if (mojo.config.autoLoadMojomDeps) {
      mojo.internal.loadMojomIfNecessary(
          'url/mojom/url.mojom', '../../../../../url/mojom/url.mojom.js');
    }
  
  
  
    function MostVisitedTile(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedTile.prototype.initDefaults_ = function() {
      this.title = null;
      this.titleDirection = 0;
      this.isQueryTile = false;
      this.url = null;
      this.source = 0;
      this.titleSource = 0;
      this.dataGenerationTime = null;
    };
    MostVisitedTile.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedTile.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 48}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedTile.title
      err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 0, false)
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedTile.titleDirection
      err = messageValidator.validateEnum(offset + codec.kStructHeaderSize + 8, text_direction$.TextDirection);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedTile.url
      err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 16, url$.Url, false);
      if (err !== validator.validationError.NONE)
          return err;
  
  
  
  
  
      // validate MostVisitedTile.dataGenerationTime
      err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 32, time$.Time, false);
      if (err !== validator.validationError.NONE)
          return err;
  
      return validator.validationError.NONE;
    };
  
    MostVisitedTile.encodedSize = codec.kStructHeaderSize + 40;
  
    MostVisitedTile.decode = function(decoder) {
      var packed;
      var val = new MostVisitedTile();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      val.title =
          decoder.decodeStruct(codec.String);
      val.titleDirection =
          decoder.decodeStruct(new codec.Enum(text_direction$.TextDirection));
      packed = decoder.readUint8();
      val.isQueryTile = (packed >> 0) & 1 ? true : false;
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      val.url =
          decoder.decodeStructPointer(url$.Url);
      val.source =
          decoder.decodeStruct(codec.Int32);
      val.titleSource =
          decoder.decodeStruct(codec.Int32);
      val.dataGenerationTime =
          decoder.decodeStructPointer(time$.Time);
      return val;
    };
  
    MostVisitedTile.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedTile.encodedSize);
      encoder.writeUint32(0);
      encoder.encodeStruct(codec.String, val.title);
      encoder.encodeStruct(codec.Int32, val.titleDirection);
      packed = 0;
      packed |= (val.isQueryTile & 1) << 0
      encoder.writeUint8(packed);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.encodeStructPointer(url$.Url, val.url);
      encoder.encodeStruct(codec.Int32, val.source);
      encoder.encodeStruct(codec.Int32, val.titleSource);
      encoder.encodeStructPointer(time$.Time, val.dataGenerationTime);
    };
    function MostVisitedTheme(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedTheme.prototype.initDefaults_ = function() {
      this.backgroundColor = null;
      this.useWhiteTileIcon = false;
      this.useTitlePill = false;
      this.isDark = false;
    };
    MostVisitedTheme.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedTheme.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 24}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedTheme.backgroundColor
      err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, skcolor$.SkColor, false);
      if (err !== validator.validationError.NONE)
          return err;
  
  
  
  
      return validator.validationError.NONE;
    };
  
    MostVisitedTheme.encodedSize = codec.kStructHeaderSize + 16;
  
    MostVisitedTheme.decode = function(decoder) {
      var packed;
      var val = new MostVisitedTheme();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      val.backgroundColor =
          decoder.decodeStructPointer(skcolor$.SkColor);
      packed = decoder.readUint8();
      val.useWhiteTileIcon = (packed >> 0) & 1 ? true : false;
      val.useTitlePill = (packed >> 1) & 1 ? true : false;
      val.isDark = (packed >> 2) & 1 ? true : false;
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      return val;
    };
  
    MostVisitedTheme.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedTheme.encodedSize);
      encoder.writeUint32(0);
      encoder.encodeStructPointer(skcolor$.SkColor, val.backgroundColor);
      packed = 0;
      packed |= (val.useWhiteTileIcon & 1) << 0
      packed |= (val.useTitlePill & 1) << 1
      packed |= (val.isDark & 1) << 2
      encoder.writeUint8(packed);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
    };
    function MostVisitedInfo(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedInfo.prototype.initDefaults_ = function() {
      this.customLinksEnabled = false;
      this.visible = false;
      this.tiles = null;
    };
    MostVisitedInfo.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedInfo.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 24}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
  
  
  
      // validate MostVisitedInfo.tiles
      err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 8, 8, new codec.PointerTo(MostVisitedTile), false, [0], 0);
      if (err !== validator.validationError.NONE)
          return err;
  
      return validator.validationError.NONE;
    };
  
    MostVisitedInfo.encodedSize = codec.kStructHeaderSize + 16;
  
    MostVisitedInfo.decode = function(decoder) {
      var packed;
      var val = new MostVisitedInfo();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      packed = decoder.readUint8();
      val.customLinksEnabled = (packed >> 0) & 1 ? true : false;
      val.visible = (packed >> 1) & 1 ? true : false;
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      val.tiles =
          decoder.decodeArrayPointer(new codec.PointerTo(MostVisitedTile));
      return val;
    };
  
    MostVisitedInfo.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedInfo.encodedSize);
      encoder.writeUint32(0);
      packed = 0;
      packed |= (val.customLinksEnabled & 1) << 0
      packed |= (val.visible & 1) << 1
      encoder.writeUint8(packed);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.encodeArrayPointer(new codec.PointerTo(MostVisitedTile), val.tiles);
    };
    function MostVisitedPageHandlerFactory_CreatePageHandler_Params(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedPageHandlerFactory_CreatePageHandler_Params.prototype.initDefaults_ = function() {
      this.page = new MostVisitedPagePtr();
      this.handler = new bindings.InterfaceRequest();
    };
    MostVisitedPageHandlerFactory_CreatePageHandler_Params.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedPageHandlerFactory_CreatePageHandler_Params.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 24}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedPageHandlerFactory_CreatePageHandler_Params.page
      err = messageValidator.validateInterface(offset + codec.kStructHeaderSize + 0, false);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedPageHandlerFactory_CreatePageHandler_Params.handler
      err = messageValidator.validateInterfaceRequest(offset + codec.kStructHeaderSize + 8, false)
      if (err !== validator.validationError.NONE)
          return err;
  
      return validator.validationError.NONE;
    };
  
    MostVisitedPageHandlerFactory_CreatePageHandler_Params.encodedSize = codec.kStructHeaderSize + 16;
  
    MostVisitedPageHandlerFactory_CreatePageHandler_Params.decode = function(decoder) {
      var packed;
      var val = new MostVisitedPageHandlerFactory_CreatePageHandler_Params();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      val.page =
          decoder.decodeStruct(new codec.Interface(MostVisitedPagePtr));
      val.handler =
          decoder.decodeStruct(codec.InterfaceRequest);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      return val;
    };
  
    MostVisitedPageHandlerFactory_CreatePageHandler_Params.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedPageHandlerFactory_CreatePageHandler_Params.encodedSize);
      encoder.writeUint32(0);
      encoder.encodeStruct(new codec.Interface(MostVisitedPagePtr), val.page);
      encoder.encodeStruct(codec.InterfaceRequest, val.handler);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
    };
    function MostVisitedPageHandler_AddMostVisitedTile_Params(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedPageHandler_AddMostVisitedTile_Params.prototype.initDefaults_ = function() {
      this.url = null;
      this.title = null;
    };
    MostVisitedPageHandler_AddMostVisitedTile_Params.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedPageHandler_AddMostVisitedTile_Params.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 24}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedPageHandler_AddMostVisitedTile_Params.url
      err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, url$.Url, false);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedPageHandler_AddMostVisitedTile_Params.title
      err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 8, false)
      if (err !== validator.validationError.NONE)
          return err;
  
      return validator.validationError.NONE;
    };
  
    MostVisitedPageHandler_AddMostVisitedTile_Params.encodedSize = codec.kStructHeaderSize + 16;
  
    MostVisitedPageHandler_AddMostVisitedTile_Params.decode = function(decoder) {
      var packed;
      var val = new MostVisitedPageHandler_AddMostVisitedTile_Params();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      val.url =
          decoder.decodeStructPointer(url$.Url);
      val.title =
          decoder.decodeStruct(codec.String);
      return val;
    };
  
    MostVisitedPageHandler_AddMostVisitedTile_Params.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedPageHandler_AddMostVisitedTile_Params.encodedSize);
      encoder.writeUint32(0);
      encoder.encodeStructPointer(url$.Url, val.url);
      encoder.encodeStruct(codec.String, val.title);
    };
    function MostVisitedPageHandler_AddMostVisitedTile_ResponseParams(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedPageHandler_AddMostVisitedTile_ResponseParams.prototype.initDefaults_ = function() {
      this.success = false;
    };
    MostVisitedPageHandler_AddMostVisitedTile_ResponseParams.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedPageHandler_AddMostVisitedTile_ResponseParams.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 16}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      return validator.validationError.NONE;
    };
  
    MostVisitedPageHandler_AddMostVisitedTile_ResponseParams.encodedSize = codec.kStructHeaderSize + 8;
  
    MostVisitedPageHandler_AddMostVisitedTile_ResponseParams.decode = function(decoder) {
      var packed;
      var val = new MostVisitedPageHandler_AddMostVisitedTile_ResponseParams();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      packed = decoder.readUint8();
      val.success = (packed >> 0) & 1 ? true : false;
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      return val;
    };
  
    MostVisitedPageHandler_AddMostVisitedTile_ResponseParams.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedPageHandler_AddMostVisitedTile_ResponseParams.encodedSize);
      encoder.writeUint32(0);
      packed = 0;
      packed |= (val.success & 1) << 0
      encoder.writeUint8(packed);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
    };
    function MostVisitedPageHandler_DeleteMostVisitedTile_Params(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedPageHandler_DeleteMostVisitedTile_Params.prototype.initDefaults_ = function() {
      this.url = null;
    };
    MostVisitedPageHandler_DeleteMostVisitedTile_Params.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedPageHandler_DeleteMostVisitedTile_Params.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 16}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedPageHandler_DeleteMostVisitedTile_Params.url
      err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, url$.Url, false);
      if (err !== validator.validationError.NONE)
          return err;
  
      return validator.validationError.NONE;
    };
  
    MostVisitedPageHandler_DeleteMostVisitedTile_Params.encodedSize = codec.kStructHeaderSize + 8;
  
    MostVisitedPageHandler_DeleteMostVisitedTile_Params.decode = function(decoder) {
      var packed;
      var val = new MostVisitedPageHandler_DeleteMostVisitedTile_Params();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      val.url =
          decoder.decodeStructPointer(url$.Url);
      return val;
    };
  
    MostVisitedPageHandler_DeleteMostVisitedTile_Params.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedPageHandler_DeleteMostVisitedTile_Params.encodedSize);
      encoder.writeUint32(0);
      encoder.encodeStructPointer(url$.Url, val.url);
    };
    function MostVisitedPageHandler_ReorderMostVisitedTile_Params(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedPageHandler_ReorderMostVisitedTile_Params.prototype.initDefaults_ = function() {
      this.url = null;
      this.newPos = 0;
    };
    MostVisitedPageHandler_ReorderMostVisitedTile_Params.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedPageHandler_ReorderMostVisitedTile_Params.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 24}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedPageHandler_ReorderMostVisitedTile_Params.url
      err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, url$.Url, false);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      return validator.validationError.NONE;
    };
  
    MostVisitedPageHandler_ReorderMostVisitedTile_Params.encodedSize = codec.kStructHeaderSize + 16;
  
    MostVisitedPageHandler_ReorderMostVisitedTile_Params.decode = function(decoder) {
      var packed;
      var val = new MostVisitedPageHandler_ReorderMostVisitedTile_Params();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      val.url =
          decoder.decodeStructPointer(url$.Url);
      val.newPos =
          decoder.decodeStruct(codec.Uint8);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      return val;
    };
  
    MostVisitedPageHandler_ReorderMostVisitedTile_Params.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedPageHandler_ReorderMostVisitedTile_Params.encodedSize);
      encoder.writeUint32(0);
      encoder.encodeStructPointer(url$.Url, val.url);
      encoder.encodeStruct(codec.Uint8, val.newPos);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
    };
    function MostVisitedPageHandler_RestoreMostVisitedDefaults_Params(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedPageHandler_RestoreMostVisitedDefaults_Params.prototype.initDefaults_ = function() {
    };
    MostVisitedPageHandler_RestoreMostVisitedDefaults_Params.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedPageHandler_RestoreMostVisitedDefaults_Params.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 8}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
      return validator.validationError.NONE;
    };
  
    MostVisitedPageHandler_RestoreMostVisitedDefaults_Params.encodedSize = codec.kStructHeaderSize + 0;
  
    MostVisitedPageHandler_RestoreMostVisitedDefaults_Params.decode = function(decoder) {
      var packed;
      var val = new MostVisitedPageHandler_RestoreMostVisitedDefaults_Params();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      return val;
    };
  
    MostVisitedPageHandler_RestoreMostVisitedDefaults_Params.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedPageHandler_RestoreMostVisitedDefaults_Params.encodedSize);
      encoder.writeUint32(0);
    };
    function MostVisitedPageHandler_UndoMostVisitedTileAction_Params(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedPageHandler_UndoMostVisitedTileAction_Params.prototype.initDefaults_ = function() {
    };
    MostVisitedPageHandler_UndoMostVisitedTileAction_Params.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedPageHandler_UndoMostVisitedTileAction_Params.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 8}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
      return validator.validationError.NONE;
    };
  
    MostVisitedPageHandler_UndoMostVisitedTileAction_Params.encodedSize = codec.kStructHeaderSize + 0;
  
    MostVisitedPageHandler_UndoMostVisitedTileAction_Params.decode = function(decoder) {
      var packed;
      var val = new MostVisitedPageHandler_UndoMostVisitedTileAction_Params();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      return val;
    };
  
    MostVisitedPageHandler_UndoMostVisitedTileAction_Params.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedPageHandler_UndoMostVisitedTileAction_Params.encodedSize);
      encoder.writeUint32(0);
    };
    function MostVisitedPageHandler_UpdateMostVisitedInfo_Params(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedPageHandler_UpdateMostVisitedInfo_Params.prototype.initDefaults_ = function() {
    };
    MostVisitedPageHandler_UpdateMostVisitedInfo_Params.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedPageHandler_UpdateMostVisitedInfo_Params.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 8}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
      return validator.validationError.NONE;
    };
  
    MostVisitedPageHandler_UpdateMostVisitedInfo_Params.encodedSize = codec.kStructHeaderSize + 0;
  
    MostVisitedPageHandler_UpdateMostVisitedInfo_Params.decode = function(decoder) {
      var packed;
      var val = new MostVisitedPageHandler_UpdateMostVisitedInfo_Params();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      return val;
    };
  
    MostVisitedPageHandler_UpdateMostVisitedInfo_Params.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedPageHandler_UpdateMostVisitedInfo_Params.encodedSize);
      encoder.writeUint32(0);
    };
    function MostVisitedPageHandler_UpdateMostVisitedTile_Params(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedPageHandler_UpdateMostVisitedTile_Params.prototype.initDefaults_ = function() {
      this.url = null;
      this.newUrl = null;
      this.newTitle = null;
    };
    MostVisitedPageHandler_UpdateMostVisitedTile_Params.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedPageHandler_UpdateMostVisitedTile_Params.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 32}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedPageHandler_UpdateMostVisitedTile_Params.url
      err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, url$.Url, false);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedPageHandler_UpdateMostVisitedTile_Params.newUrl
      err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 8, url$.Url, false);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedPageHandler_UpdateMostVisitedTile_Params.newTitle
      err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 16, false)
      if (err !== validator.validationError.NONE)
          return err;
  
      return validator.validationError.NONE;
    };
  
    MostVisitedPageHandler_UpdateMostVisitedTile_Params.encodedSize = codec.kStructHeaderSize + 24;
  
    MostVisitedPageHandler_UpdateMostVisitedTile_Params.decode = function(decoder) {
      var packed;
      var val = new MostVisitedPageHandler_UpdateMostVisitedTile_Params();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      val.url =
          decoder.decodeStructPointer(url$.Url);
      val.newUrl =
          decoder.decodeStructPointer(url$.Url);
      val.newTitle =
          decoder.decodeStruct(codec.String);
      return val;
    };
  
    MostVisitedPageHandler_UpdateMostVisitedTile_Params.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedPageHandler_UpdateMostVisitedTile_Params.encodedSize);
      encoder.writeUint32(0);
      encoder.encodeStructPointer(url$.Url, val.url);
      encoder.encodeStructPointer(url$.Url, val.newUrl);
      encoder.encodeStruct(codec.String, val.newTitle);
    };
    function MostVisitedPageHandler_UpdateMostVisitedTile_ResponseParams(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedPageHandler_UpdateMostVisitedTile_ResponseParams.prototype.initDefaults_ = function() {
      this.success = false;
    };
    MostVisitedPageHandler_UpdateMostVisitedTile_ResponseParams.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedPageHandler_UpdateMostVisitedTile_ResponseParams.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 16}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      return validator.validationError.NONE;
    };
  
    MostVisitedPageHandler_UpdateMostVisitedTile_ResponseParams.encodedSize = codec.kStructHeaderSize + 8;
  
    MostVisitedPageHandler_UpdateMostVisitedTile_ResponseParams.decode = function(decoder) {
      var packed;
      var val = new MostVisitedPageHandler_UpdateMostVisitedTile_ResponseParams();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      packed = decoder.readUint8();
      val.success = (packed >> 0) & 1 ? true : false;
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      decoder.skip(1);
      return val;
    };
  
    MostVisitedPageHandler_UpdateMostVisitedTile_ResponseParams.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedPageHandler_UpdateMostVisitedTile_ResponseParams.encodedSize);
      encoder.writeUint32(0);
      packed = 0;
      packed |= (val.success & 1) << 0
      encoder.writeUint8(packed);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
      encoder.skip(1);
    };
    function MostVisitedPageHandler_OnMostVisitedTilesRendered_Params(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedPageHandler_OnMostVisitedTilesRendered_Params.prototype.initDefaults_ = function() {
      this.tiles = null;
      this.time = 0;
    };
    MostVisitedPageHandler_OnMostVisitedTilesRendered_Params.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedPageHandler_OnMostVisitedTilesRendered_Params.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 24}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedPageHandler_OnMostVisitedTilesRendered_Params.tiles
      err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 0, 8, new codec.PointerTo(MostVisitedTile), false, [0], 0);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      return validator.validationError.NONE;
    };
  
    MostVisitedPageHandler_OnMostVisitedTilesRendered_Params.encodedSize = codec.kStructHeaderSize + 16;
  
    MostVisitedPageHandler_OnMostVisitedTilesRendered_Params.decode = function(decoder) {
      var packed;
      var val = new MostVisitedPageHandler_OnMostVisitedTilesRendered_Params();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      val.tiles =
          decoder.decodeArrayPointer(new codec.PointerTo(MostVisitedTile));
      val.time =
          decoder.decodeStruct(codec.Double);
      return val;
    };
  
    MostVisitedPageHandler_OnMostVisitedTilesRendered_Params.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedPageHandler_OnMostVisitedTilesRendered_Params.encodedSize);
      encoder.writeUint32(0);
      encoder.encodeArrayPointer(new codec.PointerTo(MostVisitedTile), val.tiles);
      encoder.encodeStruct(codec.Double, val.time);
    };
    function MostVisitedPageHandler_OnMostVisitedTileNavigation_Params(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedPageHandler_OnMostVisitedTileNavigation_Params.prototype.initDefaults_ = function() {
      this.tile = null;
      this.index = 0;
      this.mouseButton = 0;
      this.altKey = false;
      this.ctrlKey = false;
      this.metaKey = false;
      this.shiftKey = false;
    };
    MostVisitedPageHandler_OnMostVisitedTileNavigation_Params.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedPageHandler_OnMostVisitedTileNavigation_Params.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 24}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedPageHandler_OnMostVisitedTileNavigation_Params.tile
      err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, MostVisitedTile, false);
      if (err !== validator.validationError.NONE)
          return err;
  
  
  
  
  
  
  
      return validator.validationError.NONE;
    };
  
    MostVisitedPageHandler_OnMostVisitedTileNavigation_Params.encodedSize = codec.kStructHeaderSize + 16;
  
    MostVisitedPageHandler_OnMostVisitedTileNavigation_Params.decode = function(decoder) {
      var packed;
      var val = new MostVisitedPageHandler_OnMostVisitedTileNavigation_Params();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      val.tile =
          decoder.decodeStructPointer(MostVisitedTile);
      val.index =
          decoder.decodeStruct(codec.Uint32);
      val.mouseButton =
          decoder.decodeStruct(codec.Uint8);
      packed = decoder.readUint8();
      val.altKey = (packed >> 0) & 1 ? true : false;
      val.ctrlKey = (packed >> 1) & 1 ? true : false;
      val.metaKey = (packed >> 2) & 1 ? true : false;
      val.shiftKey = (packed >> 3) & 1 ? true : false;
      decoder.skip(1);
      decoder.skip(1);
      return val;
    };
  
    MostVisitedPageHandler_OnMostVisitedTileNavigation_Params.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedPageHandler_OnMostVisitedTileNavigation_Params.encodedSize);
      encoder.writeUint32(0);
      encoder.encodeStructPointer(MostVisitedTile, val.tile);
      encoder.encodeStruct(codec.Uint32, val.index);
      encoder.encodeStruct(codec.Uint8, val.mouseButton);
      packed = 0;
      packed |= (val.altKey & 1) << 0
      packed |= (val.ctrlKey & 1) << 1
      packed |= (val.metaKey & 1) << 2
      packed |= (val.shiftKey & 1) << 3
      encoder.writeUint8(packed);
      encoder.skip(1);
      encoder.skip(1);
    };
    function MostVisitedPage_SetMostVisitedInfo_Params(values) {
      this.initDefaults_();
      this.initFields_(values);
    }
  
  
    MostVisitedPage_SetMostVisitedInfo_Params.prototype.initDefaults_ = function() {
      this.info = null;
    };
    MostVisitedPage_SetMostVisitedInfo_Params.prototype.initFields_ = function(fields) {
      for(var field in fields) {
          if (this.hasOwnProperty(field))
            this[field] = fields[field];
      }
    };
  
    MostVisitedPage_SetMostVisitedInfo_Params.validate = function(messageValidator, offset) {
      var err;
      err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
      if (err !== validator.validationError.NONE)
          return err;
  
      var kVersionSizes = [
        {version: 0, numBytes: 16}
      ];
      err = messageValidator.validateStructVersion(offset, kVersionSizes);
      if (err !== validator.validationError.NONE)
          return err;
  
  
      // validate MostVisitedPage_SetMostVisitedInfo_Params.info
      err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 0, MostVisitedInfo, false);
      if (err !== validator.validationError.NONE)
          return err;
  
      return validator.validationError.NONE;
    };
  
    MostVisitedPage_SetMostVisitedInfo_Params.encodedSize = codec.kStructHeaderSize + 8;
  
    MostVisitedPage_SetMostVisitedInfo_Params.decode = function(decoder) {
      var packed;
      var val = new MostVisitedPage_SetMostVisitedInfo_Params();
      var numberOfBytes = decoder.readUint32();
      var version = decoder.readUint32();
      val.info =
          decoder.decodeStructPointer(MostVisitedInfo);
      return val;
    };
  
    MostVisitedPage_SetMostVisitedInfo_Params.encode = function(encoder, val) {
      var packed;
      encoder.writeUint32(MostVisitedPage_SetMostVisitedInfo_Params.encodedSize);
      encoder.writeUint32(0);
      encoder.encodeStructPointer(MostVisitedInfo, val.info);
    };
    var kMostVisitedPageHandlerFactory_CreatePageHandler_Name = 1498975040;
  
    function MostVisitedPageHandlerFactoryPtr(handleOrPtrInfo) {
      this.ptr = new bindings.InterfacePtrController(MostVisitedPageHandlerFactory,
                                                     handleOrPtrInfo);
    }
  
    function MostVisitedPageHandlerFactoryAssociatedPtr(associatedInterfacePtrInfo) {
      this.ptr = new associatedBindings.AssociatedInterfacePtrController(
          MostVisitedPageHandlerFactory, associatedInterfacePtrInfo);
    }
  
    MostVisitedPageHandlerFactoryAssociatedPtr.prototype =
        Object.create(MostVisitedPageHandlerFactoryPtr.prototype);
    MostVisitedPageHandlerFactoryAssociatedPtr.prototype.constructor =
        MostVisitedPageHandlerFactoryAssociatedPtr;
  
    function MostVisitedPageHandlerFactoryProxy(receiver) {
      this.receiver_ = receiver;
    }
    MostVisitedPageHandlerFactoryPtr.prototype.createPageHandler = function() {
      return MostVisitedPageHandlerFactoryProxy.prototype.createPageHandler
          .apply(this.ptr.getProxy(), arguments);
    };
  
    MostVisitedPageHandlerFactoryProxy.prototype.createPageHandler = function(page, handler) {
      var params_ = new MostVisitedPageHandlerFactory_CreatePageHandler_Params();
      params_.page = page;
      params_.handler = handler;
      var builder = new codec.MessageV0Builder(
          kMostVisitedPageHandlerFactory_CreatePageHandler_Name,
          codec.align(MostVisitedPageHandlerFactory_CreatePageHandler_Params.encodedSize));
      builder.encodeStruct(MostVisitedPageHandlerFactory_CreatePageHandler_Params, params_);
      var message = builder.finish();
      this.receiver_.accept(message);
    };
  
    function MostVisitedPageHandlerFactoryStub(delegate) {
      this.delegate_ = delegate;
    }
    MostVisitedPageHandlerFactoryStub.prototype.createPageHandler = function(page, handler) {
      return this.delegate_ && this.delegate_.createPageHandler && this.delegate_.createPageHandler(page, handler);
    }
  
    MostVisitedPageHandlerFactoryStub.prototype.accept = function(message) {
      var reader = new codec.MessageReader(message);
      switch (reader.messageName) {
      case kMostVisitedPageHandlerFactory_CreatePageHandler_Name:
        var params = reader.decodeStruct(MostVisitedPageHandlerFactory_CreatePageHandler_Params);
        this.createPageHandler(params.page, params.handler);
        return true;
      default:
        return false;
      }
    };
  
    MostVisitedPageHandlerFactoryStub.prototype.acceptWithResponder =
        function(message, responder) {
      var reader = new codec.MessageReader(message);
      switch (reader.messageName) {
      default:
        return false;
      }
    };
  
    function validateMostVisitedPageHandlerFactoryRequest(messageValidator) {
      var message = messageValidator.message;
      var paramsClass = null;
      switch (message.getName()) {
        case kMostVisitedPageHandlerFactory_CreatePageHandler_Name:
          if (!message.expectsResponse() && !message.isResponse())
            paramsClass = MostVisitedPageHandlerFactory_CreatePageHandler_Params;
        break;
      }
      if (paramsClass === null)
        return validator.validationError.NONE;
      return paramsClass.validate(messageValidator, messageValidator.message.getHeaderNumBytes());
    }
  
    function validateMostVisitedPageHandlerFactoryResponse(messageValidator) {
      return validator.validationError.NONE;
    }
  
    var MostVisitedPageHandlerFactory = {
      name: 'most_visited.mojom.MostVisitedPageHandlerFactory',
      kVersion: 0,
      ptrClass: MostVisitedPageHandlerFactoryPtr,
      proxyClass: MostVisitedPageHandlerFactoryProxy,
      stubClass: MostVisitedPageHandlerFactoryStub,
      validateRequest: validateMostVisitedPageHandlerFactoryRequest,
      validateResponse: null,
    };
    MostVisitedPageHandlerFactoryStub.prototype.validator = validateMostVisitedPageHandlerFactoryRequest;
    MostVisitedPageHandlerFactoryProxy.prototype.validator = null;
    var kMostVisitedPageHandler_AddMostVisitedTile_Name = 413090717;
    var kMostVisitedPageHandler_DeleteMostVisitedTile_Name = 1830628567;
    var kMostVisitedPageHandler_ReorderMostVisitedTile_Name = 509178223;
    var kMostVisitedPageHandler_RestoreMostVisitedDefaults_Name = 1559960190;
    var kMostVisitedPageHandler_UndoMostVisitedTileAction_Name = 1751353664;
    var kMostVisitedPageHandler_UpdateMostVisitedInfo_Name = 963440525;
    var kMostVisitedPageHandler_UpdateMostVisitedTile_Name = 1469473455;
    var kMostVisitedPageHandler_OnMostVisitedTilesRendered_Name = 22409936;
    var kMostVisitedPageHandler_OnMostVisitedTileNavigation_Name = 1077572671;
  
    function MostVisitedPageHandlerPtr(handleOrPtrInfo) {
      this.ptr = new bindings.InterfacePtrController(MostVisitedPageHandler,
                                                     handleOrPtrInfo);
    }
  
    function MostVisitedPageHandlerAssociatedPtr(associatedInterfacePtrInfo) {
      this.ptr = new associatedBindings.AssociatedInterfacePtrController(
          MostVisitedPageHandler, associatedInterfacePtrInfo);
    }
  
    MostVisitedPageHandlerAssociatedPtr.prototype =
        Object.create(MostVisitedPageHandlerPtr.prototype);
    MostVisitedPageHandlerAssociatedPtr.prototype.constructor =
        MostVisitedPageHandlerAssociatedPtr;
  
    function MostVisitedPageHandlerProxy(receiver) {
      this.receiver_ = receiver;
    }
    MostVisitedPageHandlerPtr.prototype.addMostVisitedTile = function() {
      return MostVisitedPageHandlerProxy.prototype.addMostVisitedTile
          .apply(this.ptr.getProxy(), arguments);
    };
  
    MostVisitedPageHandlerProxy.prototype.addMostVisitedTile = function(url, title) {
      var params_ = new MostVisitedPageHandler_AddMostVisitedTile_Params();
      params_.url = url;
      params_.title = title;
      return new Promise(function(resolve, reject) {
        var builder = new codec.MessageV1Builder(
            kMostVisitedPageHandler_AddMostVisitedTile_Name,
            codec.align(MostVisitedPageHandler_AddMostVisitedTile_Params.encodedSize),
            codec.kMessageExpectsResponse, 0);
        builder.encodeStruct(MostVisitedPageHandler_AddMostVisitedTile_Params, params_);
        var message = builder.finish();
        this.receiver_.acceptAndExpectResponse(message).then(function(message) {
          var reader = new codec.MessageReader(message);
          var responseParams =
              reader.decodeStruct(MostVisitedPageHandler_AddMostVisitedTile_ResponseParams);
          resolve(responseParams);
        }).catch(function(result) {
          reject(Error("Connection error: " + result));
        });
      }.bind(this));
    };
    MostVisitedPageHandlerPtr.prototype.deleteMostVisitedTile = function() {
      return MostVisitedPageHandlerProxy.prototype.deleteMostVisitedTile
          .apply(this.ptr.getProxy(), arguments);
    };
  
    MostVisitedPageHandlerProxy.prototype.deleteMostVisitedTile = function(url) {
      var params_ = new MostVisitedPageHandler_DeleteMostVisitedTile_Params();
      params_.url = url;
      var builder = new codec.MessageV0Builder(
          kMostVisitedPageHandler_DeleteMostVisitedTile_Name,
          codec.align(MostVisitedPageHandler_DeleteMostVisitedTile_Params.encodedSize));
      builder.encodeStruct(MostVisitedPageHandler_DeleteMostVisitedTile_Params, params_);
      var message = builder.finish();
      this.receiver_.accept(message);
    };
    MostVisitedPageHandlerPtr.prototype.reorderMostVisitedTile = function() {
      return MostVisitedPageHandlerProxy.prototype.reorderMostVisitedTile
          .apply(this.ptr.getProxy(), arguments);
    };
  
    MostVisitedPageHandlerProxy.prototype.reorderMostVisitedTile = function(url, newPos) {
      var params_ = new MostVisitedPageHandler_ReorderMostVisitedTile_Params();
      params_.url = url;
      params_.newPos = newPos;
      var builder = new codec.MessageV0Builder(
          kMostVisitedPageHandler_ReorderMostVisitedTile_Name,
          codec.align(MostVisitedPageHandler_ReorderMostVisitedTile_Params.encodedSize));
      builder.encodeStruct(MostVisitedPageHandler_ReorderMostVisitedTile_Params, params_);
      var message = builder.finish();
      this.receiver_.accept(message);
    };
    MostVisitedPageHandlerPtr.prototype.restoreMostVisitedDefaults = function() {
      return MostVisitedPageHandlerProxy.prototype.restoreMostVisitedDefaults
          .apply(this.ptr.getProxy(), arguments);
    };
  
    MostVisitedPageHandlerProxy.prototype.restoreMostVisitedDefaults = function() {
      var params_ = new MostVisitedPageHandler_RestoreMostVisitedDefaults_Params();
      var builder = new codec.MessageV0Builder(
          kMostVisitedPageHandler_RestoreMostVisitedDefaults_Name,
          codec.align(MostVisitedPageHandler_RestoreMostVisitedDefaults_Params.encodedSize));
      builder.encodeStruct(MostVisitedPageHandler_RestoreMostVisitedDefaults_Params, params_);
      var message = builder.finish();
      this.receiver_.accept(message);
    };
    MostVisitedPageHandlerPtr.prototype.undoMostVisitedTileAction = function() {
      return MostVisitedPageHandlerProxy.prototype.undoMostVisitedTileAction
          .apply(this.ptr.getProxy(), arguments);
    };
  
    MostVisitedPageHandlerProxy.prototype.undoMostVisitedTileAction = function() {
      var params_ = new MostVisitedPageHandler_UndoMostVisitedTileAction_Params();
      var builder = new codec.MessageV0Builder(
          kMostVisitedPageHandler_UndoMostVisitedTileAction_Name,
          codec.align(MostVisitedPageHandler_UndoMostVisitedTileAction_Params.encodedSize));
      builder.encodeStruct(MostVisitedPageHandler_UndoMostVisitedTileAction_Params, params_);
      var message = builder.finish();
      this.receiver_.accept(message);
    };
    MostVisitedPageHandlerPtr.prototype.updateMostVisitedInfo = function() {
      return MostVisitedPageHandlerProxy.prototype.updateMostVisitedInfo
          .apply(this.ptr.getProxy(), arguments);
    };
  
    MostVisitedPageHandlerProxy.prototype.updateMostVisitedInfo = function() {
      var params_ = new MostVisitedPageHandler_UpdateMostVisitedInfo_Params();
      var builder = new codec.MessageV0Builder(
          kMostVisitedPageHandler_UpdateMostVisitedInfo_Name,
          codec.align(MostVisitedPageHandler_UpdateMostVisitedInfo_Params.encodedSize));
      builder.encodeStruct(MostVisitedPageHandler_UpdateMostVisitedInfo_Params, params_);
      var message = builder.finish();
      this.receiver_.accept(message);
    };
    MostVisitedPageHandlerPtr.prototype.updateMostVisitedTile = function() {
      return MostVisitedPageHandlerProxy.prototype.updateMostVisitedTile
          .apply(this.ptr.getProxy(), arguments);
    };
  
    MostVisitedPageHandlerProxy.prototype.updateMostVisitedTile = function(url, newUrl, newTitle) {
      var params_ = new MostVisitedPageHandler_UpdateMostVisitedTile_Params();
      params_.url = url;
      params_.newUrl = newUrl;
      params_.newTitle = newTitle;
      return new Promise(function(resolve, reject) {
        var builder = new codec.MessageV1Builder(
            kMostVisitedPageHandler_UpdateMostVisitedTile_Name,
            codec.align(MostVisitedPageHandler_UpdateMostVisitedTile_Params.encodedSize),
            codec.kMessageExpectsResponse, 0);
        builder.encodeStruct(MostVisitedPageHandler_UpdateMostVisitedTile_Params, params_);
        var message = builder.finish();
        this.receiver_.acceptAndExpectResponse(message).then(function(message) {
          var reader = new codec.MessageReader(message);
          var responseParams =
              reader.decodeStruct(MostVisitedPageHandler_UpdateMostVisitedTile_ResponseParams);
          resolve(responseParams);
        }).catch(function(result) {
          reject(Error("Connection error: " + result));
        });
      }.bind(this));
    };
    MostVisitedPageHandlerPtr.prototype.onMostVisitedTilesRendered = function() {
      return MostVisitedPageHandlerProxy.prototype.onMostVisitedTilesRendered
          .apply(this.ptr.getProxy(), arguments);
    };
  
    MostVisitedPageHandlerProxy.prototype.onMostVisitedTilesRendered = function(tiles, time) {
      var params_ = new MostVisitedPageHandler_OnMostVisitedTilesRendered_Params();
      params_.tiles = tiles;
      params_.time = time;
      var builder = new codec.MessageV0Builder(
          kMostVisitedPageHandler_OnMostVisitedTilesRendered_Name,
          codec.align(MostVisitedPageHandler_OnMostVisitedTilesRendered_Params.encodedSize));
      builder.encodeStruct(MostVisitedPageHandler_OnMostVisitedTilesRendered_Params, params_);
      var message = builder.finish();
      this.receiver_.accept(message);
    };
    MostVisitedPageHandlerPtr.prototype.onMostVisitedTileNavigation = function() {
      return MostVisitedPageHandlerProxy.prototype.onMostVisitedTileNavigation
          .apply(this.ptr.getProxy(), arguments);
    };
  
    MostVisitedPageHandlerProxy.prototype.onMostVisitedTileNavigation = function(tile, index, mouseButton, altKey, ctrlKey, metaKey, shiftKey) {
      var params_ = new MostVisitedPageHandler_OnMostVisitedTileNavigation_Params();
      params_.tile = tile;
      params_.index = index;
      params_.mouseButton = mouseButton;
      params_.altKey = altKey;
      params_.ctrlKey = ctrlKey;
      params_.metaKey = metaKey;
      params_.shiftKey = shiftKey;
      var builder = new codec.MessageV0Builder(
          kMostVisitedPageHandler_OnMostVisitedTileNavigation_Name,
          codec.align(MostVisitedPageHandler_OnMostVisitedTileNavigation_Params.encodedSize));
      builder.encodeStruct(MostVisitedPageHandler_OnMostVisitedTileNavigation_Params, params_);
      var message = builder.finish();
      this.receiver_.accept(message);
    };
  
    function MostVisitedPageHandlerStub(delegate) {
      this.delegate_ = delegate;
    }
    MostVisitedPageHandlerStub.prototype.addMostVisitedTile = function(url, title) {
      return this.delegate_ && this.delegate_.addMostVisitedTile && this.delegate_.addMostVisitedTile(url, title);
    }
    MostVisitedPageHandlerStub.prototype.deleteMostVisitedTile = function(url) {
      return this.delegate_ && this.delegate_.deleteMostVisitedTile && this.delegate_.deleteMostVisitedTile(url);
    }
    MostVisitedPageHandlerStub.prototype.reorderMostVisitedTile = function(url, newPos) {
      return this.delegate_ && this.delegate_.reorderMostVisitedTile && this.delegate_.reorderMostVisitedTile(url, newPos);
    }
    MostVisitedPageHandlerStub.prototype.restoreMostVisitedDefaults = function() {
      return this.delegate_ && this.delegate_.restoreMostVisitedDefaults && this.delegate_.restoreMostVisitedDefaults();
    }
    MostVisitedPageHandlerStub.prototype.undoMostVisitedTileAction = function() {
      return this.delegate_ && this.delegate_.undoMostVisitedTileAction && this.delegate_.undoMostVisitedTileAction();
    }
    MostVisitedPageHandlerStub.prototype.updateMostVisitedInfo = function() {
      return this.delegate_ && this.delegate_.updateMostVisitedInfo && this.delegate_.updateMostVisitedInfo();
    }
    MostVisitedPageHandlerStub.prototype.updateMostVisitedTile = function(url, newUrl, newTitle) {
      return this.delegate_ && this.delegate_.updateMostVisitedTile && this.delegate_.updateMostVisitedTile(url, newUrl, newTitle);
    }
    MostVisitedPageHandlerStub.prototype.onMostVisitedTilesRendered = function(tiles, time) {
      return this.delegate_ && this.delegate_.onMostVisitedTilesRendered && this.delegate_.onMostVisitedTilesRendered(tiles, time);
    }
    MostVisitedPageHandlerStub.prototype.onMostVisitedTileNavigation = function(tile, index, mouseButton, altKey, ctrlKey, metaKey, shiftKey) {
      return this.delegate_ && this.delegate_.onMostVisitedTileNavigation && this.delegate_.onMostVisitedTileNavigation(tile, index, mouseButton, altKey, ctrlKey, metaKey, shiftKey);
    }
  
    MostVisitedPageHandlerStub.prototype.accept = function(message) {
      var reader = new codec.MessageReader(message);
      switch (reader.messageName) {
      case kMostVisitedPageHandler_DeleteMostVisitedTile_Name:
        var params = reader.decodeStruct(MostVisitedPageHandler_DeleteMostVisitedTile_Params);
        this.deleteMostVisitedTile(params.url);
        return true;
      case kMostVisitedPageHandler_ReorderMostVisitedTile_Name:
        var params = reader.decodeStruct(MostVisitedPageHandler_ReorderMostVisitedTile_Params);
        this.reorderMostVisitedTile(params.url, params.newPos);
        return true;
      case kMostVisitedPageHandler_RestoreMostVisitedDefaults_Name:
        var params = reader.decodeStruct(MostVisitedPageHandler_RestoreMostVisitedDefaults_Params);
        this.restoreMostVisitedDefaults();
        return true;
      case kMostVisitedPageHandler_UndoMostVisitedTileAction_Name:
        var params = reader.decodeStruct(MostVisitedPageHandler_UndoMostVisitedTileAction_Params);
        this.undoMostVisitedTileAction();
        return true;
      case kMostVisitedPageHandler_UpdateMostVisitedInfo_Name:
        var params = reader.decodeStruct(MostVisitedPageHandler_UpdateMostVisitedInfo_Params);
        this.updateMostVisitedInfo();
        return true;
      case kMostVisitedPageHandler_OnMostVisitedTilesRendered_Name:
        var params = reader.decodeStruct(MostVisitedPageHandler_OnMostVisitedTilesRendered_Params);
        this.onMostVisitedTilesRendered(params.tiles, params.time);
        return true;
      case kMostVisitedPageHandler_OnMostVisitedTileNavigation_Name:
        var params = reader.decodeStruct(MostVisitedPageHandler_OnMostVisitedTileNavigation_Params);
        this.onMostVisitedTileNavigation(params.tile, params.index, params.mouseButton, params.altKey, params.ctrlKey, params.metaKey, params.shiftKey);
        return true;
      default:
        return false;
      }
    };
  
    MostVisitedPageHandlerStub.prototype.acceptWithResponder =
        function(message, responder) {
      var reader = new codec.MessageReader(message);
      switch (reader.messageName) {
      case kMostVisitedPageHandler_AddMostVisitedTile_Name:
        var params = reader.decodeStruct(MostVisitedPageHandler_AddMostVisitedTile_Params);
        this.addMostVisitedTile(params.url, params.title).then(function(response) {
          var responseParams =
              new MostVisitedPageHandler_AddMostVisitedTile_ResponseParams();
          responseParams.success = response.success;
          var builder = new codec.MessageV1Builder(
              kMostVisitedPageHandler_AddMostVisitedTile_Name,
              codec.align(MostVisitedPageHandler_AddMostVisitedTile_ResponseParams.encodedSize),
              codec.kMessageIsResponse, reader.requestID);
          builder.encodeStruct(MostVisitedPageHandler_AddMostVisitedTile_ResponseParams,
                               responseParams);
          var message = builder.finish();
          responder.accept(message);
        });
        return true;
      case kMostVisitedPageHandler_UpdateMostVisitedTile_Name:
        var params = reader.decodeStruct(MostVisitedPageHandler_UpdateMostVisitedTile_Params);
        this.updateMostVisitedTile(params.url, params.newUrl, params.newTitle).then(function(response) {
          var responseParams =
              new MostVisitedPageHandler_UpdateMostVisitedTile_ResponseParams();
          responseParams.success = response.success;
          var builder = new codec.MessageV1Builder(
              kMostVisitedPageHandler_UpdateMostVisitedTile_Name,
              codec.align(MostVisitedPageHandler_UpdateMostVisitedTile_ResponseParams.encodedSize),
              codec.kMessageIsResponse, reader.requestID);
          builder.encodeStruct(MostVisitedPageHandler_UpdateMostVisitedTile_ResponseParams,
                               responseParams);
          var message = builder.finish();
          responder.accept(message);
        });
        return true;
      default:
        return false;
      }
    };
  
    function validateMostVisitedPageHandlerRequest(messageValidator) {
      var message = messageValidator.message;
      var paramsClass = null;
      switch (message.getName()) {
        case kMostVisitedPageHandler_AddMostVisitedTile_Name:
          if (message.expectsResponse())
            paramsClass = MostVisitedPageHandler_AddMostVisitedTile_Params;
        break;
        case kMostVisitedPageHandler_DeleteMostVisitedTile_Name:
          if (!message.expectsResponse() && !message.isResponse())
            paramsClass = MostVisitedPageHandler_DeleteMostVisitedTile_Params;
        break;
        case kMostVisitedPageHandler_ReorderMostVisitedTile_Name:
          if (!message.expectsResponse() && !message.isResponse())
            paramsClass = MostVisitedPageHandler_ReorderMostVisitedTile_Params;
        break;
        case kMostVisitedPageHandler_RestoreMostVisitedDefaults_Name:
          if (!message.expectsResponse() && !message.isResponse())
            paramsClass = MostVisitedPageHandler_RestoreMostVisitedDefaults_Params;
        break;
        case kMostVisitedPageHandler_UndoMostVisitedTileAction_Name:
          if (!message.expectsResponse() && !message.isResponse())
            paramsClass = MostVisitedPageHandler_UndoMostVisitedTileAction_Params;
        break;
        case kMostVisitedPageHandler_UpdateMostVisitedInfo_Name:
          if (!message.expectsResponse() && !message.isResponse())
            paramsClass = MostVisitedPageHandler_UpdateMostVisitedInfo_Params;
        break;
        case kMostVisitedPageHandler_UpdateMostVisitedTile_Name:
          if (message.expectsResponse())
            paramsClass = MostVisitedPageHandler_UpdateMostVisitedTile_Params;
        break;
        case kMostVisitedPageHandler_OnMostVisitedTilesRendered_Name:
          if (!message.expectsResponse() && !message.isResponse())
            paramsClass = MostVisitedPageHandler_OnMostVisitedTilesRendered_Params;
        break;
        case kMostVisitedPageHandler_OnMostVisitedTileNavigation_Name:
          if (!message.expectsResponse() && !message.isResponse())
            paramsClass = MostVisitedPageHandler_OnMostVisitedTileNavigation_Params;
        break;
      }
      if (paramsClass === null)
        return validator.validationError.NONE;
      return paramsClass.validate(messageValidator, messageValidator.message.getHeaderNumBytes());
    }
  
    function validateMostVisitedPageHandlerResponse(messageValidator) {
     var message = messageValidator.message;
     var paramsClass = null;
     switch (message.getName()) {
        case kMostVisitedPageHandler_AddMostVisitedTile_Name:
          if (message.isResponse())
            paramsClass = MostVisitedPageHandler_AddMostVisitedTile_ResponseParams;
          break;
        case kMostVisitedPageHandler_UpdateMostVisitedTile_Name:
          if (message.isResponse())
            paramsClass = MostVisitedPageHandler_UpdateMostVisitedTile_ResponseParams;
          break;
      }
      if (paramsClass === null)
        return validator.validationError.NONE;
      return paramsClass.validate(messageValidator, messageValidator.message.getHeaderNumBytes());
    }
  
    var MostVisitedPageHandler = {
      name: 'most_visited.mojom.MostVisitedPageHandler',
      kVersion: 0,
      ptrClass: MostVisitedPageHandlerPtr,
      proxyClass: MostVisitedPageHandlerProxy,
      stubClass: MostVisitedPageHandlerStub,
      validateRequest: validateMostVisitedPageHandlerRequest,
      validateResponse: validateMostVisitedPageHandlerResponse,
    };
    MostVisitedPageHandlerStub.prototype.validator = validateMostVisitedPageHandlerRequest;
    MostVisitedPageHandlerProxy.prototype.validator = validateMostVisitedPageHandlerResponse;
    var kMostVisitedPage_SetMostVisitedInfo_Name = 579640113;
  
    function MostVisitedPagePtr(handleOrPtrInfo) {
      this.ptr = new bindings.InterfacePtrController(MostVisitedPage,
                                                     handleOrPtrInfo);
    }
  
    function MostVisitedPageAssociatedPtr(associatedInterfacePtrInfo) {
      this.ptr = new associatedBindings.AssociatedInterfacePtrController(
          MostVisitedPage, associatedInterfacePtrInfo);
    }
  
    MostVisitedPageAssociatedPtr.prototype =
        Object.create(MostVisitedPagePtr.prototype);
    MostVisitedPageAssociatedPtr.prototype.constructor =
        MostVisitedPageAssociatedPtr;
  
    function MostVisitedPageProxy(receiver) {
      this.receiver_ = receiver;
    }
    MostVisitedPagePtr.prototype.setMostVisitedInfo = function() {
      return MostVisitedPageProxy.prototype.setMostVisitedInfo
          .apply(this.ptr.getProxy(), arguments);
    };
  
    MostVisitedPageProxy.prototype.setMostVisitedInfo = function(info) {
      var params_ = new MostVisitedPage_SetMostVisitedInfo_Params();
      params_.info = info;
      var builder = new codec.MessageV0Builder(
          kMostVisitedPage_SetMostVisitedInfo_Name,
          codec.align(MostVisitedPage_SetMostVisitedInfo_Params.encodedSize));
      builder.encodeStruct(MostVisitedPage_SetMostVisitedInfo_Params, params_);
      var message = builder.finish();
      this.receiver_.accept(message);
    };
  
    function MostVisitedPageStub(delegate) {
      this.delegate_ = delegate;
    }
    MostVisitedPageStub.prototype.setMostVisitedInfo = function(info) {
      return this.delegate_ && this.delegate_.setMostVisitedInfo && this.delegate_.setMostVisitedInfo(info);
    }
  
    MostVisitedPageStub.prototype.accept = function(message) {
      var reader = new codec.MessageReader(message);
      switch (reader.messageName) {
      case kMostVisitedPage_SetMostVisitedInfo_Name:
        var params = reader.decodeStruct(MostVisitedPage_SetMostVisitedInfo_Params);
        this.setMostVisitedInfo(params.info);
        return true;
      default:
        return false;
      }
    };
  
    MostVisitedPageStub.prototype.acceptWithResponder =
        function(message, responder) {
      var reader = new codec.MessageReader(message);
      switch (reader.messageName) {
      default:
        return false;
      }
    };
  
    function validateMostVisitedPageRequest(messageValidator) {
      var message = messageValidator.message;
      var paramsClass = null;
      switch (message.getName()) {
        case kMostVisitedPage_SetMostVisitedInfo_Name:
          if (!message.expectsResponse() && !message.isResponse())
            paramsClass = MostVisitedPage_SetMostVisitedInfo_Params;
        break;
      }
      if (paramsClass === null)
        return validator.validationError.NONE;
      return paramsClass.validate(messageValidator, messageValidator.message.getHeaderNumBytes());
    }
  
    function validateMostVisitedPageResponse(messageValidator) {
      return validator.validationError.NONE;
    }
  
    var MostVisitedPage = {
      name: 'most_visited.mojom.MostVisitedPage',
      kVersion: 0,
      ptrClass: MostVisitedPagePtr,
      proxyClass: MostVisitedPageProxy,
      stubClass: MostVisitedPageStub,
      validateRequest: validateMostVisitedPageRequest,
      validateResponse: null,
    };
    MostVisitedPageStub.prototype.validator = validateMostVisitedPageRequest;
    MostVisitedPageProxy.prototype.validator = null;
    exports.MostVisitedTile = MostVisitedTile;
    exports.MostVisitedTheme = MostVisitedTheme;
    exports.MostVisitedInfo = MostVisitedInfo;
    exports.MostVisitedPageHandlerFactory = MostVisitedPageHandlerFactory;
    exports.MostVisitedPageHandlerFactoryPtr = MostVisitedPageHandlerFactoryPtr;
    exports.MostVisitedPageHandlerFactoryAssociatedPtr = MostVisitedPageHandlerFactoryAssociatedPtr;
    exports.MostVisitedPageHandler = MostVisitedPageHandler;
    exports.MostVisitedPageHandlerPtr = MostVisitedPageHandlerPtr;
    exports.MostVisitedPageHandlerAssociatedPtr = MostVisitedPageHandlerAssociatedPtr;
    exports.MostVisitedPage = MostVisitedPage;
    exports.MostVisitedPagePtr = MostVisitedPagePtr;
    exports.MostVisitedPageAssociatedPtr = MostVisitedPageAssociatedPtr;
  })();