| Index: services/js/js_app.h
|
| diff --git a/services/js/js_app.h b/services/js/js_app.h
|
| index 22c10d0d9c096a1032abbb1ceae4280212034419..4a09f476913e71cd1a496fffe25f539af8adc44e 100644
|
| --- a/services/js/js_app.h
|
| +++ b/services/js/js_app.h
|
| @@ -2,19 +2,17 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef MOJO_SERVICES_JS_JS_APP_H_
|
| -#define MOJO_SERVICES_JS_JS_APP_H_
|
| +#ifndef SERVICES_JS_JS_APP_H_
|
| +#define SERVICES_JS_JS_APP_H_
|
|
|
| -#include "base/memory/ref_counted.h"
|
| -#include "base/threading/thread.h"
|
| #include "gin/public/isolate_holder.h"
|
| #include "gin/shell_runner.h"
|
| #include "mojo/application/content_handler_factory.h"
|
| -#include "mojo/edk/js/mojo_runner_delegate.h"
|
| -#include "mojo/public/cpp/application/application_delegate.h"
|
| +#include "mojo/public/cpp/system/message_pipe.h"
|
| #include "mojo/public/interfaces/application/application.mojom.h"
|
| #include "mojo/public/interfaces/application/shell.mojom.h"
|
| -#include "mojo/services/public/interfaces/network/url_loader.mojom.h"
|
| +#include "services/js/js_app_runner_delegate.h"
|
| +#include "v8/include/v8.h"
|
|
|
| namespace mojo {
|
| namespace js {
|
| @@ -22,8 +20,8 @@ namespace js {
|
| class JSApp;
|
| class ApplicationDelegateImpl;
|
|
|
| -// Each JavaScript app started by content handler runs on its own thread and
|
| -// in its own V8 isolate. This class represents one running JS app.
|
| +// Each JavaScript app started by the content handler runs on its own thread
|
| +// and in its own V8 isolate. This class represents one running JS app.
|
|
|
| class JSApp : public InterfaceImpl<Application>,
|
| public ContentHandlerFactory::HandledApplicationHolder {
|
| @@ -31,31 +29,32 @@ class JSApp : public InterfaceImpl<Application>,
|
| JSApp(ShellPtr shell, URLResponsePtr response);
|
| virtual ~JSApp();
|
|
|
| - // Called by the JS mojo module to quit this JS app. See mojo.js.
|
| + // This method just delegates to shell_->ConnectToApplication().
|
| + void ConnectToApplication(const std::string& application_url,
|
| + ScopedMessagePipeHandle service_provider);
|
| +
|
| void Quit();
|
|
|
| - // Called by the JS mojo module to connect to a Mojo application.
|
| - MessagePipeHandle ConnectToApplication(const std::string& application_url);
|
| + private:
|
| + static const char kMainModuleName[];
|
|
|
| - // Called by the JS mojo module to retrieve the ServiceProvider message
|
| - // pipe handle passed to the JS application's AcceptConnection() method.
|
| - MessagePipeHandle RequestorMessagePipeHandle();
|
| + void OnAppLoaded(std::string url, v8::Handle<v8::Value> module);
|
|
|
| - private:
|
| // Application methods:
|
| void AcceptConnection(const String& requestor_url,
|
| ServiceProviderPtr provider) override;
|
| void Initialize(Array<String> args) override;
|
|
|
| + void CallAppInstanceMethod(
|
| + const std::string& name, int argc, v8::Handle<v8::Value> argv[]);
|
| +
|
| void QuitInternal();
|
|
|
| ShellPtr shell_;
|
| - js::MojoRunnerDelegate runner_delegate;
|
| + JSAppRunnerDelegate runner_delegate_;
|
| gin::IsolateHolder isolate_holder_;
|
| scoped_ptr<gin::ShellRunner> shell_runner_;
|
| - std::string source_;
|
| - std::string file_name_;
|
| - ScopedMessagePipeHandle requestor_handle_;
|
| + v8::Persistent<v8::Object> app_instance_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(JSApp);
|
| };
|
| @@ -63,4 +62,4 @@ class JSApp : public InterfaceImpl<Application>,
|
| } // namespace js
|
| } // namespace mojo
|
|
|
| -#endif // MOJO_SERVICES_JS_JS_APP_H_
|
| +#endif // SERVICES_JS_JS_APP_H_
|
|
|