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:
parent
3c84485f2a
commit
d79cb9d734
@ -1,7 +1,9 @@
|
|||||||
#!mojo mojo:sky
|
#!mojo mojo:sky
|
||||||
|
<sky>
|
||||||
<style>
|
<style>
|
||||||
h1 { font-size: 2em; margin: 1em; }
|
h1 { font-size: 2em; margin: 1em; }
|
||||||
p { margin: 0.5em 1em; color: #bcd8f5; font-weight: 900; }
|
p { margin: 0.5em 1em; color: #bcd8f5; font-weight: 900; }
|
||||||
</style>
|
</style>
|
||||||
<h1>about:blank</h1>
|
<h1>about:blank</h1>
|
||||||
<p>Welcome to Sky!</p>
|
<p>Welcome to Sky!</p>
|
||||||
|
</sky>
|
||||||
|
@ -45,13 +45,17 @@ class Prompt : public mojo::ApplicationDelegate {
|
|||||||
app->ConnectToService("mojo:sky_viewer", &tracing_);
|
app->ConnectToService("mojo:sky_viewer", &tracing_);
|
||||||
if (app->args().size() > 1)
|
if (app->args().size() > 1)
|
||||||
url_ = app->args()[1];
|
url_ = app->args()[1];
|
||||||
|
else {
|
||||||
|
url_ = "https://raw.githubusercontent.com/domokit/mojo/master/sky/"
|
||||||
|
"examples/home.sky";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool ConfigureIncomingConnection(
|
virtual bool ConfigureIncomingConnection(
|
||||||
mojo::ApplicationConnection* connection) override {
|
mojo::ApplicationConnection* connection) override {
|
||||||
connection->ConnectToService(&debugger_);
|
connection->ConnectToService(&debugger_);
|
||||||
if (!url_.empty())
|
std::cout << "Loading " << url_ << std::endl;
|
||||||
Reload();
|
Reload();
|
||||||
ScheduleWaitForInput();
|
ScheduleWaitForInput();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,18 @@ CONFIG_DIRECTORY = 'Debug'
|
|||||||
MOJO_SHELL_PATH = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir,
|
MOJO_SHELL_PATH = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir,
|
||||||
os.pardir, BUILD_DIRECTORY, CONFIG_DIRECTORY, 'mojo_shell'))
|
os.pardir, BUILD_DIRECTORY, CONFIG_DIRECTORY, 'mojo_shell'))
|
||||||
|
|
||||||
|
SUPPORTED_MIME_TYPES = [
|
||||||
|
'text/html',
|
||||||
|
'text/plain',
|
||||||
|
]
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
|
content_handlers = ['%s,%s' % (mime_type, 'mojo://sky_viewer/')
|
||||||
|
for mime_type in SUPPORTED_MIME_TYPES]
|
||||||
shell_command = [
|
shell_command = [
|
||||||
MOJO_SHELL_PATH,
|
MOJO_SHELL_PATH,
|
||||||
'--v=1',
|
'--v=1',
|
||||||
'--content-handlers=text/html,mojo://sky_viewer/',
|
'--content-handlers=%s' % ','.join(content_handlers),
|
||||||
'--url-mappings=mojo:window_manager=mojo:sky_debugger',
|
'--url-mappings=mojo:window_manager=mojo:sky_debugger',
|
||||||
'mojo:window_manager',
|
'mojo:window_manager',
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user