| 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().size() > 1) |
| 47 url_ = app->args()[1]; |
| 47 } | 48 } |
| 48 | 49 |
| 49 virtual bool ConfigureIncomingConnection( | 50 virtual bool ConfigureIncomingConnection( |
| 50 mojo::ApplicationConnection* connection) override { | 51 mojo::ApplicationConnection* connection) override { |
| 51 connection->ConnectToService(&debugger_); | 52 connection->ConnectToService(&debugger_); |
| 53 if (!url_.empty()) |
| 54 Reload(); |
| 55 ScheduleWaitForInput(); |
| 52 return true; | 56 return true; |
| 53 } | 57 } |
| 54 | 58 |
| 55 bool ExecuteCommand(const std::string& command) { | 59 bool ExecuteCommand(const std::string& command) { |
| 56 if (command == "help") { | 60 if (command == "help") { |
| 57 PrintHelp(); | 61 PrintHelp(); |
| 58 return true; | 62 return true; |
| 59 } | 63 } |
| 60 if (command == "trace") { | 64 if (command == "trace") { |
| 61 ToggleTracing(); | 65 ToggleTracing(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 DISALLOW_COPY_AND_ASSIGN(Prompt); | 142 DISALLOW_COPY_AND_ASSIGN(Prompt); |
| 139 }; | 143 }; |
| 140 | 144 |
| 141 } // namespace debugger | 145 } // namespace debugger |
| 142 } // namespace sky | 146 } // namespace sky |
| 143 | 147 |
| 144 MojoResult MojoMain(MojoHandle shell_handle) { | 148 MojoResult MojoMain(MojoHandle shell_handle) { |
| 145 mojo::ApplicationRunnerChromium runner(new sky::debugger::Prompt); | 149 mojo::ApplicationRunnerChromium runner(new sky::debugger::Prompt); |
| 146 return runner.Run(shell_handle); | 150 return runner.Run(shell_handle); |
| 147 } | 151 } |
| OLD | NEW |