Make skydb load examples/home.sky by default.

I had to also register for the text/plain mime-type
which turned out to be harder than expected.
Mostly due to my confusion with mojo_shell
using last-argument-wins argument parsing.

R=ianh@google.com

Review URL: https://codereview.chromium.org/672363002
This commit is contained in:
Eric Seidel 2014-10-23 14:56:44 -07:00
parent 3c84485f2a
commit d79cb9d734
3 changed files with 16 additions and 3 deletions

View File

@ -1,7 +1,9 @@
#!mojo mojo:sky
<sky>
<style>
h1 { font-size: 2em; margin: 1em; }
p { margin: 0.5em 1em; color: #bcd8f5; font-weight: 900; }
</style>
<h1>about:blank</h1>
<p>Welcome to Sky!</p>
</sky>

View File

@ -45,13 +45,17 @@ class Prompt : public mojo::ApplicationDelegate {
app->ConnectToService("mojo:sky_viewer", &tracing_);
if (app->args().size() > 1)
url_ = app->args()[1];
else {
url_ = "https://raw.githubusercontent.com/domokit/mojo/master/sky/"
"examples/home.sky";
}
}
virtual bool ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) override {
connection->ConnectToService(&debugger_);
if (!url_.empty())
Reload();
std::cout << "Loading " << url_ << std::endl;
Reload();
ScheduleWaitForInput();
return true;
}

View File

@ -13,11 +13,18 @@ CONFIG_DIRECTORY = 'Debug'
MOJO_SHELL_PATH = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir,
os.pardir, BUILD_DIRECTORY, CONFIG_DIRECTORY, 'mojo_shell'))
SUPPORTED_MIME_TYPES = [
'text/html',
'text/plain',
]
def main(args):
content_handlers = ['%s,%s' % (mime_type, 'mojo://sky_viewer/')
for mime_type in SUPPORTED_MIME_TYPES]
shell_command = [
MOJO_SHELL_PATH,
'--v=1',
'--content-handlers=text/html,mojo://sky_viewer/',
'--content-handlers=%s' % ','.join(content_handlers),
'--url-mappings=mojo:window_manager=mojo:sky_debugger',
'mojo:window_manager',
]