diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-21 22:43:37 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-21 22:43:37 +0000 |
commit | 698601ed9a0a452c6cc7761d74c06afb1226ac86 (patch) | |
tree | 63c775989d9f53ff3af937bbba7819feba8827b2 /chrome/browser/resources | |
parent | 1054e85a824e6b951a391c23a6d88b337b7e798c (diff) | |
download | chromium_src-698601ed9a0a452c6cc7761d74c06afb1226ac86.zip chromium_src-698601ed9a0a452c6cc7761d74c06afb1226ac86.tar.gz chromium_src-698601ed9a0a452c6cc7761d74c06afb1226ac86.tar.bz2 |
Create an initial Chrome page for file browsing. This just implements the
ability to list files and display them in JS via DOMUI.
BUG=none
TEST=none
Original review: http://codereview.chromium.org/255090
Patch by David Garcia.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29723 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r-- | chrome/browser/resources/filebrowse.html | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/chrome/browser/resources/filebrowse.html b/chrome/browser/resources/filebrowse.html new file mode 100644 index 0000000..3c85726 --- /dev/null +++ b/chrome/browser/resources/filebrowse.html @@ -0,0 +1,99 @@ +<!DOCTYPE HTML> +<html i18n-values="dir:textdirection;"> +<head> +<meta charset="utf-8"> +<title i18n-content="title"></title> +<style type="text/css"> +</style> +<link rel="icon" href="../../app/theme/history_favicon.png"> +<script src="local_strings.js"></script> +<script> +/////////////////////////////////////////////////////////////////////////////// +// Globals: +var RESULTS_PER_PAGE = 150; +var MAX_SEARCH_DEPTH_MONTHS = 18; + +// Amount of time between pageviews that we consider a 'break' in browsing, +// measured in milliseconds. +var BROWSING_GAP_TIME = 15 * 60 * 1000; + +function $(o) {return document.getElementById(o);} + +function encodeURIForCSS(uri) { + // CSS uris need to have '(' and ')' escaped. + return uri.replace(/\(/g, "\\(").replace(/\)/g, "\\)"); +} + +var localStrings; +var pageState; +var results_; + + +/////////////////////////////////////////////////////////////////////////////// +// Document Functions: +/** + * Window onload handler, sets up the page. + */ +function load() { + + localStrings = new LocalStrings(); + try { + chrome.send('getRoots', []); + } catch (e) { + //TODO: Do something smart here. + } +} + +////////////////////////////////////////////////////////////////////////////// +// Helper functions + +var browseFile = function(path) { + + try { + chrome.send('getChildren', [path]); + } catch (e) { + //TODO: Do something smart. + alert('uh-oh'); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// Chrome callbacks: +/** + * Our callback for when a system is completed. + */ +function fileBrowseResult(info, results) { + try { + var output = ""; + if (info.call == "getRoots" || info.call == "getChildren") { + for (var x=0; x < results.length; x++) { + if (results[x].isDirectory) { + output += "<a href='javascript:browseFile(\""+results[x].path+"\");'>"; + output += results[x].title; + output += "</a><br/>"; + } else { + output += results[x].title; + output += "<br/>"; + } + } + } + results_ = results; + var main = $('main'); + main.innerHTML = output; + } catch (e) { + alert(e); + } +} +</script> +<link rel="stylesheet" href="dom_ui.css"> +<style> + +</style> +</head> +<body onload="load();" i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> +<div class="header"></div> +<div class="main" id="main"></div> +<div class="footer"> +</div> +</body> +</html> |