<?xml version="1.0"?>

<!-- ***** BEGIN LICENSE BLOCK *****
   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
   -
   - The contents of this file are subject to the Mozilla Public License Version
   - 1.1 (the "License"); you may not use this file except in compliance with
   - the License. You may obtain a copy of the License at
   - http://www.mozilla.org/MPL/
   -
   - Software distributed under the License is distributed on an "AS IS" basis,
   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   - for the specific language governing rights and limitations under the
   - License.
   -
   - The Original Code is Mozilla Mobile Browser.
   -
   - The Initial Developer of the Original Code is
   - Mozilla Corporation.
   - Portions created by the Initial Developer are Copyright (C) 2008
   - the Initial Developer. All Rights Reserved.
   -
   - Contributor(s):
   -   Brad Lassey <blassey@mozilla.com>
   -   Mark Finkle <mfinkle@mozila.com>
   -
   - Alternatively, the contents of this file may be used under the terms of
   - either the GNU General Public License Version 2 or later (the "GPL"), or
   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
   - in which case the provisions of the GPL or the LGPL are applicable instead
   - of those above. If you wish to allow use of your version of this file only
   - under the terms of either the GPL or the LGPL, and not to allow others to
   - use your version of this file under the terms of the MPL, indicate your
   - decision by deleting the provisions above and replace them with the notice
   - and other provisions required by the LGPL or the GPL. If you do not delete
   - the provisions above, a recipient may use your version of this file under
   - the terms of any one of the MPL, the GPL or the LGPL.
   -
   - ***** END LICENSE BLOCK ***** -->

<?xml-stylesheet href="chrome://browser/skin/platform.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/browser.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>

<!DOCTYPE window [
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
%browserDTD;
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
%brandDTD;
<!ENTITY % prefsDTD SYSTEM "chrome://browser/locale/preferences.dtd">
%prefsDTD;
]>

<window id="main-window"
        onload="Browser.startup();"
        windowtype="navigator:browser"
        title="&brandShortName;"
        titlemodifier="&brandShortName;"
        titleseparator="&mainWindow.titleseparator;"
#ifdef WINCE
        sizemode="maximized"
#elifdef MOZ_PLATFORM_HILDON
        sizemode="maximized"
#else
        width="800"
        height="500"
#endif
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        xmlns:html="http://www.w3.org/1999/xhtml">

  <script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
  <script type="application/x-javascript" src="chrome://global/content/inlineSpellCheckUI.js"/>
  <script type="application/x-javascript" src="chrome://browser/content/commandUtil.js"/>
  <script type="application/x-javascript" src="chrome://browser/content/browser.js"/>
  <script type="application/x-javascript" src="chrome://browser/content/browser-ui.js"/>
  <script type="application/x-javascript" src="chrome://browser/content/sanitize.js"/>
  <script type="application/x-javascript" src="chrome://browser/content/WidgetStack.js"/>
  <script type="application/x-javascript" src="chrome://browser/content/CanvasBrowser.js"/>
  <script type="application/x-javascript" src="chrome://browser/content/InputHandler.js"/>

  <stringbundleset id="stringbundleset">
    <stringbundle id="bundle_browser" src="chrome://browser/locale/browser.properties"/>
    <stringbundle id="bundle_brand" src="chrome://branding/locale/brand.properties"/>
  </stringbundleset>

  <commandset id="mainCommandSet">
    <!-- basic navigation -->
    <command id="cmd_back" label="&back.label;" disabled="true" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_forward" label="&forward.label;" disabled="true" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_reload" label="&reload.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_stop" label="&stop.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_search" label="&search.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_go" label="&go.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_openLocation" label="&openLocation.label;" oncommand="CommandUpdater.doCommand(this.id);"/>

    <!-- tabs -->
    <command id="cmd_newTab" label="&newtab.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_closeTab" label="&closetab.label;" oncommand="CommandUpdater.doCommand(this.id);"/>

    <!-- bookmarking -->
    <command id="cmd_star" label="&star.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_bookmarks" label="&bookmarks.label;" oncommand="CommandUpdater.doCommand(this.id);"/>

    <!-- misc -->
    <command id="cmd_close" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_quit" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_menu" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_fullscreen" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_actions" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_panel" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_sanitize" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_zoomin" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_zoomout" oncommand="CommandUpdater.doCommand(this.id);"/>

    <!-- scrolling -->
    <command id="cmd_scrollPageUp" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_scrollPageDown" oncommand="CommandUpdater.doCommand(this.id);"/>

    <!-- editing -->
    <command id="cmd_cut" label="&cut.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_copy" label="&copy.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_copylink" label="&copylink.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_paste" label="&paste.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_delete" label="&delete.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
    <command id="cmd_selectAll" label="&selectAll.label;" oncommand="CommandUpdater.doCommand(this.id);"/>

    <!-- find -->
    <command id="cmd_find" oncommand="Browser.openFind(FINDSTATE_FIND);"/>
    <command id="cmd_findAgain" oncommand="Browser.openFind(FINDSTATE_FIND_AGAIN);"/>
    <command id="cmd_findPrevious" oncommand="Browser.openFind(FINDSTATE_FIND_PREVIOUS);"/>
  </commandset>

  <keyset id="mainKeyset">
    <!-- basic navigation -->
    <key id="key_back" keycode="VK_LEFT" command="cmd_back" modifiers="control"/>
    <key id="key_forward" keycode="VK_RIGHT" command="cmd_forward" modifiers="control"/>
    <key id="key_back2" keycode="VK_BACK" command="cmd_back"/>
    <key id="key_forward2" keycode="VK_BACK" command="cmd_forward" modifiers="shift"/>
    <key id="key_reload" keycode="VK_F5" command="cmd_reload"/>
    <key id="key_focusURL" key="l" modifiers="accel" command="cmd_openLocation"/>

    <!-- scrolling -->
    <key id="key_pageUp" keycode="VK_UP" command="cmd_scrollPageUp" modifiers="shift"/>
    <key id="key_pageDown" keycode="VK_DOWN" command="cmd_scrollPageDown" modifiers="shift"/>

    <!-- misc -->
    <key id="key_close" key="w" modifiers="accel" command="cmd_close"/>
    <key id="key_quit" key="q" modifiers="accel" command="cmd_quit"/>
    <key id="key_menu" keycode="VK_F4" command="cmd_menu"/>
    <key id="key_fullscreen" keycode="VK_F6" command="cmd_fullscreen"/>
    <key id="key_zoomin" keycode="VK_F7" command="cmd_zoomin"/>
    <key id="key_zoomout" keycode="VK_F8" command="cmd_zoomout"/>

    <!-- tabs -->
    <key id="key_newTab" key="T" modifiers="accel" command="cmd_newTab"/>
    <key id="key_closeTab" key="W" modifiers="accel" command="cmd_closeTab"/>

    <!-- find -->
    <key id="key_find" key="&findOnCmd.commandkey;" command="cmd_find" modifiers="accel"/>
    <key id="key_findAgain" key="&findAgainCmd.commandkey;" command="cmd_findAgain" modifiers="accel"/>
    <key id="key_findPrevious" key="&findAgainCmd.commandkey;" command="cmd_findPrevious" modifiers="accel shift"/>
    <key keycode="&findAgainCmd.commandkey2;" command="cmd_findAgain"/>
    <key keycode="&findAgainCmd.commandkey2;"  command="cmd_findPrevious" modifiers="shift"/>
  </keyset>

  <popupset id="mainPopupSet">
    <!-- popup for site identity information -->
    <panel id="identity-popup" position="after_start" hidden="true" noautofocus="true"
           norestorefocus="true">
      <hbox id="identity-popup-container" align="top">
        <image id="identity-popup-icon"/>
        <vbox id="identity-popup-content-box">
          <label id="identity-popup-connectedToLabel" value="&identity.connectedTo;"/>
          <label id="identity-popup-connectedToLabel2" value="&identity.unverifiedsite2;"/>
          <description id="identity-popup-content-host"/>
          <label id="identity-popup-runByLabel" value="&identity.runBy;"/>
          <description id="identity-popup-content-owner"/>
          <description id="identity-popup-content-supplemental"/>
          <description id="identity-popup-content-verifier"/>
          <hbox id="identity-popup-encryption" flex="1">
            <vbox>
              <image id="identity-popup-encryption-icon"/>
              <spacer flex="1"/>
            </vbox>
            <description id="identity-popup-encryption-label" flex="1"/>
          </hbox>
        </vbox>
      </hbox>
    </panel>
  </popupset>

  <!-- stupid stack needs to be in a box. not sure why -->
  <box>
  <stack id="browser-container" flex="1">

    <!-- begin: Browser View -->
    <hbox id="canvasbox"
          style="-moz-stack-sizing: ignore;"
          left="0" top="-480"
          vptargetx="0"
          vptargety="0"
          vptargetw="800"
          vptargeth="480"
          viewport="true">

      <html:canvas id="browser-canvas"
                   moz-opaque="true"
                   height="1440" width="800"
                   onnewtab="CommandUpdater.doCommand('cmd_newTab');"/>

    </hbox>

    <!-- end: Browser View -->

    <!-- begin: left bar -->
    <vbox id="tabs-container" style="-moz-stack-sizing: ignore; width: 132px; height: 420px;"
          left="-132" top="60"
          constraint="ignore-y,vp-relative">
      <richlistbox id="tabs" onselect="BrowserUI.selectTab(this.selectedItem);" onmouseup="BrowserUI.hideTabs();" onclosetab="BrowserUI.closeTab(this);"/>
      <hbox id="tabs-controls">
        <toolbarbutton id="newtab-button" command="cmd_newTab"/>
      </hbox>
    </vbox>
    <!-- barrier to the right of the left sidebar -->
    <spacer style="-moz-stack-sizing: ignore; width: 1px; height: 1px;" barriertype="vertical" size="30" left="0" constraint="vp-relative"/>
    <!-- end: left bar -->


    <!-- begin: right bar -->
    <!-- barrier to the left of the right bar -->
    <spacer style="-moz-stack-sizing: ignore; width: 1px; height: 1px;" barriertype="vertical" size="30" left="800" constraint="vp-relative"/>
    <vbox id="browser-controls" style="-moz-stack-sizing: ignore;"
          left="800" top="60"
          width="80" height="420"
          constraint="ignore-y,vp-relative">
      <toolbarbutton id="tool-star" class="browser-control-button" command="cmd_star"/>
      <toolbarbutton id="tool-back" class="browser-control-button" command="cmd_back"/>
      <toolbarbutton id="tool-forward" class="browser-control-button" command="cmd_forward"/>
      <toolbarspring/>
      <toolbarbutton id="tool-actions" class="browser-control-button" command="cmd_actions" hidden="true"/>
      <toolbarbutton id="tool-panel-open" class="page-button" command="cmd_panel"/>
    </vbox>
    <!-- end: right bar -->

    <!-- begin: Main Toolbar -->
    <toolbar id="toolbar-main" style="-moz-stack-sizing: ignore; width: 800px; height: 60px" top="-60" left="0" constraint="ignore-x,vp-relative">
      <hbox id="urlbar-container" flex="1">
        <box id="identity-box"
             onclick="getIdentityHandler().handleIdentityButtonEvent(event);"
             onkeypress="getIdentityHandler().handleIdentityButtonEvent(event);">
          <box id="urlbar-image-box">
            <image id="urlbar-throbber"/>
            <image id="urlbar-favicon" hidden="true"/>
          </box>
        </box>
        <hbox id="urlbar-editarea" flex="1">
          <textbox id="urlbar-edit"
                   type="autocomplete"
                   autocompletesearch="history"
                   autocompletepopup="popup_autocomplete"
                   enablehistory="false"
                   maxrows="6"
                   readonly="true"
                   completeselectedindex="true"
                   flex="1"
                   ontextentered="BrowserUI.goToURI();"
                   clickSelectsAll="true"/>
        </hbox>
        <hbox id="urlbar-icons">
          <toolbarbutton id="tool-reload" class="urlbar-cap-button" command="cmd_reload"/>
          <toolbarbutton id="tool-stop" class="urlbar-cap-button" command="cmd_stop"/>
          <toolbarbutton id="tool-go" class="urlbar-cap-button" command="cmd_go"/>
        </hbox>
      </hbox>
      <toolbarbutton id="tool-bookmarks" class="urlbar-button" command="cmd_bookmarks"/>
    </toolbar>
    <!-- end: Main Toolbar -->

    <notificationbox id="notifications" style="-moz-stack-sizing: ignore;" top="0" left="0"/>

    <!-- barrier to the left of the right bar -->
    <hbox id="panel-container" hidden="true" style="-moz-stack-sizing: ignore;" top="0" left="0">
      <vbox id="panel-controls" oncommand="BrowserUI.switchPane(event.target.getAttribute('linkedpanel'));">
        <toolbarspring/>
        <toolbarbutton id="tool-addons" type="radio" group="1" class="panel-button" linkedpanel="addons-container"/>
        <toolbarbutton id="tool-downloads" type="radio" group="1" class="panel-button" linkedpanel="downloads-container"/>
        <toolbarbutton id="tool-preferences" type="radio" group="1" class="panel-button" linkedpanel="prefs-container"/>
        <toolbarbutton id="tool-panel-close" class="page-button" command="cmd_panel"/>
      </vbox>
      <deck id="panel-items" flex="1">
        <iframe id="addons-container" flex="1"/>
        <iframe id="downloads-container" flex="1"/>

        <vbox id="prefs-container" flex="1">
          <hbox pack="center" id="buttons"/>
          <scrollbox orient="vertical" id="pref-list" seltype="single" flex="1">
            <vbox class="prefsection">
              <label value="&content.title;" crop="end" flex="1"/>
            </vbox>
            <richpref pref="permissions.default.image" title="&permissions.default.image.title;" type="boolint" on="1" off="2">
              &permissions.default.image.description;
            </richpref>
            <richpref pref="javascript.enabled" type="bool" title="&javascript.enabled.title;">
              &javascript.enabled.description;
            </richpref>
            <richpref pref="javascript.options.jit.content" type="bool" title="&javascript.options.jit.content.title;">
              &javascript.options.jit.content.description;
            </richpref>
            <richpref pref="plugins.enabled" type="bool" title="&plugins.enabled.title;" onsyncfrompreference="Browser.setPluginState(this.value);">
              &plugins.enabled.description;
            </richpref>

            <vbox class="prefsection">
              <label value="&privacy.title;" crop="end" flex="1"/>
            </vbox>
            <richpref pref="network.cookie.cookieBehavior" title="&network.cookie.cookieBehavior.title;" type="boolint" on="0" off="2">
              &network.cookie.cookieBehavior.description;
            </richpref>
            <richpref pref="signon.rememberSignons" title="&signon.rememberSignons.title;" type="bool">
              &signon.rememberSignons.description;
            </richpref>
            <richpref title="&clear.private.data.title;" type="button">
              &clear.private.data.description;
              <button label="&clear.private.data.button;" command="cmd_sanitize"/>
            </richpref>
          </scrollbox>
        </vbox>
      </deck>
    </hbox>

    <vbox id="popup_autocomplete" style="-moz-stack-sizing: ignore;" top="60" left="0" constraint="ignore-x,vp-relative">
      <hbox id="autocomplete_navbuttons" align="center" flex="1"
            oncommand="BrowserUI.doButtonSearch(event.target);">
        <image class="tool-search"/>
      </hbox>
    </vbox>

    <vbox id="bookmark-container" hidden="true" style="-moz-stack-sizing: ignore;" top="60" left="0">
      <hbox id="bookmark-form" align="start">
        <image id="bookmark-image" src="chrome://browser/skin/images/starred48.png"/>
        <placeitem id="bookmark-edit" type="bookmark" flex="1" ui="manage"
                   onmove="FolderPicker.show(this);"
                   onclose="BookmarkHelper.close()"
                   onchange="this.save()"/>
      </hbox>
    </vbox>

    <vbox id="bookmarklist-container" hidden="true" style="-moz-stack-sizing: ignore;" top="0" left="0">
      <hbox id="bookmarklist-header" style="height: 60px">
        <description flex="1">&bookmarksHeader.label;</description>
        <toolbarbutton id="tool-bookmarks-manage" class="text-button" label="&bookmarksManage.label;"
                       oncommand="BookmarkList.toggleManage();"/>
        <toolbarbutton id="tool-bookmarks-close" class="urlbar-button"
                       oncommand="BookmarkList.close();"/>
      </hbox>
      <placelist id="bookmark-items" type="bookmarks" flex="1"
                 onmove="FolderPicker.show(this);"
                 onopen="BookmarkList.openBookmark();"/>
    </vbox>

    <vbox id="folder-container" hidden="true" style="-moz-stack-sizing: ignore;" top="0" left="0">
      <hbox id="folder-header" style="height: 60px">
        <description flex="1">&foldersHeader.label;</description>
        <toolbarbutton id="tool-folders-close" class="urlbar-button"
                       oncommand="FolderPicker.close()"/>
      </hbox>
      <placetree id="folder-items" type="bookmarks" mode="folders" flex="1" onselect="FolderPicker.moveItem();"/>
    </vbox>

  </stack>

  </box>

  <vbox id="findpanel-placeholder" sizetopopup="always">
    <panel id="findpanel" onpopupshown="Browser.doFind()">
      <findbar id="findbar"/>
   </panel>
  </vbox>

  <!-- where all the (hidden) <browser> elements go; I wish this could be display: none -->
  <box id="browsers"/>
</window>
