OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/weak_ptr.h" | 6 #include "base/memory/weak_ptr.h" |
7 #include "mojo/application/application_runner_chromium.h" | 7 #include "mojo/application/application_runner_chromium.h" |
8 #include "mojo/public/c/system/main.h" | 8 #include "mojo/public/c/system/main.h" |
9 #include "mojo/public/cpp/application/application_delegate.h" | 9 #include "mojo/public/cpp/application/application_delegate.h" |
10 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
38 } | 38 } |
39 virtual ~Prompt() { | 39 virtual ~Prompt() { |
40 } | 40 } |
41 | 41 |
42 private: | 42 private: |
43 // Overridden from mojo::ApplicationDelegate: | 43 // Overridden from mojo::ApplicationDelegate: |
44 virtual void Initialize(mojo::ApplicationImpl* app) override { | 44 virtual void Initialize(mojo::ApplicationImpl* app) override { |
45 app->ConnectToService("mojo:sky_viewer", &tracing_); | 45 app->ConnectToService("mojo:sky_viewer", &tracing_); |
46 if (app->args().size() > 1) | 46 if (app->args().size() > 1) |
47 url_ = app->args()[1]; | 47 url_ = app->args()[1]; |
48 else { | |
49 url_ = "https://raw.githubusercontent.com/domokit/mojo/master/sky/" | |
50 "examples/home.sky"; | |
51 } | |
Hixie
2014/10/23 21:55:23
why curlies?
| |
48 } | 52 } |
49 | 53 |
50 virtual bool ConfigureIncomingConnection( | 54 virtual bool ConfigureIncomingConnection( |
51 mojo::ApplicationConnection* connection) override { | 55 mojo::ApplicationConnection* connection) override { |
52 connection->ConnectToService(&debugger_); | 56 connection->ConnectToService(&debugger_); |
53 if (!url_.empty()) | 57 std::cout << "Loading " << url_ << std::endl; |
54 Reload(); | 58 Reload(); |
55 ScheduleWaitForInput(); | 59 ScheduleWaitForInput(); |
56 return true; | 60 return true; |
57 } | 61 } |
58 | 62 |
59 bool ExecuteCommand(const std::string& command) { | 63 bool ExecuteCommand(const std::string& command) { |
60 if (command == "help") { | 64 if (command == "help") { |
61 PrintHelp(); | 65 PrintHelp(); |
62 return true; | 66 return true; |
63 } | 67 } |
64 if (command == "trace") { | 68 if (command == "trace") { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 DISALLOW_COPY_AND_ASSIGN(Prompt); | 146 DISALLOW_COPY_AND_ASSIGN(Prompt); |
143 }; | 147 }; |
144 | 148 |
145 } // namespace debugger | 149 } // namespace debugger |
146 } // namespace sky | 150 } // namespace sky |
147 | 151 |
148 MojoResult MojoMain(MojoHandle shell_handle) { | 152 MojoResult MojoMain(MojoHandle shell_handle) { |
149 mojo::ApplicationRunnerChromium runner(new sky::debugger::Prompt); | 153 mojo::ApplicationRunnerChromium runner(new sky::debugger::Prompt); |
150 return runner.Run(shell_handle); | 154 return runner.Run(shell_handle); |
151 } | 155 } |
OLD | NEW |