home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 January / 01_02.iso / software / netscape62win / browser.xpi / bin / chrome / toolkit.jar / content / global / bindings / browser.xml next >
Encoding:
Extensible Markup Language  |  2001-08-14  |  7.0 KB  |  218 lines

  1. <?xml version="1.0"?>
  2.  
  3. <!--
  4.    - The contents of this file are subject to the Mozilla Public
  5.    - License Version 1.1 (the "License"); you may not use this file
  6.    - except in compliance with the License. You may obtain a copy of
  7.    - the License at http://www.mozilla.org/MPL/
  8.    -
  9.    - Software distributed under the License is distributed on an "AS
  10.    - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  11.    - implied. See the License for the specific language governing
  12.    - rights and limitations under the License.
  13.    -
  14.    - The Original Code is this file as it was released on
  15.    - March 28, 2001.
  16.    -
  17.    - The Initial Developer of the Original Code is Peter Annema.
  18.    - Portions created by Peter Annema are Copyright (C) 2001
  19.    - Peter Annema.  All Rights Reserved.
  20.    -
  21.    - Contributor(s):
  22.    -   Peter Annema <disttsc@bart.nl> (Original Author)
  23.    -
  24.    - Alternatively, the contents of this file may be used under the
  25.    - terms of the GNU General Public License Version 2 or later (the
  26.    - "GPL"), in which case the provisions of the GPL are applicable
  27.    - instead of those above.  If you wish to allow use of your
  28.    - version of this file only under the terms of the GPL and not to
  29.    - allow others to use your version of this file under the MPL,
  30.    - indicate your decision by deleting the provisions above and
  31.    - replace them with the notice and other provisions required by
  32.    - the GPL.  If you do not delete the provisions above, a recipient
  33.    - may use your version of this file under either the MPL or the
  34.    - GPL.
  35.   -->
  36.  
  37. <bindings id="browserBindings"
  38.           xmlns="http://www.mozilla.org/xbl"
  39.           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  40.  
  41.   <binding id="browser" extends="xul:browser">
  42.  
  43.     <implementation type="application/x-javascript">
  44.  
  45.       <property name="canGoBack"
  46.                 onget="return this.webNavigation.canGoBack;"
  47.                 readonly="true"/>
  48.  
  49.       <property name="canGoForward"
  50.                 onget="return this.webNavigation.canGoForward;"
  51.                 readonly="true"/>
  52.  
  53.       <method name="goBack">
  54.         <body>
  55.           <![CDATA[
  56.             var webNavigation = this.webNavigation;
  57.             if (webNavigation.canGoBack)
  58.               webNavigation.goBack();
  59.           ]]>
  60.         </body>
  61.       </method>
  62.  
  63.       <method name="goForward">
  64.         <body>
  65.           <![CDATA[
  66.             var webNavigation = this.webNavigation;
  67.             if (webNavigation.canGoForward)
  68.               webNavigation.goForward();
  69.           ]]>
  70.         </body>
  71.       </method>
  72.  
  73.       <method name="reload">
  74.         <body>
  75.           <![CDATA[
  76.             const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
  77.             const flags = nsIWebNavigation.LOAD_FLAGS_BYPASS_NONE;
  78.             this.reloadWithFlags(flags);
  79.           ]]>
  80.         </body>
  81.       </method>
  82.  
  83.       <method name="reloadWithFlags">
  84.         <parameter name="aFlags"/>
  85.         <body>
  86.           <![CDATA[
  87.             this.webNavigation.reload(aFlags);
  88.           ]]>
  89.         </body>
  90.       </method>
  91.  
  92.       <method name="stop">
  93.         <body>
  94.           <![CDATA[
  95.             const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
  96.             const flags = nsIWebNavigation.STOP_ALL;
  97.             this.webNavigation.stop(flags);
  98.           ]]>
  99.         </body>
  100.       </method>
  101.  
  102.       <!-- throws exception for unknown schemes -->
  103.       <method name="loadURI">
  104.         <parameter name="aURI"/>
  105.         <body>
  106.           <![CDATA[
  107.             const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
  108.             const flags = nsIWebNavigation.LOAD_FLAGS_BYPASS_NONE;
  109.             this.loadURIWithFlags(aURI, flags);
  110.           ]]>
  111.         </body>
  112.       </method>
  113.  
  114.       <!-- throws exception for unknown schemes -->
  115.       <method name="loadURIWithFlags">
  116.         <parameter name="aURI"/>
  117.         <parameter name="aFlags"/>
  118.         <body>
  119.           <![CDATA[
  120.             if (!aURI)
  121.               aURI = "about:blank";
  122.  
  123.             this.webNavigation.loadURI(aURI, aFlags);
  124.           ]]>
  125.         </body>
  126.       </method>
  127.  
  128.       <method name="goHome">
  129.         <body>
  130.           <![CDATA[
  131.             try {
  132.               this.loadURI(this.homePage);
  133.             }
  134.             catch (e) {
  135.             }
  136.           ]]>
  137.         </body>
  138.       </method>
  139.  
  140.       <property name="homePage">
  141.         <getter>
  142.           <![CDATA[
  143.             var uri;
  144.  
  145.             if (this.hasAttribute("homepage"))
  146.               uri = this.getAttribute("homepage");
  147.             else
  148.               uri = "http://www.mozilla.org/"; // widget pride
  149.  
  150.             return uri;
  151.           ]]>
  152.         </getter>
  153.         <setter>
  154.           <![CDATA[
  155.             this.setAttribute("homepage", val);
  156.             return val;
  157.           ]]>
  158.         </setter>
  159.       </property>
  160.  
  161.       <method name="gotoIndex">
  162.         <parameter name="aIndex"/>
  163.         <body>
  164.           <![CDATA[
  165.             this.webNavigation.gotoIndex(aIndex);
  166.           ]]>
  167.         </body>
  168.       </method>
  169.  
  170.       <property name="currentURI"
  171.                 onget="return this.webNavigation.currentURI;"
  172.                 readonly="true"/>
  173.  
  174.       <property name="preferences"
  175.                 onget="return Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPref);"
  176.                 readonly="true"/>
  177.  
  178.       <property name="docShell"
  179.                 onget="return this.boxObject.QueryInterface(Components.interfaces.nsIBrowserBoxObject).docShell;"
  180.                 readonly="true"/>
  181.  
  182.       <property name="webNavigation"
  183.                 onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
  184.                 readonly="true"/>
  185.  
  186.       <property name="webBrowserFind"
  187.                 readonly="true"
  188.                 onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebBrowserFind);"/>
  189.  
  190.       <property name="sessionHistory"
  191.                 onget="return this.webNavigation.sessionHistory;"
  192.                 readonly="true"/>
  193.  
  194.       <property name="markupDocumentViewer"
  195.                 onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);"
  196.                 readonly="true"/>
  197.  
  198.       <property name="contentViewerEdit"
  199.                 onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIContentViewerEdit);"
  200.                 readonly="true"/>
  201.  
  202.       <property name="contentViewerFile"
  203.                 onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIContentViewerFile);"
  204.                 readonly="true"/>
  205.  
  206.       <property name="documentCharsetInfo"
  207.                 onget="return this.docShell.documentCharsetInfo;"
  208.                 readonly="true"/>
  209.  
  210.       <property name="contentDocument"
  211.                 onget="return this.webNavigation.document;"
  212.                 readonly="true"/>
  213.     </implementation>
  214.  
  215.   </binding>
  216.  
  217. </bindings>
  218.