提交 b672f6bc 编写于 作者: E Eric Seidel

Make it possible to pass a URL via command line to Mac SkyShell.app

@chinmaygarde
上级 0f5799c6
......@@ -43,6 +43,8 @@
_response.reset();
}
uint32_t length = data.length;
// TODO(eseidel): This can't work. The data pipe could be full, we need to
// write an async writter for filling the pipe and use it here.
MojoResult result = WriteDataRaw(_producer.get(), data.bytes, &length,
MOJO_WRITE_DATA_FLAG_ALL_OR_NONE);
// FIXME(csg): Handle buffers in case of failures
......
......@@ -3,14 +3,16 @@
// found in the LICENSE file.
#import "sky_window.h"
#include "base/command_line.h"
#include "base/time/time.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "sky/services/engine/input_event.mojom.h"
#include "sky/shell/mac/platform_view_mac.h"
#include "sky/shell/shell_view.h"
#include "sky/shell/shell.h"
#include "sky/shell/shell_view.h"
#include "sky/shell/ui_delegate.h"
@interface SkyWindow ()<NSWindowDelegate>
@property(assign) IBOutlet NSOpenGLView* renderSurface;
......@@ -74,10 +76,23 @@ static inline sky::EventType EventTypeFromNSEventPhase(NSEventPhase phase) {
return [[NSBundle mainBundle] pathForResource:@"app" ofType:@"skyx"];
}
// TODO(eseidel): This does not belong in sky_window!
// Probably belongs in NSApplicationDelegate didFinishLaunching.
// We also want a separate setup for normal apps vs SkyShell
// normal apps only use a skyx vs. SkyShell which always pulls from network.
- (void)setupAndLoadDart {
auto interface_request = mojo::GetProxy(&_sky_engine);
self.platformView->ConnectToEngine(interface_request.Pass());
base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
base::CommandLine::StringVector args = command_line.GetArgs();
if (args.size() > 0) {
LOG(INFO) << "Loading " << args[0];
mojo::String string(args[0]);
_sky_engine->RunFromNetwork(string);
return;
}
NSString *endpoint = self.skyInitialBundleURL;
if (endpoint.length > 0) {
// Load from bundle
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册