summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals.mojom
blob: 1ce7954869db57abb10d7a0fd8f218ac3032c2aa (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
// 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.

module snippets_internals.mojom;

struct SuggestionCategory {
  int64 categoryId;
  string categoryTitle;
  string status;

  array<SuggestionItem> suggestions;
  array<SuggestionItem> dismissedSuggestions;
};

struct SuggestionItem {
  string suggestionTitle;
  string suggestionId;
  string suggestionIdWithinCategory;
  string url;
  string faviconUrl;
  string snippet;
  string publishDate;
  string publisherName;
  float score;
};

interface PageHandlerFactory {
  CreatePageHandler(Page page) => (PageHandler handler);
};

// Browser interface.
interface PageHandler {
  // Populate properties about preferences/flags.
  GetGeneralProperties() => (map<string, string> properties);

  // Populate the properties for the user classifier.
  GetUserClassifierProperties() => (map<string, string> properties);

  // Clear stored properties for the user classifier.
  ClearUserClassifierProperties();

  // Get category ranker tuples (abritrary field/values).
  GetCategoryRankerProperties() => (map<string, string> properties);

  // Reload the current suggestions.
  ReloadSuggestions();

  // Clear cached suggestions.
  ClearCachedSuggestions();

  // Get the remote content suggestions.
  GetRemoteContentSuggestionsProperties() => (map<string, string> properties);

  // Fetch suggestions in background after the given delay.
  FetchSuggestionsInBackground(int64 delaySeconds) => ();

  // Download the last suggestions in json form.
  GetLastJson() => (string json);

  // Get the suggestions by category.
  GetSuggestionsByCategory() => (array<SuggestionCategory> categories);

  // Clear the dismissed suggestions.
  ClearDismissedSuggestions(int64 category);
};

// Frontend interface.
interface Page {
  OnSuggestionsChanged();
};