summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_constants.js
blob: f60c837c8b213d25d61eaec93f32b1b3293c2e4f (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
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright 2018 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.

cr.define('settings', function() {
  /**
   * The possible statuses of hosts on the logged in account that determine the
   * page content. Note that this is based on (and must include an analog of
   * all values in) the HostStatus enum in
   * services/multidevice_setup/public/mojom/multidevice_setup.mojom.
   * @enum {number}
   */
  MultiDeviceSettingsMode = {
    NO_ELIGIBLE_HOSTS: 0,
    NO_HOST_SET: 1,
    HOST_SET_WAITING_FOR_SERVER: 2,
    HOST_SET_WAITING_FOR_VERIFICATION: 3,
    HOST_SET_VERIFIED: 4,
  };

  /**
   * Enum of MultiDevice features. Note that this is copied from (and must
   * include an analog of all values in) the Feature enum in
   * //chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom.
   * @enum {number}
   */
  MultiDeviceFeature = {
    BETTER_TOGETHER_SUITE: 0,
    INSTANT_TETHERING: 1,
    MESSAGES: 2,
    SMART_LOCK: 3,
  };

  /**
   * Possible states of MultiDevice features. Note that this is copied from (and
   * must include an analog of all values in) the FeatureState enum in
   * //chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom.
   * @enum {number}
   */
  MultiDeviceFeatureState = {
    PROHIBITED_BY_POLICY: 0,
    DISABLED_BY_USER: 1,
    ENABLED_BY_USER: 2,
    NOT_SUPPORTED_BY_CHROMEBOOK: 3,
    NOT_SUPPORTED_BY_PHONE: 4,
    UNAVAILABLE_NO_VERIFIED_HOST: 5,
    UNAVAILABLE_INSUFFICIENT_SECURITY: 6,
    UNAVAILABLE_SUITE_DISABLED: 7,
    FURTHER_SETUP_REQUIRED: 8,
  };

  return {
    MultiDeviceSettingsMode: MultiDeviceSettingsMode,
    MultiDeviceFeature: MultiDeviceFeature,
    MultiDeviceFeatureState: MultiDeviceFeatureState,
  };
});

/**
 * Container for the initial data that the page requires in order to display
 * the correct content. It is also used for receiving status updates during
 * use. Note that the host device may be verified (enabled or disabled),
 * awaiting verification, or it may have failed setup because it was not able
 * to connect to the server.
 *
 * For each MultiDevice feature (including the "suite" feature, which acts as a
 * gatekeeper for the others), the corresponding *State property is an enum
 * containing the data necessary to display it. Note that hostDeviceName should
 * be undefined if and only if no host has been set up, regardless of whether
 * there are potential hosts on the account.
 *
 * @typedef {{
 *   mode: !settings.MultiDeviceSettingsMode,
 *   hostDeviceName: (string|undefined),
 *   betterTogetherState: !settings.MultiDeviceFeatureState,
 *   instantTetheringState: !settings.MultiDeviceFeatureState,
 *   messagesState: !settings.MultiDeviceFeatureState,
 *   smartLockState: !settings.MultiDeviceFeatureState,
 *   isAndroidSmsPairingComplete: boolean
 * }}
 */
let MultiDevicePageContentData;