summaryrefslogtreecommitdiff
path: root/chromium/components/autofill_assistant/browser/client_settings.cc
blob: f375b67fdbd4741b46ec17bd2b9b5fd111a200c9 (plain)
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
63
64
65
66
67
68
69
70
// Copyright 2019 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.

#include "components/autofill_assistant/browser/client_settings.h"

#include "components/autofill_assistant/browser/service.pb.h"

namespace autofill_assistant {

ClientSettings::ClientSettings() = default;

void ClientSettings::UpdateFromProto(const ClientSettingsProto& proto) {
  if (proto.has_periodic_script_check_interval_ms()) {
    periodic_script_check_interval = base::TimeDelta::FromMilliseconds(
        proto.periodic_script_check_interval_ms());
  }
  if (proto.has_periodic_element_check_interval_ms()) {
    periodic_element_check_interval = base::TimeDelta::FromMilliseconds(
        proto.periodic_element_check_interval_ms());
  }
  if (proto.has_periodic_script_check_count()) {
    periodic_script_check_count = proto.periodic_script_check_count();
  }
  if (proto.has_element_position_update_interval_ms()) {
    element_position_update_interval = base::TimeDelta::FromMilliseconds(
        proto.element_position_update_interval_ms());
  }
  if (proto.has_short_wait_for_element_deadline_ms()) {
    short_wait_for_element_deadline = base::TimeDelta::FromMilliseconds(
        proto.short_wait_for_element_deadline_ms());
  }
  if (proto.has_box_model_check_interval_ms()) {
    box_model_check_interval =
        base::TimeDelta::FromMilliseconds(proto.box_model_check_interval_ms());
  }
  if (proto.has_box_model_check_count()) {
    box_model_check_count = proto.box_model_check_count();
  }
  if (proto.has_document_ready_check_interval_ms()) {
    document_ready_check_interval = base::TimeDelta::FromMilliseconds(
        proto.document_ready_check_interval_ms());
  }
  if (proto.has_document_ready_check_count()) {
    document_ready_check_count = proto.document_ready_check_count();
  }
  if (proto.has_enable_graceful_shutdown()) {
    enable_graceful_shutdown = proto.enable_graceful_shutdown();
  }
  if (proto.has_graceful_shutdown_delay_ms()) {
    graceful_shutdown_delay =
        base::TimeDelta::FromMilliseconds(proto.graceful_shutdown_delay_ms());
  }
  if (proto.has_cancel_delay_ms()) {
    cancel_delay = base::TimeDelta::FromMilliseconds(proto.cancel_delay_ms());
  }
  if (proto.has_tap_count()) {
    tap_count = proto.tap_count();
  }
  if (proto.has_tap_tracking_duration_ms()) {
    tap_tracking_duration =
        base::TimeDelta::FromMilliseconds(proto.tap_tracking_duration_ms());
  }
  if (proto.has_tap_shutdown_delay_ms()) {
    tap_shutdown_delay =
        base::TimeDelta::FromMilliseconds(proto.tap_shutdown_delay_ms());
  }
}

}  // namespace autofill_assistant