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 25 matching lines...) Expand all Loading... | |
36 : is_tracing_(false), | 36 : is_tracing_(false), |
37 weak_ptr_factory_(this) { | 37 weak_ptr_factory_(this) { |
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 ScheduleWaitForInput(); | 46 if (!app->args().empty()) { |
47 url_ = app->args()[1]; | |
abarth-chromium
2014/10/23 20:34:41
Should we check the number of arguments?
| |
48 std::cout << url_ << std::endl; | |
49 } | |
47 } | 50 } |
48 | 51 |
49 virtual bool ConfigureIncomingConnection( | 52 virtual bool ConfigureIncomingConnection( |
50 mojo::ApplicationConnection* connection) override { | 53 mojo::ApplicationConnection* connection) override { |
51 connection->ConnectToService(&debugger_); | 54 connection->ConnectToService(&debugger_); |
55 if (!url_.empty()) { | |
56 Reload(); | |
57 } | |
58 ScheduleWaitForInput(); | |
52 return true; | 59 return true; |
53 } | 60 } |
54 | 61 |
55 bool ExecuteCommand(const std::string& command) { | 62 bool ExecuteCommand(const std::string& command) { |
56 if (command == "help") { | 63 if (command == "help") { |
57 PrintHelp(); | 64 PrintHelp(); |
58 return true; | 65 return true; |
59 } | 66 } |
60 if (command == "trace") { | 67 if (command == "trace") { |
61 ToggleTracing(); | 68 ToggleTracing(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 DISALLOW_COPY_AND_ASSIGN(Prompt); | 145 DISALLOW_COPY_AND_ASSIGN(Prompt); |
139 }; | 146 }; |
140 | 147 |
141 } // namespace debugger | 148 } // namespace debugger |
142 } // namespace sky | 149 } // namespace sky |
143 | 150 |
144 MojoResult MojoMain(MojoHandle shell_handle) { | 151 MojoResult MojoMain(MojoHandle shell_handle) { |
145 mojo::ApplicationRunnerChromium runner(new sky::debugger::Prompt); | 152 mojo::ApplicationRunnerChromium runner(new sky::debugger::Prompt); |
146 return runner.Run(shell_handle); | 153 return runner.Run(shell_handle); |
147 } | 154 } |
OLD | NEW |