<!DOCTYPE HTML>
<html>
<!--
Copyright (c) 2010 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<head i18n-values="dir:textdirection;">
<link rel="stylesheet" href="webui.css">
<style>
* {
  box-sizing: border-box;
}

html, body, #main-tabs {
  height: 100%;
}

body {
  cursor: default;
  font-family: sans-serif;
  padding: 0;
  margin: 0;
}

#debug-div {
  display: -webkit-box;
  position: fixed;
  top: 0px;
  left: 50%;
  border: 1px solid red;
}

</style>
<link rel="stylesheet" href="gpu_internals/info_view.css">
<link rel="stylesheet" href="gpu_internals/overlay.css">
<link rel="stylesheet" href="gpu_internals/profiling_view.css">
<link rel="stylesheet" href="gpu_internals/tab_control.css">
<link rel="stylesheet" href="gpu_internals/timeline_view.css">
<link rel="stylesheet" href="gpu_internals/timeline.css">
<link rel="stylesheet" href="gpu_internals/tracing_controller.css">
<script src="chrome://resources/js/cr.js"></script>
<script src="chrome://resources/js/cr/event_target.js"></script>
<script src="chrome://resources/js/cr/ui.js"></script>
<script src="chrome://resources/js/util.js"></script>
<script src="gpu_internals/tab_control.js"></script>
<script src="gpu_internals/overlay.js"></script>
<script src="gpu_internals/browser_bridge.js"></script>
<script src="gpu_internals/tracing_controller.js"></script>
<script src="gpu_internals/info_view.js"></script>
<script src="gpu_internals/timeline_model.js"></script>
<script src="gpu_internals/sorted_array_utils.js"></script>
<script src="gpu_internals/timeline.js"></script>
<script src="gpu_internals/timeline_track.js"></script>
<script src="gpu_internals/fast_rect_renderer.js"></script>
<script src="gpu_internals/profiling_view.js"></script>
<script src="gpu_internals/timeline_view.js"></script>

<script>
var browserBridge;
var tracingController;
var timelineView; // made global for debugging purposes only
var profilingView; // made global for debugging purposes only

/**
 * Main entry point. called once the page has loaded.
 */
function onLoad() {
  browserBridge = new gpu.BrowserBridge();
  tracingController = new gpu.TracingController();

  // Create the views.
  cr.ui.decorate('#info-view', gpu.InfoView);

  profilingView = $('profiling-view');
  cr.ui.decorate(profilingView, gpu.ProfilingView);

  // Create the main tab control
  var tabs = $('main-tabs');
  cr.ui.decorate(tabs, gpu.TabControl);

  // Sync the main-tabs selectedTabs in-sync with the location.
  tabs.addEventListener('selectedTabChange', function() {
    if (tabs.selectedTab.id) {
      history.pushState('', '', '#' + tabs.selectedTab.id);
    }
  });
  window.onhashchange = function() {
    var cur = window.location.hash;
    if (cur == '#' || cur == '') {
      if (tabs.tabs.length)
        tabs.selectedTab = tabs.tabs[0];
    } else {
      var tab = $(window.location.hash.substr(1));
      if (tab)
        tabs.selectedTab = tab;
    }
  };
  window.onhashchange();
}

document.addEventListener('DOMContentLoaded', onLoad);

</script>
</head>
<body>
  <div id="debug-div">
  </div>
  <!-- Tabs -->
  <div id="main-tabs">
    <include src="gpu_internals/info_view.html">
    <div id="profiling-view" label="Profiling"></div>
  </div>
</body>
</html>