Home | History | Annotate | Download | only in api
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // An experimental API that allows extensions to inject suggest links in the recommended pane of the New Tab Page.
      6 namespace experimental.discovery {
      7 
      8   dictionary SuggestDetails {
      9     // The URL to suggest and that will be displayed in the new tab page under
     10     // the recommended pane.
     11     DOMString linkUrl;
     12 
     13     // The linkified text. It should be relatively short.
     14     DOMString linkText;
     15 
     16     // The url of the image to use as a tile.
     17     DOMString? urlImage;
     18 
     19     // A score indicating how interesting that suggestion is. The value must be
     20     // between 0 and 1. A suggestion with score 1 is twice as likely to be
     21     // displayed than one with a score of 0.5. Defaults to 1.
     22     // TODO: need minimum=0 and maximum=1.
     23     double? score;
     24   };
     25 
     26   interface Functions {
     27     // Suggests a URL for discovery.
     28     // |details|: Detailed information on the URL to suggest.
     29     static void suggest(SuggestDetails details);
     30 
     31     // Removes a URL that was previously suggested for discovery by this
     32     // extension.
     33     // |linkUrl|: The URl to remove from discovery. Must be exactly the same as
     34     // a linkUrl previously used on a call to suggest.
     35     static void removeSuggestion(DOMString linkUrl);
     36 
     37     // Clear all the URLs that were previously suggested for discovery by this
     38     // extension.
     39     static void clearAllSuggestions();
     40   };
     41 };
     42