Add facility to allow user functions to transform typed URLs.
[conkeror.git] / modules / minibuffer-read-mime-type.js
blob43c53dc37038ad6599020af2621b1452fb73b3ac
1 /**
2  * (C) Copyright 2008 Jeremy Maitin-Shepard
3  *
4  * Use, modification, and distribution are subject to the terms specified in the
5  * COPYING file.
6 **/
8 require("minibuffer-read.js");
10 let _gecko_viewable_mime_type_list = null;
12 __defineGetter__("gecko_viewable_mime_type_list", function () {
13                      if (_gecko_viewable_mime_type_list == null) {
14                          let list = [];
15                          var en = category_manager.enumerateCategory("Gecko-Content-Viewers");
16                          while (en.hasMoreElements()) list.push(en.getNext().QueryInterface(Ci.nsISupportsCString).toString());
17                          _gecko_viewable_mime_type_list = list;
18                      }
19                      return _gecko_viewable_mime_type_list;
20                  });
22 var category_manager = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
24 minibuffer.prototype.read_gecko_viewable_mime_type = function () {
25     var result = yield this.read(forward_keywords(arguments),
26                                  $match_required,
27                                  $completer = prefix_completer($completions = gecko_viewable_mime_type_list));
28     yield co_return(result);