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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585
// // DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl/nsIUpdateService.idl // /// `interface nsIUpdatePatch : nsISupports` /// /// ```text /// /** /// * An interface that describes an object representing a patch file that can /// * be downloaded and applied to a version of this application so that it /// * can be updated. /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIUpdatePatch { vtable: *const nsIUpdatePatchVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIUpdatePatch. unsafe impl XpCom for nsIUpdatePatch { const IID: nsIID = nsID(0xdc8fb8a9, 0x3a53, 0x4031, [0x94, 0x69, 0x2a, 0x51, 0x97, 0xea, 0x30, 0xe7]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIUpdatePatch { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIUpdatePatch. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIUpdatePatchCoerce { /// Cheaply cast a value of this type from a `nsIUpdatePatch`. fn coerce_from(v: &nsIUpdatePatch) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIUpdatePatchCoerce for nsIUpdatePatch { #[inline] fn coerce_from(v: &nsIUpdatePatch) -> &Self { v } } impl nsIUpdatePatch { /// Cast this `nsIUpdatePatch` to one of its base interfaces. #[inline] pub fn coerce<T: nsIUpdatePatchCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIUpdatePatch { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIUpdatePatchCoerce for T { #[inline] fn coerce_from(v: &nsIUpdatePatch) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIUpdatePatch // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIUpdatePatchVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* attribute AString type; */ pub GetType: unsafe extern "system" fn (this: *const nsIUpdatePatch, aType: &mut ::nsstring::nsAString) -> nsresult, /* attribute AString type; */ pub SetType: unsafe extern "system" fn (this: *const nsIUpdatePatch, aType: &::nsstring::nsAString) -> nsresult, /* attribute AString URL; */ pub GetURL: unsafe extern "system" fn (this: *const nsIUpdatePatch, aURL: &mut ::nsstring::nsAString) -> nsresult, /* attribute AString URL; */ pub SetURL: unsafe extern "system" fn (this: *const nsIUpdatePatch, aURL: &::nsstring::nsAString) -> nsresult, /* attribute AString finalURL; */ pub GetFinalURL: unsafe extern "system" fn (this: *const nsIUpdatePatch, aFinalURL: &mut ::nsstring::nsAString) -> nsresult, /* attribute AString finalURL; */ pub SetFinalURL: unsafe extern "system" fn (this: *const nsIUpdatePatch, aFinalURL: &::nsstring::nsAString) -> nsresult, /* attribute unsigned long size; */ pub GetSize: unsafe extern "system" fn (this: *const nsIUpdatePatch, aSize: *mut libc::uint32_t) -> nsresult, /* attribute unsigned long size; */ pub SetSize: unsafe extern "system" fn (this: *const nsIUpdatePatch, aSize: libc::uint32_t) -> nsresult, /* attribute AString state; */ pub GetState: unsafe extern "system" fn (this: *const nsIUpdatePatch, aState: &mut ::nsstring::nsAString) -> nsresult, /* attribute AString state; */ pub SetState: unsafe extern "system" fn (this: *const nsIUpdatePatch, aState: &::nsstring::nsAString) -> nsresult, /* attribute long errorCode; */ pub GetErrorCode: unsafe extern "system" fn (this: *const nsIUpdatePatch, aErrorCode: *mut libc::int32_t) -> nsresult, /* attribute long errorCode; */ pub SetErrorCode: unsafe extern "system" fn (this: *const nsIUpdatePatch, aErrorCode: libc::int32_t) -> nsresult, /* attribute boolean selected; */ pub GetSelected: unsafe extern "system" fn (this: *const nsIUpdatePatch, aSelected: *mut bool) -> nsresult, /* attribute boolean selected; */ pub SetSelected: unsafe extern "system" fn (this: *const nsIUpdatePatch, aSelected: bool) -> nsresult, /* nsIDOMElement serialize (in nsIDOMDocument updates); */ pub Serialize: unsafe extern "system" fn (this: *const nsIUpdatePatch, updates: *const nsIDOMDocument, _retval: *mut *const nsIDOMElement) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIUpdatePatch { /// ```text /// /** /// * The type of this patch: /// * "partial" A binary difference between two application versions /// * "complete" A complete patch containing all of the replacement files /// * to update to the new version /// */ /// ``` /// /// `attribute AString type;` #[inline] pub unsafe fn GetType(&self, aType: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetType)(self, aType) } /// ```text /// /** /// * The type of this patch: /// * "partial" A binary difference between two application versions /// * "complete" A complete patch containing all of the replacement files /// * to update to the new version /// */ /// ``` /// /// `attribute AString type;` #[inline] pub unsafe fn SetType(&self, aType: &::nsstring::nsAString) -> nsresult { ((*self.vtable).SetType)(self, aType) } /// ```text /// /** /// * The URL this patch was being downloaded from /// */ /// ``` /// /// `attribute AString URL;` #[inline] pub unsafe fn GetURL(&self, aURL: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetURL)(self, aURL) } /// ```text /// /** /// * The URL this patch was being downloaded from /// */ /// ``` /// /// `attribute AString URL;` #[inline] pub unsafe fn SetURL(&self, aURL: &::nsstring::nsAString) -> nsresult { ((*self.vtable).SetURL)(self, aURL) } /// ```text /// /** /// * The final URL this patch was being downloaded from /// */ /// ``` /// /// `attribute AString finalURL;` #[inline] pub unsafe fn GetFinalURL(&self, aFinalURL: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetFinalURL)(self, aFinalURL) } /// ```text /// /** /// * The final URL this patch was being downloaded from /// */ /// ``` /// /// `attribute AString finalURL;` #[inline] pub unsafe fn SetFinalURL(&self, aFinalURL: &::nsstring::nsAString) -> nsresult { ((*self.vtable).SetFinalURL)(self, aFinalURL) } /// ```text /// /** /// * The size of this file, in bytes. /// */ /// ``` /// /// `attribute unsigned long size;` #[inline] pub unsafe fn GetSize(&self, aSize: *mut libc::uint32_t) -> nsresult { ((*self.vtable).GetSize)(self, aSize) } /// ```text /// /** /// * The size of this file, in bytes. /// */ /// ``` /// /// `attribute unsigned long size;` #[inline] pub unsafe fn SetSize(&self, aSize: libc::uint32_t) -> nsresult { ((*self.vtable).SetSize)(self, aSize) } /// ```text /// /** /// * The state of this patch /// */ /// ``` /// /// `attribute AString state;` #[inline] pub unsafe fn GetState(&self, aState: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetState)(self, aState) } /// ```text /// /** /// * The state of this patch /// */ /// ``` /// /// `attribute AString state;` #[inline] pub unsafe fn SetState(&self, aState: &::nsstring::nsAString) -> nsresult { ((*self.vtable).SetState)(self, aState) } /// ```text /// /** /// * A numeric error code that conveys additional information about the state of /// * a failed update. If the update is not in the "failed" state the value is /// * zero. The possible values are located in common/errors.h and values between /// * 80 and 99 are in nsUpdateService.js. /// */ /// ``` /// /// `attribute long errorCode;` #[inline] pub unsafe fn GetErrorCode(&self, aErrorCode: *mut libc::int32_t) -> nsresult { ((*self.vtable).GetErrorCode)(self, aErrorCode) } /// ```text /// /** /// * A numeric error code that conveys additional information about the state of /// * a failed update. If the update is not in the "failed" state the value is /// * zero. The possible values are located in common/errors.h and values between /// * 80 and 99 are in nsUpdateService.js. /// */ /// ``` /// /// `attribute long errorCode;` #[inline] pub unsafe fn SetErrorCode(&self, aErrorCode: libc::int32_t) -> nsresult { ((*self.vtable).SetErrorCode)(self, aErrorCode) } /// ```text /// /** /// * true if this patch is currently selected as the patch to be downloaded and /// * installed for this update transaction, false if another patch from this /// * update has been selected. /// */ /// ``` /// /// `attribute boolean selected;` #[inline] pub unsafe fn GetSelected(&self, aSelected: *mut bool) -> nsresult { ((*self.vtable).GetSelected)(self, aSelected) } /// ```text /// /** /// * true if this patch is currently selected as the patch to be downloaded and /// * installed for this update transaction, false if another patch from this /// * update has been selected. /// */ /// ``` /// /// `attribute boolean selected;` #[inline] pub unsafe fn SetSelected(&self, aSelected: bool) -> nsresult { ((*self.vtable).SetSelected)(self, aSelected) } /// ```text /// /** /// * Serializes this patch object into a DOM Element /// * @param updates /// * The document to serialize into /// * @returns The DOM Element created by the serialization process /// */ /// ``` /// /// `nsIDOMElement serialize (in nsIDOMDocument updates);` #[inline] pub unsafe fn Serialize(&self, updates: *const nsIDOMDocument, _retval: *mut *const nsIDOMElement) -> nsresult { ((*self.vtable).Serialize)(self, updates, _retval) } } /// `interface nsIUpdate : nsISupports` /// /// ```text /// /** /// * An interface that describes an object representing an available update to /// * the current application - this update may have several available patches /// * from which one must be selected to download and install, for example we /// * might select a binary difference patch first and attempt to apply that, /// * then if the application process fails fall back to downloading a complete /// * file-replace patch. This object also contains information about the update /// * that the front end and other application services can use to learn more /// * about what is going on. /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIUpdate { vtable: *const nsIUpdateVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIUpdate. unsafe impl XpCom for nsIUpdate { const IID: nsIID = nsID(0xe094c045, 0xf4ff, 0x41fd, [0x92, 0xda, 0xcd, 0x2e, 0xff, 0xd2, 0xc7, 0xc9]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIUpdate { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIUpdate. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIUpdateCoerce { /// Cheaply cast a value of this type from a `nsIUpdate`. fn coerce_from(v: &nsIUpdate) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIUpdateCoerce for nsIUpdate { #[inline] fn coerce_from(v: &nsIUpdate) -> &Self { v } } impl nsIUpdate { /// Cast this `nsIUpdate` to one of its base interfaces. #[inline] pub fn coerce<T: nsIUpdateCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIUpdate { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIUpdateCoerce for T { #[inline] fn coerce_from(v: &nsIUpdate) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIUpdate // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIUpdateVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* attribute AString type; */ pub GetType: unsafe extern "system" fn (this: *const nsIUpdate, aType: &mut ::nsstring::nsAString) -> nsresult, /* attribute AString type; */ pub SetType: unsafe extern "system" fn (this: *const nsIUpdate, aType: &::nsstring::nsAString) -> nsresult, /* attribute AString name; */ pub GetName: unsafe extern "system" fn (this: *const nsIUpdate, aName: &mut ::nsstring::nsAString) -> nsresult, /* attribute AString name; */ pub SetName: unsafe extern "system" fn (this: *const nsIUpdate, aName: &::nsstring::nsAString) -> nsresult, /* attribute AString displayVersion; */ pub GetDisplayVersion: unsafe extern "system" fn (this: *const nsIUpdate, aDisplayVersion: &mut ::nsstring::nsAString) -> nsresult, /* attribute AString displayVersion; */ pub SetDisplayVersion: unsafe extern "system" fn (this: *const nsIUpdate, aDisplayVersion: &::nsstring::nsAString) -> nsresult, /* attribute AString appVersion; */ pub GetAppVersion: unsafe extern "system" fn (this: *const nsIUpdate, aAppVersion: &mut ::nsstring::nsAString) -> nsresult, /* attribute AString appVersion; */ pub SetAppVersion: unsafe extern "system" fn (this: *const nsIUpdate, aAppVersion: &::nsstring::nsAString) -> nsresult, /* attribute AString previousAppVersion; */ pub GetPreviousAppVersion: unsafe extern "system" fn (this: *const nsIUpdate, aPreviousAppVersion: &mut ::nsstring::nsAString) -> nsresult, /* attribute AString previousAppVersion; */ pub SetPreviousAppVersion: unsafe extern "system" fn (this: *const nsIUpdate, aPreviousAppVersion: &::nsstring::nsAString) -> nsresult, /* attribute AString buildID; */ pub GetBuildID: unsafe extern "system" fn (this: *const nsIUpdate, aBuildID: &mut ::nsstring::nsAString) -> nsresult, /* attribute AString buildID; */ pub SetBuildID: unsafe extern "system" fn (this: *const nsIUpdate, aBuildID: &::nsstring::nsAString) -> nsresult, /* attribute AString detailsURL; */ pub GetDetailsURL: unsafe extern "system" fn (this: *const nsIUpdate, aDetailsURL: &mut ::nsstring::nsAString) -> nsresult, /* attribute AString detailsURL; */ pub SetDetailsURL: unsafe extern "system" fn (this: *const nsIUpdate, aDetailsURL: &::nsstring::nsAString) -> nsresult, /* attribute AString serviceURL; */ pub GetServiceURL: unsafe extern "system" fn (this: *const nsIUpdate, aServiceURL: &mut ::nsstring::nsAString) -> nsresult, /* attribute AString serviceURL; */ pub SetServiceURL: unsafe extern "system" fn (this: *const nsIUpdate, aServiceURL: &::nsstring::nsAString) -> nsresult, /* attribute AString channel; */ pub GetChannel: unsafe extern "system" fn (this: *const nsIUpdate, aChannel: &mut ::nsstring::nsAString) -> nsresult, /* attribute AString channel; */ pub SetChannel: unsafe extern "system" fn (this: *const nsIUpdate, aChannel: &::nsstring::nsAString) -> nsresult, /* attribute boolean unsupported; */ pub GetUnsupported: unsafe extern "system" fn (this: *const nsIUpdate, aUnsupported: *mut bool) -> nsresult, /* attribute boolean unsupported; */ pub SetUnsupported: unsafe extern "system" fn (this: *const nsIUpdate, aUnsupported: bool) -> nsresult, /* attribute long long promptWaitTime; */ pub GetPromptWaitTime: unsafe extern "system" fn (this: *const nsIUpdate, aPromptWaitTime: *mut libc::int64_t) -> nsresult, /* attribute long long promptWaitTime; */ pub SetPromptWaitTime: unsafe extern "system" fn (this: *const nsIUpdate, aPromptWaitTime: libc::int64_t) -> nsresult, /* attribute boolean isCompleteUpdate; */ pub GetIsCompleteUpdate: unsafe extern "system" fn (this: *const nsIUpdate, aIsCompleteUpdate: *mut bool) -> nsresult, /* attribute boolean isCompleteUpdate; */ pub SetIsCompleteUpdate: unsafe extern "system" fn (this: *const nsIUpdate, aIsCompleteUpdate: bool) -> nsresult, /* attribute long long installDate; */ pub GetInstallDate: unsafe extern "system" fn (this: *const nsIUpdate, aInstallDate: *mut libc::int64_t) -> nsresult, /* attribute long long installDate; */ pub SetInstallDate: unsafe extern "system" fn (this: *const nsIUpdate, aInstallDate: libc::int64_t) -> nsresult, /* attribute AString statusText; */ pub GetStatusText: unsafe extern "system" fn (this: *const nsIUpdate, aStatusText: &mut ::nsstring::nsAString) -> nsresult, /* attribute AString statusText; */ pub SetStatusText: unsafe extern "system" fn (this: *const nsIUpdate, aStatusText: &::nsstring::nsAString) -> nsresult, /* readonly attribute nsIUpdatePatch selectedPatch; */ pub GetSelectedPatch: unsafe extern "system" fn (this: *const nsIUpdate, aSelectedPatch: *mut *const nsIUpdatePatch) -> nsresult, /* attribute AString state; */ pub GetState: unsafe extern "system" fn (this: *const nsIUpdate, aState: &mut ::nsstring::nsAString) -> nsresult, /* attribute AString state; */ pub SetState: unsafe extern "system" fn (this: *const nsIUpdate, aState: &::nsstring::nsAString) -> nsresult, /* attribute long errorCode; */ pub GetErrorCode: unsafe extern "system" fn (this: *const nsIUpdate, aErrorCode: *mut libc::int32_t) -> nsresult, /* attribute long errorCode; */ pub SetErrorCode: unsafe extern "system" fn (this: *const nsIUpdate, aErrorCode: libc::int32_t) -> nsresult, /* attribute boolean elevationFailure; */ pub GetElevationFailure: unsafe extern "system" fn (this: *const nsIUpdate, aElevationFailure: *mut bool) -> nsresult, /* attribute boolean elevationFailure; */ pub SetElevationFailure: unsafe extern "system" fn (this: *const nsIUpdate, aElevationFailure: bool) -> nsresult, /* readonly attribute unsigned long patchCount; */ pub GetPatchCount: unsafe extern "system" fn (this: *const nsIUpdate, aPatchCount: *mut libc::uint32_t) -> nsresult, /* nsIUpdatePatch getPatchAt (in unsigned long index); */ pub GetPatchAt: unsafe extern "system" fn (this: *const nsIUpdate, index: libc::uint32_t, _retval: *mut *const nsIUpdatePatch) -> nsresult, /* nsIDOMElement serialize (in nsIDOMDocument updates); */ pub Serialize: unsafe extern "system" fn (this: *const nsIUpdate, updates: *const nsIDOMDocument, _retval: *mut *const nsIDOMElement) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIUpdate { /// ```text /// /** /// * The type of update: /// * "major" A major new version of the Application /// * "minor" A minor update to the Application (e.g. security update) /// */ /// ``` /// /// `attribute AString type;` #[inline] pub unsafe fn GetType(&self, aType: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetType)(self, aType) } /// ```text /// /** /// * The type of update: /// * "major" A major new version of the Application /// * "minor" A minor update to the Application (e.g. security update) /// */ /// ``` /// /// `attribute AString type;` #[inline] pub unsafe fn SetType(&self, aType: &::nsstring::nsAString) -> nsresult { ((*self.vtable).SetType)(self, aType) } /// ```text /// /** /// * The name of the update, or "<Application Name> <Update Version>" /// */ /// ``` /// /// `attribute AString name;` #[inline] pub unsafe fn GetName(&self, aName: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetName)(self, aName) } /// ```text /// /** /// * The name of the update, or "<Application Name> <Update Version>" /// */ /// ``` /// /// `attribute AString name;` #[inline] pub unsafe fn SetName(&self, aName: &::nsstring::nsAString) -> nsresult { ((*self.vtable).SetName)(self, aName) } /// ```text /// /** /// * The string to display in the user interface for the version. If you want /// * a real version number use appVersion. /// */ /// ``` /// /// `attribute AString displayVersion;` #[inline] pub unsafe fn GetDisplayVersion(&self, aDisplayVersion: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetDisplayVersion)(self, aDisplayVersion) } /// ```text /// /** /// * The string to display in the user interface for the version. If you want /// * a real version number use appVersion. /// */ /// ``` /// /// `attribute AString displayVersion;` #[inline] pub unsafe fn SetDisplayVersion(&self, aDisplayVersion: &::nsstring::nsAString) -> nsresult { ((*self.vtable).SetDisplayVersion)(self, aDisplayVersion) } /// ```text /// /** /// * The Application version of this update. /// */ /// ``` /// /// `attribute AString appVersion;` #[inline] pub unsafe fn GetAppVersion(&self, aAppVersion: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetAppVersion)(self, aAppVersion) } /// ```text /// /** /// * The Application version of this update. /// */ /// ``` /// /// `attribute AString appVersion;` #[inline] pub unsafe fn SetAppVersion(&self, aAppVersion: &::nsstring::nsAString) -> nsresult { ((*self.vtable).SetAppVersion)(self, aAppVersion) } /// ```text /// /** /// * The Application version prior to the application being updated. /// */ /// ``` /// /// `attribute AString previousAppVersion;` #[inline] pub unsafe fn GetPreviousAppVersion(&self, aPreviousAppVersion: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetPreviousAppVersion)(self, aPreviousAppVersion) } /// ```text /// /** /// * The Application version prior to the application being updated. /// */ /// ``` /// /// `attribute AString previousAppVersion;` #[inline] pub unsafe fn SetPreviousAppVersion(&self, aPreviousAppVersion: &::nsstring::nsAString) -> nsresult { ((*self.vtable).SetPreviousAppVersion)(self, aPreviousAppVersion) } /// ```text /// /** /// * The Build ID of this update. Used to determine a particular build, down /// * to the hour, minute and second of its creation. This allows the system /// * to differentiate between several nightly builds with the same |version| /// * for example. /// */ /// ``` /// /// `attribute AString buildID;` #[inline] pub unsafe fn GetBuildID(&self, aBuildID: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetBuildID)(self, aBuildID) } /// ```text /// /** /// * The Build ID of this update. Used to determine a particular build, down /// * to the hour, minute and second of its creation. This allows the system /// * to differentiate between several nightly builds with the same |version| /// * for example. /// */ /// ``` /// /// `attribute AString buildID;` #[inline] pub unsafe fn SetBuildID(&self, aBuildID: &::nsstring::nsAString) -> nsresult { ((*self.vtable).SetBuildID)(self, aBuildID) } /// ```text /// /** /// * The URL to a page which offers details about the content of this /// * update. Ideally, this page is not the release notes but some other page /// * that summarizes the differences between this update and the previous, /// * which also links to the release notes. /// */ /// ``` /// /// `attribute AString detailsURL;` #[inline] pub unsafe fn GetDetailsURL(&self, aDetailsURL: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetDetailsURL)(self, aDetailsURL) } /// ```text /// /** /// * The URL to a page which offers details about the content of this /// * update. Ideally, this page is not the release notes but some other page /// * that summarizes the differences between this update and the previous, /// * which also links to the release notes. /// */ /// ``` /// /// `attribute AString detailsURL;` #[inline] pub unsafe fn SetDetailsURL(&self, aDetailsURL: &::nsstring::nsAString) -> nsresult { ((*self.vtable).SetDetailsURL)(self, aDetailsURL) } /// ```text /// /** /// * The URL to the Update Service that supplied this update. /// */ /// ``` /// /// `attribute AString serviceURL;` #[inline] pub unsafe fn GetServiceURL(&self, aServiceURL: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetServiceURL)(self, aServiceURL) } /// ```text /// /** /// * The URL to the Update Service that supplied this update. /// */ /// ``` /// /// `attribute AString serviceURL;` #[inline] pub unsafe fn SetServiceURL(&self, aServiceURL: &::nsstring::nsAString) -> nsresult { ((*self.vtable).SetServiceURL)(self, aServiceURL) } /// ```text /// /** /// * The channel used to retrieve this update from the Update Service. /// */ /// ``` /// /// `attribute AString channel;` #[inline] pub unsafe fn GetChannel(&self, aChannel: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetChannel)(self, aChannel) } /// ```text /// /** /// * The channel used to retrieve this update from the Update Service. /// */ /// ``` /// /// `attribute AString channel;` #[inline] pub unsafe fn SetChannel(&self, aChannel: &::nsstring::nsAString) -> nsresult { ((*self.vtable).SetChannel)(self, aChannel) } /// ```text /// /** /// * Whether the update is no longer supported on this system. /// */ /// ``` /// /// `attribute boolean unsupported;` #[inline] pub unsafe fn GetUnsupported(&self, aUnsupported: *mut bool) -> nsresult { ((*self.vtable).GetUnsupported)(self, aUnsupported) } /// ```text /// /** /// * Whether the update is no longer supported on this system. /// */ /// ``` /// /// `attribute boolean unsupported;` #[inline] pub unsafe fn SetUnsupported(&self, aUnsupported: bool) -> nsresult { ((*self.vtable).SetUnsupported)(self, aUnsupported) } /// ```text /// /** /// * Allows overriding the default amount of time in seconds before prompting the /// * user to apply an update. If not specified, the value of /// * app.update.promptWaitTime will be used. /// */ /// ``` /// /// `attribute long long promptWaitTime;` #[inline] pub unsafe fn GetPromptWaitTime(&self, aPromptWaitTime: *mut libc::int64_t) -> nsresult { ((*self.vtable).GetPromptWaitTime)(self, aPromptWaitTime) } /// ```text /// /** /// * Allows overriding the default amount of time in seconds before prompting the /// * user to apply an update. If not specified, the value of /// * app.update.promptWaitTime will be used. /// */ /// ``` /// /// `attribute long long promptWaitTime;` #[inline] pub unsafe fn SetPromptWaitTime(&self, aPromptWaitTime: libc::int64_t) -> nsresult { ((*self.vtable).SetPromptWaitTime)(self, aPromptWaitTime) } /// ```text /// /** /// * Whether or not the update being downloaded is a complete replacement of /// * the user's existing installation or a patch representing the difference /// * between the new version and the previous version. /// */ /// ``` /// /// `attribute boolean isCompleteUpdate;` #[inline] pub unsafe fn GetIsCompleteUpdate(&self, aIsCompleteUpdate: *mut bool) -> nsresult { ((*self.vtable).GetIsCompleteUpdate)(self, aIsCompleteUpdate) } /// ```text /// /** /// * Whether or not the update being downloaded is a complete replacement of /// * the user's existing installation or a patch representing the difference /// * between the new version and the previous version. /// */ /// ``` /// /// `attribute boolean isCompleteUpdate;` #[inline] pub unsafe fn SetIsCompleteUpdate(&self, aIsCompleteUpdate: bool) -> nsresult { ((*self.vtable).SetIsCompleteUpdate)(self, aIsCompleteUpdate) } /// ```text /// /** /// * When the update was installed. /// */ /// ``` /// /// `attribute long long installDate;` #[inline] pub unsafe fn GetInstallDate(&self, aInstallDate: *mut libc::int64_t) -> nsresult { ((*self.vtable).GetInstallDate)(self, aInstallDate) } /// ```text /// /** /// * When the update was installed. /// */ /// ``` /// /// `attribute long long installDate;` #[inline] pub unsafe fn SetInstallDate(&self, aInstallDate: libc::int64_t) -> nsresult { ((*self.vtable).SetInstallDate)(self, aInstallDate) } /// ```text /// /** /// * A message associated with this update, if any. /// */ /// ``` /// /// `attribute AString statusText;` #[inline] pub unsafe fn GetStatusText(&self, aStatusText: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetStatusText)(self, aStatusText) } /// ```text /// /** /// * A message associated with this update, if any. /// */ /// ``` /// /// `attribute AString statusText;` #[inline] pub unsafe fn SetStatusText(&self, aStatusText: &::nsstring::nsAString) -> nsresult { ((*self.vtable).SetStatusText)(self, aStatusText) } /// ```text /// /** /// * The currently selected patch for this update. /// */ /// ``` /// /// `readonly attribute nsIUpdatePatch selectedPatch;` #[inline] pub unsafe fn GetSelectedPatch(&self, aSelectedPatch: *mut *const nsIUpdatePatch) -> nsresult { ((*self.vtable).GetSelectedPatch)(self, aSelectedPatch) } /// ```text /// /** /// * The state of the selected patch: /// * "downloading" The update is being downloaded. /// * "pending" The update is ready to be applied. /// * "pending-service" The update is ready to be applied with the service. /// * "pending-elevate" The update is ready to be applied but requires elevation. /// * "applying" The update is being applied. /// * "applied" The update is ready to be switched to. /// * "applied-os" The update is OS update and to be installed. /// * "applied-service" The update is ready to be switched to with the service. /// * "succeeded" The update was successfully applied. /// * "download-failed" The update failed to be downloaded. /// * "failed" The update failed to be applied. /// */ /// ``` /// /// `attribute AString state;` #[inline] pub unsafe fn GetState(&self, aState: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetState)(self, aState) } /// ```text /// /** /// * The state of the selected patch: /// * "downloading" The update is being downloaded. /// * "pending" The update is ready to be applied. /// * "pending-service" The update is ready to be applied with the service. /// * "pending-elevate" The update is ready to be applied but requires elevation. /// * "applying" The update is being applied. /// * "applied" The update is ready to be switched to. /// * "applied-os" The update is OS update and to be installed. /// * "applied-service" The update is ready to be switched to with the service. /// * "succeeded" The update was successfully applied. /// * "download-failed" The update failed to be downloaded. /// * "failed" The update failed to be applied. /// */ /// ``` /// /// `attribute AString state;` #[inline] pub unsafe fn SetState(&self, aState: &::nsstring::nsAString) -> nsresult { ((*self.vtable).SetState)(self, aState) } /// ```text /// /** /// * A numeric error code that conveys additional information about the state of /// * a failed update. If the update is not in the "failed" state the value is /// * zero. The possible values are located in common/errors.h and values between /// * 80 and 99 are in nsUpdateService.js. /// */ /// ``` /// /// `attribute long errorCode;` #[inline] pub unsafe fn GetErrorCode(&self, aErrorCode: *mut libc::int32_t) -> nsresult { ((*self.vtable).GetErrorCode)(self, aErrorCode) } /// ```text /// /** /// * A numeric error code that conveys additional information about the state of /// * a failed update. If the update is not in the "failed" state the value is /// * zero. The possible values are located in common/errors.h and values between /// * 80 and 99 are in nsUpdateService.js. /// */ /// ``` /// /// `attribute long errorCode;` #[inline] pub unsafe fn SetErrorCode(&self, aErrorCode: libc::int32_t) -> nsresult { ((*self.vtable).SetErrorCode)(self, aErrorCode) } /// ```text /// /** /// * Whether an elevation failure has been encountered for this update. /// */ /// ``` /// /// `attribute boolean elevationFailure;` #[inline] pub unsafe fn GetElevationFailure(&self, aElevationFailure: *mut bool) -> nsresult { ((*self.vtable).GetElevationFailure)(self, aElevationFailure) } /// ```text /// /** /// * Whether an elevation failure has been encountered for this update. /// */ /// ``` /// /// `attribute boolean elevationFailure;` #[inline] pub unsafe fn SetElevationFailure(&self, aElevationFailure: bool) -> nsresult { ((*self.vtable).SetElevationFailure)(self, aElevationFailure) } /// ```text /// /** /// * The number of patches supplied by this update. /// */ /// ``` /// /// `readonly attribute unsigned long patchCount;` #[inline] pub unsafe fn GetPatchCount(&self, aPatchCount: *mut libc::uint32_t) -> nsresult { ((*self.vtable).GetPatchCount)(self, aPatchCount) } /// ```text /// /** /// * Retrieves a patch. /// * @param index /// * The index of the patch to retrieve. /// * @returns The nsIUpdatePatch at the specified index. /// */ /// ``` /// /// `nsIUpdatePatch getPatchAt (in unsigned long index);` #[inline] pub unsafe fn GetPatchAt(&self, index: libc::uint32_t, _retval: *mut *const nsIUpdatePatch) -> nsresult { ((*self.vtable).GetPatchAt)(self, index, _retval) } /// ```text /// /** /// * Serializes this update object into a DOM Element /// * @param updates /// * The document to serialize into /// * @returns The DOM Element created by the serialization process /// */ /// ``` /// /// `nsIDOMElement serialize (in nsIDOMDocument updates);` #[inline] pub unsafe fn Serialize(&self, updates: *const nsIDOMDocument, _retval: *mut *const nsIDOMElement) -> nsresult { ((*self.vtable).Serialize)(self, updates, _retval) } } /// `interface nsIUpdateCheckListener : nsISupports` /// /// ```text /// /** /// * An interface describing an object that listens to the progress of an update /// * check operation. This object is notified as the check continues, finishes /// * and if it has an error. /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIUpdateCheckListener { vtable: *const nsIUpdateCheckListenerVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIUpdateCheckListener. unsafe impl XpCom for nsIUpdateCheckListener { const IID: nsIID = nsID(0x4aa2b4bb, 0x39ea, 0x407b, [0x98, 0xff, 0x89, 0xf1, 0x91, 0x34, 0xd4, 0xc0]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIUpdateCheckListener { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIUpdateCheckListener. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIUpdateCheckListenerCoerce { /// Cheaply cast a value of this type from a `nsIUpdateCheckListener`. fn coerce_from(v: &nsIUpdateCheckListener) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIUpdateCheckListenerCoerce for nsIUpdateCheckListener { #[inline] fn coerce_from(v: &nsIUpdateCheckListener) -> &Self { v } } impl nsIUpdateCheckListener { /// Cast this `nsIUpdateCheckListener` to one of its base interfaces. #[inline] pub fn coerce<T: nsIUpdateCheckListenerCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIUpdateCheckListener { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIUpdateCheckListenerCoerce for T { #[inline] fn coerce_from(v: &nsIUpdateCheckListener) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIUpdateCheckListener // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIUpdateCheckListenerVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void onCheckComplete (in jsval request, [array, size_is (updateCount)] in nsIUpdate updates, in unsigned long updateCount); */ /// Unable to generate binding because `native type JS::Value is unsupported` pub OnCheckComplete: *const ::libc::c_void, /* void onError (in jsval request, in nsIUpdate update); */ /// Unable to generate binding because `native type JS::Value is unsupported` pub OnError: *const ::libc::c_void, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIUpdateCheckListener { /// ```text /// /** /// * The update check was completed. /// * @param request /// * The XMLHttpRequest handling the update check. /// * @param updates /// * An array of nsIUpdate objects listing available updates. /// * @param updateCount /// * The size of the |updates| array. /// */ /// ``` /// /// `void onCheckComplete (in jsval request, [array, size_is (updateCount)] in nsIUpdate updates, in unsigned long updateCount);` const _OnCheckComplete: () = (); /// ```text /// /** /// * An error occurred while loading the remote update service file. /// * @param request /// * The XMLHttpRequest handling the update check. /// * @param update /// * A nsIUpdate object that contains details about the /// * error in its |statusText| property. /// */ /// ``` /// /// `void onError (in jsval request, in nsIUpdate update);` const _OnError: () = (); } /// `interface nsIUpdateChecker : nsISupports` /// /// ```text /// /** /// * An interface describing an object that knows how to check for updates. /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIUpdateChecker { vtable: *const nsIUpdateCheckerVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIUpdateChecker. unsafe impl XpCom for nsIUpdateChecker { const IID: nsIID = nsID(0x877ace25, 0x8bc5, 0x452a, [0x85, 0x86, 0x9c, 0x1c, 0xf2, 0x87, 0x19, 0x94]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIUpdateChecker { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIUpdateChecker. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIUpdateCheckerCoerce { /// Cheaply cast a value of this type from a `nsIUpdateChecker`. fn coerce_from(v: &nsIUpdateChecker) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIUpdateCheckerCoerce for nsIUpdateChecker { #[inline] fn coerce_from(v: &nsIUpdateChecker) -> &Self { v } } impl nsIUpdateChecker { /// Cast this `nsIUpdateChecker` to one of its base interfaces. #[inline] pub fn coerce<T: nsIUpdateCheckerCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIUpdateChecker { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIUpdateCheckerCoerce for T { #[inline] fn coerce_from(v: &nsIUpdateChecker) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIUpdateChecker // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIUpdateCheckerVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void checkForUpdates (in nsIUpdateCheckListener listener, in boolean force); */ pub CheckForUpdates: unsafe extern "system" fn (this: *const nsIUpdateChecker, listener: *const nsIUpdateCheckListener, force: bool) -> nsresult, /* void stopChecking (in unsigned short duration); */ pub StopChecking: unsafe extern "system" fn (this: *const nsIUpdateChecker, duration: libc::uint16_t) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIUpdateChecker { /// ```text /// /** /// * Constants for the |stopChecking| function that tell the Checker how long /// * to stop checking: /// * /// * CURRENT_CHECK: Stops the current (active) check only /// * CURRENT_SESSION: Stops all checking for the current session /// * ANY_CHECKS: Stops all checking, any session from now on /// * (disables update checking preferences) /// */ /// ``` /// pub const CURRENT_CHECK: i64 = 1; pub const CURRENT_SESSION: i64 = 2; pub const ANY_CHECKS: i64 = 3; /// ```text /// /** /// * Checks for available updates, notifying a listener of the results. /// * @param listener /// * An object implementing nsIUpdateCheckListener which is notified /// * of the results of an update check. /// * @param force /// * Forces the checker to check for updates, regardless of the /// * current value of the user's update settings. This is used by /// * any piece of UI that offers the user the imperative option to /// * check for updates now, regardless of their update settings. /// * force will not work if the system administrator has locked /// * the app.update.enabled preference. /// */ /// ``` /// /// `void checkForUpdates (in nsIUpdateCheckListener listener, in boolean force);` #[inline] pub unsafe fn CheckForUpdates(&self, listener: *const nsIUpdateCheckListener, force: bool) -> nsresult { ((*self.vtable).CheckForUpdates)(self, listener, force) } /// ```text /// /** /// * Ends any pending update check. /// * @param duration /// * A value representing the set of checks to stop doing. /// */ /// ``` /// /// `void stopChecking (in unsigned short duration);` #[inline] pub unsafe fn StopChecking(&self, duration: libc::uint16_t) -> nsresult { ((*self.vtable).StopChecking)(self, duration) } } /// `interface nsIApplicationUpdateService : nsISupports` /// /// ```text /// /** /// * An interface describing a global application service that handles performing /// * background update checks and provides utilities for selecting and /// * downloading update patches. /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIApplicationUpdateService { vtable: *const nsIApplicationUpdateServiceVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIApplicationUpdateService. unsafe impl XpCom for nsIApplicationUpdateService { const IID: nsIID = nsID(0x1107d207, 0xa263, 0x403a, [0xb2, 0x68, 0x05, 0x77, 0x2e, 0xc1, 0x07, 0x57]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIApplicationUpdateService { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIApplicationUpdateService. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIApplicationUpdateServiceCoerce { /// Cheaply cast a value of this type from a `nsIApplicationUpdateService`. fn coerce_from(v: &nsIApplicationUpdateService) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIApplicationUpdateServiceCoerce for nsIApplicationUpdateService { #[inline] fn coerce_from(v: &nsIApplicationUpdateService) -> &Self { v } } impl nsIApplicationUpdateService { /// Cast this `nsIApplicationUpdateService` to one of its base interfaces. #[inline] pub fn coerce<T: nsIApplicationUpdateServiceCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIApplicationUpdateService { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIApplicationUpdateServiceCoerce for T { #[inline] fn coerce_from(v: &nsIApplicationUpdateService) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIApplicationUpdateService // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIApplicationUpdateServiceVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void checkForBackgroundUpdates (); */ pub CheckForBackgroundUpdates: unsafe extern "system" fn (this: *const nsIApplicationUpdateService) -> nsresult, /* readonly attribute nsIUpdateChecker backgroundChecker; */ pub GetBackgroundChecker: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aBackgroundChecker: *mut *const nsIUpdateChecker) -> nsresult, /* nsIUpdate selectUpdate ([array, size_is (updateCount)] in nsIUpdate updates, in unsigned long updateCount); */ pub SelectUpdate: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, updates: *mut *const nsIUpdate, updateCount: libc::uint32_t, _retval: *mut *const nsIUpdate) -> nsresult, /* void addDownloadListener (in nsIRequestObserver listener); */ pub AddDownloadListener: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, listener: *const nsIRequestObserver) -> nsresult, /* void removeDownloadListener (in nsIRequestObserver listener); */ pub RemoveDownloadListener: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, listener: *const nsIRequestObserver) -> nsresult, /* AString downloadUpdate (in nsIUpdate update, in boolean background); */ pub DownloadUpdate: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, update: *const nsIUpdate, background: bool, _retval: &mut ::nsstring::nsAString) -> nsresult, /* nsIFile getUpdatesDirectory (); */ pub GetUpdatesDirectory: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, _retval: *mut *const nsIFile) -> nsresult, /* void pauseDownload (); */ pub PauseDownload: unsafe extern "system" fn (this: *const nsIApplicationUpdateService) -> nsresult, /* readonly attribute boolean isDownloading; */ pub GetIsDownloading: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aIsDownloading: *mut bool) -> nsresult, /* readonly attribute boolean canCheckForUpdates; */ pub GetCanCheckForUpdates: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aCanCheckForUpdates: *mut bool) -> nsresult, /* readonly attribute boolean elevationRequired; */ pub GetElevationRequired: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aElevationRequired: *mut bool) -> nsresult, /* readonly attribute boolean canApplyUpdates; */ pub GetCanApplyUpdates: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aCanApplyUpdates: *mut bool) -> nsresult, /* readonly attribute boolean isOtherInstanceHandlingUpdates; */ pub GetIsOtherInstanceHandlingUpdates: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aIsOtherInstanceHandlingUpdates: *mut bool) -> nsresult, /* readonly attribute boolean canStageUpdates; */ pub GetCanStageUpdates: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aCanStageUpdates: *mut bool) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIApplicationUpdateService { /// ```text /// /** /// * Checks for available updates in the background using the listener provided /// * by the application update service for background checks. /// */ /// ``` /// /// `void checkForBackgroundUpdates ();` #[inline] pub unsafe fn CheckForBackgroundUpdates(&self, ) -> nsresult { ((*self.vtable).CheckForBackgroundUpdates)(self, ) } /// ```text /// /** /// * The Update Checker used for background update checking. /// */ /// ``` /// /// `readonly attribute nsIUpdateChecker backgroundChecker;` #[inline] pub unsafe fn GetBackgroundChecker(&self, aBackgroundChecker: *mut *const nsIUpdateChecker) -> nsresult { ((*self.vtable).GetBackgroundChecker)(self, aBackgroundChecker) } /// ```text /// /** /// * Selects the best update to install from a list of available updates. /// * @param updates /// * An array of updates that are available /// * @param updateCount /// * The length of the |updates| array /// */ /// ``` /// /// `nsIUpdate selectUpdate ([array, size_is (updateCount)] in nsIUpdate updates, in unsigned long updateCount);` #[inline] pub unsafe fn SelectUpdate(&self, updates: *mut *const nsIUpdate, updateCount: libc::uint32_t, _retval: *mut *const nsIUpdate) -> nsresult { ((*self.vtable).SelectUpdate)(self, updates, updateCount, _retval) } /// ```text /// /** /// * Adds a listener that receives progress and state information about the /// * update that is currently being downloaded, e.g. to update a user /// * interface. /// * @param listener /// * An object implementing nsIRequestObserver and optionally /// * nsIProgressEventSink that is to be notified of state and /// * progress information as the update is downloaded. /// */ /// ``` /// /// `void addDownloadListener (in nsIRequestObserver listener);` #[inline] pub unsafe fn AddDownloadListener(&self, listener: *const nsIRequestObserver) -> nsresult { ((*self.vtable).AddDownloadListener)(self, listener) } /// ```text /// /** /// * Removes a listener that is receiving progress and state information /// * about the update that is currently being downloaded. /// * @param listener /// * The listener object to remove. /// */ /// ``` /// /// `void removeDownloadListener (in nsIRequestObserver listener);` #[inline] pub unsafe fn RemoveDownloadListener(&self, listener: *const nsIRequestObserver) -> nsresult { ((*self.vtable).RemoveDownloadListener)(self, listener) } /// ```text /// /** /// * /// */ /// ``` /// /// `AString downloadUpdate (in nsIUpdate update, in boolean background);` #[inline] pub unsafe fn DownloadUpdate(&self, update: *const nsIUpdate, background: bool, _retval: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).DownloadUpdate)(self, update, background, _retval) } /// ```text /// /** /// * Get the Active Updates directory /// * @returns An nsIFile for the active updates directory. /// */ /// ``` /// /// `nsIFile getUpdatesDirectory ();` #[inline] pub unsafe fn GetUpdatesDirectory(&self, _retval: *mut *const nsIFile) -> nsresult { ((*self.vtable).GetUpdatesDirectory)(self, _retval) } /// ```text /// /** /// * Pauses the active update download process /// */ /// ``` /// /// `void pauseDownload ();` #[inline] pub unsafe fn PauseDownload(&self, ) -> nsresult { ((*self.vtable).PauseDownload)(self, ) } /// ```text /// /** /// * Whether or not there is an download happening at the moment. /// */ /// ``` /// /// `readonly attribute boolean isDownloading;` #[inline] pub unsafe fn GetIsDownloading(&self, aIsDownloading: *mut bool) -> nsresult { ((*self.vtable).GetIsDownloading)(self, aIsDownloading) } /// ```text /// /** /// * Whether or not the Update Service can check for updates. This is a function /// * of whether or not application update is disabled by the application and the /// * platform the application is running on. /// */ /// ``` /// /// `readonly attribute boolean canCheckForUpdates;` #[inline] pub unsafe fn GetCanCheckForUpdates(&self, aCanCheckForUpdates: *mut bool) -> nsresult { ((*self.vtable).GetCanCheckForUpdates)(self, aCanCheckForUpdates) } /// ```text /// /** /// * Whether or not the installation requires elevation. Currently only /// * implemented on OSX, returns false on other platforms. /// */ /// ``` /// /// `readonly attribute boolean elevationRequired;` #[inline] pub unsafe fn GetElevationRequired(&self, aElevationRequired: *mut bool) -> nsresult { ((*self.vtable).GetElevationRequired)(self, aElevationRequired) } /// ```text /// /** /// * Whether or not the Update Service can download and install updates. /// * On Windows, this is a function of whether or not the maintenance service /// * is installed and enabled. On other systems, and as a fallback on Windows, /// * this depends on whether the current user has write access to the install /// * directory. /// */ /// ``` /// /// `readonly attribute boolean canApplyUpdates;` #[inline] pub unsafe fn GetCanApplyUpdates(&self, aCanApplyUpdates: *mut bool) -> nsresult { ((*self.vtable).GetCanApplyUpdates)(self, aCanApplyUpdates) } /// ```text /// /** /// * Whether or not a different instance is handling updates of this /// * installation. This currently only ever returns true on Windows /// * when 2 instances of an application are open. Only one of the instances /// * will actually handle updates for the installation. /// */ /// ``` /// /// `readonly attribute boolean isOtherInstanceHandlingUpdates;` #[inline] pub unsafe fn GetIsOtherInstanceHandlingUpdates(&self, aIsOtherInstanceHandlingUpdates: *mut bool) -> nsresult { ((*self.vtable).GetIsOtherInstanceHandlingUpdates)(self, aIsOtherInstanceHandlingUpdates) } /// ```text /// /** /// * Whether the Update Service is able to stage updates. /// */ /// ``` /// /// `readonly attribute boolean canStageUpdates;` #[inline] pub unsafe fn GetCanStageUpdates(&self, aCanStageUpdates: *mut bool) -> nsresult { ((*self.vtable).GetCanStageUpdates)(self, aCanStageUpdates) } } /// `interface nsIUpdateProcessor : nsISupports` /// /// ```text /// /** /// * An interface describing a component which handles the job of processing /// * an update after it's been downloaded. /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIUpdateProcessor { vtable: *const nsIUpdateProcessorVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIUpdateProcessor. unsafe impl XpCom for nsIUpdateProcessor { const IID: nsIID = nsID(0x74439497, 0xd796, 0x4915, [0x8c, 0xef, 0x3d, 0xfe, 0x43, 0x02, 0x7e, 0x4d]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIUpdateProcessor { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIUpdateProcessor. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIUpdateProcessorCoerce { /// Cheaply cast a value of this type from a `nsIUpdateProcessor`. fn coerce_from(v: &nsIUpdateProcessor) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIUpdateProcessorCoerce for nsIUpdateProcessor { #[inline] fn coerce_from(v: &nsIUpdateProcessor) -> &Self { v } } impl nsIUpdateProcessor { /// Cast this `nsIUpdateProcessor` to one of its base interfaces. #[inline] pub fn coerce<T: nsIUpdateProcessorCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIUpdateProcessor { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIUpdateProcessorCoerce for T { #[inline] fn coerce_from(v: &nsIUpdateProcessor) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIUpdateProcessor // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIUpdateProcessorVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void processUpdate (in nsIUpdate update); */ pub ProcessUpdate: unsafe extern "system" fn (this: *const nsIUpdateProcessor, update: *const nsIUpdate) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIUpdateProcessor { /// ```text /// /** /// * Processes the update which has been downloaded. /// * This happens without restarting the application. /// * On Windows, this can also be used for switching to an applied /// * update request. /// * @param update The update being applied, or null if this is a switch /// * to updated application request. /// */ /// ``` /// /// `void processUpdate (in nsIUpdate update);` #[inline] pub unsafe fn ProcessUpdate(&self, update: *const nsIUpdate) -> nsresult { ((*self.vtable).ProcessUpdate)(self, update) } } /// `interface nsIUpdateManager : nsISupports` /// /// ```text /// /** /// * An interface describing a global application service that maintains a list /// * of updates previously performed as well as the current active update. /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIUpdateManager { vtable: *const nsIUpdateManagerVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIUpdateManager. unsafe impl XpCom for nsIUpdateManager { const IID: nsIID = nsID(0x0f1098e9, 0xa447, 0x4af9, [0xb0, 0x30, 0x6f, 0x8f, 0x35, 0xc8, 0x5f, 0x89]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIUpdateManager { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIUpdateManager. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIUpdateManagerCoerce { /// Cheaply cast a value of this type from a `nsIUpdateManager`. fn coerce_from(v: &nsIUpdateManager) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIUpdateManagerCoerce for nsIUpdateManager { #[inline] fn coerce_from(v: &nsIUpdateManager) -> &Self { v } } impl nsIUpdateManager { /// Cast this `nsIUpdateManager` to one of its base interfaces. #[inline] pub fn coerce<T: nsIUpdateManagerCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIUpdateManager { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIUpdateManagerCoerce for T { #[inline] fn coerce_from(v: &nsIUpdateManager) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIUpdateManager // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIUpdateManagerVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* nsIUpdate getUpdateAt (in long index); */ pub GetUpdateAt: unsafe extern "system" fn (this: *const nsIUpdateManager, index: libc::int32_t, _retval: *mut *const nsIUpdate) -> nsresult, /* readonly attribute long updateCount; */ pub GetUpdateCount: unsafe extern "system" fn (this: *const nsIUpdateManager, aUpdateCount: *mut libc::int32_t) -> nsresult, /* attribute nsIUpdate activeUpdate; */ pub GetActiveUpdate: unsafe extern "system" fn (this: *const nsIUpdateManager, aActiveUpdate: *mut *const nsIUpdate) -> nsresult, /* attribute nsIUpdate activeUpdate; */ pub SetActiveUpdate: unsafe extern "system" fn (this: *const nsIUpdateManager, aActiveUpdate: *const nsIUpdate) -> nsresult, /* void saveUpdates (); */ pub SaveUpdates: unsafe extern "system" fn (this: *const nsIUpdateManager) -> nsresult, /* void refreshUpdateStatus (); */ pub RefreshUpdateStatus: unsafe extern "system" fn (this: *const nsIUpdateManager) -> nsresult, /* void elevationOptedIn (); */ pub ElevationOptedIn: unsafe extern "system" fn (this: *const nsIUpdateManager) -> nsresult, /* void cleanupActiveUpdate (); */ pub CleanupActiveUpdate: unsafe extern "system" fn (this: *const nsIUpdateManager) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIUpdateManager { /// ```text /// /** /// * Gets the update at the specified index /// * @param index /// * The index within the updates array /// * @returns The nsIUpdate object at the specified index /// */ /// ``` /// /// `nsIUpdate getUpdateAt (in long index);` #[inline] pub unsafe fn GetUpdateAt(&self, index: libc::int32_t, _retval: *mut *const nsIUpdate) -> nsresult { ((*self.vtable).GetUpdateAt)(self, index, _retval) } /// ```text /// /** /// * Gets the total number of updates in the history list. /// */ /// ``` /// /// `readonly attribute long updateCount;` #[inline] pub unsafe fn GetUpdateCount(&self, aUpdateCount: *mut libc::int32_t) -> nsresult { ((*self.vtable).GetUpdateCount)(self, aUpdateCount) } /// ```text /// /** /// * The active (current) update. The active update is not in the history list. /// */ /// ``` /// /// `attribute nsIUpdate activeUpdate;` #[inline] pub unsafe fn GetActiveUpdate(&self, aActiveUpdate: *mut *const nsIUpdate) -> nsresult { ((*self.vtable).GetActiveUpdate)(self, aActiveUpdate) } /// ```text /// /** /// * The active (current) update. The active update is not in the history list. /// */ /// ``` /// /// `attribute nsIUpdate activeUpdate;` #[inline] pub unsafe fn SetActiveUpdate(&self, aActiveUpdate: *const nsIUpdate) -> nsresult { ((*self.vtable).SetActiveUpdate)(self, aActiveUpdate) } /// ```text /// /** /// * Saves all updates to disk. /// */ /// ``` /// /// `void saveUpdates ();` #[inline] pub unsafe fn SaveUpdates(&self, ) -> nsresult { ((*self.vtable).SaveUpdates)(self, ) } /// ```text /// /** /// * Refresh the update status based on the information in update.status. /// */ /// ``` /// /// `void refreshUpdateStatus ();` #[inline] pub unsafe fn RefreshUpdateStatus(&self, ) -> nsresult { ((*self.vtable).RefreshUpdateStatus)(self, ) } /// ```text /// /** /// * The user agreed to proceed with an elevated update and we are now /// * permitted to show an elevation prompt. /// */ /// ``` /// /// `void elevationOptedIn ();` #[inline] pub unsafe fn ElevationOptedIn(&self, ) -> nsresult { ((*self.vtable).ElevationOptedIn)(self, ) } /// ```text /// /** /// * Clean up and remove the active update without applying it. /// */ /// ``` /// /// `void cleanupActiveUpdate ();` #[inline] pub unsafe fn CleanupActiveUpdate(&self, ) -> nsresult { ((*self.vtable).CleanupActiveUpdate)(self, ) } } /// `interface nsIUpdatePrompt : nsISupports` /// /// ```text /// /** /// * An interface describing an object that can show various kinds of Update /// * notification UI to the user. /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIUpdatePrompt { vtable: *const nsIUpdatePromptVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIUpdatePrompt. unsafe impl XpCom for nsIUpdatePrompt { const IID: nsIID = nsID(0xcee3bd60, 0xc564, 0x42ff, [0xa2, 0xbf, 0xd4, 0x42, 0xcb, 0x15, 0xf7, 0x5c]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIUpdatePrompt { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIUpdatePrompt. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIUpdatePromptCoerce { /// Cheaply cast a value of this type from a `nsIUpdatePrompt`. fn coerce_from(v: &nsIUpdatePrompt) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIUpdatePromptCoerce for nsIUpdatePrompt { #[inline] fn coerce_from(v: &nsIUpdatePrompt) -> &Self { v } } impl nsIUpdatePrompt { /// Cast this `nsIUpdatePrompt` to one of its base interfaces. #[inline] pub fn coerce<T: nsIUpdatePromptCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIUpdatePrompt { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIUpdatePromptCoerce for T { #[inline] fn coerce_from(v: &nsIUpdatePrompt) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIUpdatePrompt // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIUpdatePromptVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void checkForUpdates (); */ pub CheckForUpdates: unsafe extern "system" fn (this: *const nsIUpdatePrompt) -> nsresult, /* void showUpdateAvailable (in nsIUpdate update); */ pub ShowUpdateAvailable: unsafe extern "system" fn (this: *const nsIUpdatePrompt, update: *const nsIUpdate) -> nsresult, /* void showUpdateDownloaded (in nsIUpdate update, [optional] in boolean background); */ pub ShowUpdateDownloaded: unsafe extern "system" fn (this: *const nsIUpdatePrompt, update: *const nsIUpdate, background: bool) -> nsresult, /* void showUpdateError (in nsIUpdate update); */ pub ShowUpdateError: unsafe extern "system" fn (this: *const nsIUpdatePrompt, update: *const nsIUpdate) -> nsresult, /* void showUpdateHistory (in nsIDOMWindow parent); */ pub ShowUpdateHistory: unsafe extern "system" fn (this: *const nsIUpdatePrompt, parent: *const nsIDOMWindow) -> nsresult, /* void showUpdateElevationRequired (); */ pub ShowUpdateElevationRequired: unsafe extern "system" fn (this: *const nsIUpdatePrompt) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIUpdatePrompt { /// ```text /// /** /// * Shows the application update checking user interface and checks if there /// * is an update available. /// */ /// ``` /// /// `void checkForUpdates ();` #[inline] pub unsafe fn CheckForUpdates(&self, ) -> nsresult { ((*self.vtable).CheckForUpdates)(self, ) } /// ```text /// /** /// * Shows the application update available user interface advising that an /// * update is available for download and install. If the app.update.silent /// * preference is true or the user interface is already displayed the call will /// * be a no-op. /// * @param update /// * The nsIUpdate object to be downloaded and installed /// */ /// ``` /// /// `void showUpdateAvailable (in nsIUpdate update);` #[inline] pub unsafe fn ShowUpdateAvailable(&self, update: *const nsIUpdate) -> nsresult { ((*self.vtable).ShowUpdateAvailable)(self, update) } /// ```text /// /** /// * Shows the application update downloaded user interface advising that an /// * update has now been downloaded and a restart is necessary to complete the /// * update. If background is true (e.g. the download was not user initiated) /// * and the app.update.silent preference is true the call will be a no-op. /// * @param update /// * The nsIUpdate object that was downloaded /// * @param background /// * Less obtrusive UI, starting with a non-modal notification alert /// */ /// ``` /// /// `void showUpdateDownloaded (in nsIUpdate update, [optional] in boolean background);` #[inline] pub unsafe fn ShowUpdateDownloaded(&self, update: *const nsIUpdate, background: bool) -> nsresult { ((*self.vtable).ShowUpdateDownloaded)(self, update, background) } /// ```text /// /** /// * Shows the application update error user interface advising that an error /// * occurred while checking for or applying an update. If the app.update.silent /// * preference is true the call will be a no-op. /// * @param update /// * An nsIUpdate object representing the update that could not be /// * installed. The nsIUpdate object will not be the actual update when /// * the error occurred during an update check and will instead be an /// * nsIUpdate object with the error information for the update check. /// */ /// ``` /// /// `void showUpdateError (in nsIUpdate update);` #[inline] pub unsafe fn ShowUpdateError(&self, update: *const nsIUpdate) -> nsresult { ((*self.vtable).ShowUpdateError)(self, update) } /// ```text /// /** /// * Shows a list of all updates installed to date. /// * @param parent /// * An nsIDOMWindow to set as the parent for this window. Can be null. /// */ /// ``` /// /// `void showUpdateHistory (in nsIDOMWindow parent);` #[inline] pub unsafe fn ShowUpdateHistory(&self, parent: *const nsIDOMWindow) -> nsresult { ((*self.vtable).ShowUpdateHistory)(self, parent) } /// ```text /// /** /// * Shows the application update downloaded user interface advising that an /// * update, which requires elevation, has now been downloaded and a restart is /// * necessary to complete the update. /// */ /// ``` /// /// `void showUpdateElevationRequired ();` #[inline] pub unsafe fn ShowUpdateElevationRequired(&self, ) -> nsresult { ((*self.vtable).ShowUpdateElevationRequired)(self, ) } }