summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals.mojom
blob: 7e5201566a60e61c32b165668bcc0f31e027acd8 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Copyright 2017 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.

module mojom;

import "url/mojom/url.mojom";

struct PreviewsStatus {
  // The human readable description of the status that will be displayed on
  // chrome://interventions-internals.
  string description;
  bool enabled;

  // The ID of the html DOM element.
  string htmlId;
};

struct PreviewsFlag {
  // The human readable description of the flag that will be displayed on
  // chrome://interventions-internals.
  string description;

  // The link to this flag in chrome://flags.
  string link;

  // The string representation of the flag value.
  string value;

  // The ID of the html DOM element.
  string htmlId;
};

struct MessageLog {
  // The tye of event message (E.g. "Navigation").
  string type;

  // The human readable description of the event.
  string description;

  // The url that associated with the event.
  url.mojom.Url url;

  // The time when the event happened in millisecond since Unix epoch.
  int64 time;

  // The ID associated with the request, for grouping log messages in the UI. If
  // |id| is 0, then they will not be grouped, since pageId values start at 1.
  uint64 page_id;
};


interface InterventionsInternalsPageHandler {
  // Returns a map of previews modes statuses.
  GetPreviewsEnabled() => (array<PreviewsStatus> statuses);

  // Returns a map of previews related flags details.
  GetPreviewsFlagsDetails() => (array<PreviewsFlag> flags);

  // Inject the client side page object.
  SetClientPage(InterventionsInternalsPage page);

  // Change the status of ignoring blacklist to |ignored|. |ignored| will
  // indicate whether the blacklist decision would be ignored when deciding if a
  // preview should be shown or not.
  SetIgnorePreviewsBlacklistDecision(bool ignored);
};

interface InterventionsInternalsPage {
  // Pushes a new log message to the page. This is called by
  // InterventionsInternalsPageHandler when it receives a new MessageLog, and
  // publishes it on the javscript side.
  LogNewMessage(MessageLog log);

  // Notify the page that |host| has been blacklisted at |time|. The method is
  // called by InterventionsInternalsPageHandler when PreviewsUIService receives
  // new blacklisted host.
  OnBlacklistedHost(string host, int64 time);

  // Notify the page that user blacklisted status has changed to |blacklisted|.
  // The method is called by InterventionsInternalsPageHandler when user's
  // blacklist status changes.
  OnUserBlacklistedStatusChange(bool blacklisted);

  // Notify the page that the blacklist is cleared at |time|. The method is
  // called by InterventionsInternalsPageHandler when PreviewsUIService clears
  // the blacklist.
  OnBlacklistCleared(int64 time);

  // Notify the page on the new estimated effective connection type is |type|.
  // Also reports the session's maximum intervention effective connection type
  // |max_intervention_type| for slow pages. This method is called by
  // InterventionsInternalsPageHandler when the estimate network quality
  // changes.
  UpdateEffectiveConnectionType(string type, string max_intervention_type);

  // Notify the page on whether the blacklist decision is considered or ignored.
  // This method is called by InterventionsInternalsPageHandler when the status
  // of ignore blacklist decision is updated to |ignored|.
  OnIgnoreBlacklistDecisionStatusChanged(bool ignored);
};