summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/api/experimental_discovery.idl
blob: d8b4e5e3e873d8833f5bb984b3385509e4dafaed (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
// Copyright (c) 2012 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.

namespace experimental.discovery {

  dictionary SuggestDetails {
    // The URL to suggest and that will be displayed in the new tab page under
    // the recommended pane.
    DOMString linkUrl;

    // The linkified text. It should be relatively short.
    DOMString linkText;

    // The url of the image to use as a tile.
    DOMString? urlImage;

    // A score indicating how interesting that suggestion is. The value must be
    // between 0 and 1. A suggestion with score 1 is twice as likely to be
    // displayed than one with a score of 0.5. Defaults to 1.
    // TODO: need minimum=0 and maximum=1.
    double? score;
  };

  interface Functions {
    // Suggests a URL for discovery.
    // |details|: Detailed information on the URL to suggest.
    static void suggest(SuggestDetails details);

    // Removes a URL that was previously suggested for discovery by this
    // extension.
    // |linkUrl|: The URl to remove from discovery. Must be exactly the same as
    // a linkUrl previously used on a call to suggest.
    static void removeSuggestion(DOMString linkUrl);

    // Clear all the URLs that were previously suggested for discovery by this
    // extension.
    static void clearAllSuggestions();
  };
};