input.dart 1.54 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
// Copyright 2016 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.

import 'message.dart';
import 'find.dart';

class SetInputText extends CommandWithTarget {
  @override
  final String kind = 'setInputText';

  SetInputText(SerializableFinder finder, this.text) : super(finder);

  final String text;

  static SetInputText deserialize(Map<String, dynamic> json) {
    String text = json['text'];
    return new SetInputText(SerializableFinder.deserialize(json), text);
  }

  @override
  Map<String, String> serialize() {
    Map<String, String> json = super.serialize();
    json['text'] = text;
    return json;
  }
}

class SetInputTextResult extends Result {
  static SetInputTextResult fromJson(Map<String, dynamic> json) {
    return new SetInputTextResult();
  }

  @override
  Map<String, dynamic> toJson() => <String, dynamic>{};
}

class SubmitInputText extends CommandWithTarget {
  @override
  final String kind = 'submitInputText';

  SubmitInputText(SerializableFinder finder) : super(finder);

  static SubmitInputText deserialize(Map<String, dynamic> json) {
    return new SubmitInputText(SerializableFinder.deserialize(json));
  }
}

class SubmitInputTextResult extends Result {
  SubmitInputTextResult(this.text);

  final String text;

  static SubmitInputTextResult fromJson(Map<String, dynamic> json) {
    return new SubmitInputTextResult(json['text']);
  }

  @override
  Map<String, dynamic> toJson() => <String, dynamic>{
    'text': text
  };
}