Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Side by Side Diff: mojo/apps/js/js_app.h

Issue 703023004: Move the JS content handler et al from mojo/apps/js to mojo/services (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fixed DEPS gl build Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/apps/js/content_handler_main.cc ('k') | mojo/apps/js/js_app.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_APPS_JS_JS_APP_H_
6 #define MOJO_APPS_JS_JS_APP_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/threading/thread.h"
10 #include "gin/public/isolate_holder.h"
11 #include "gin/shell_runner.h"
12 #include "mojo/application/content_handler_factory.h"
13 #include "mojo/edk/js/mojo_runner_delegate.h"
14 #include "mojo/public/cpp/application/application_delegate.h"
15 #include "mojo/public/interfaces/application/application.mojom.h"
16 #include "mojo/public/interfaces/application/shell.mojom.h"
17 #include "mojo/services/public/interfaces/network/url_loader.mojom.h"
18
19 namespace mojo {
20 namespace apps {
21
22 class JSApp;
23 class ApplicationDelegateImpl;
24
25 // Each JavaScript app started by content handler runs on its own thread and
26 // in its own V8 isolate. This class represents one running JS app.
27
28 class JSApp : public InterfaceImpl<Application>,
29 public ContentHandlerFactory::HandledApplicationHolder {
30 public:
31 JSApp(ShellPtr shell, URLResponsePtr response);
32 virtual ~JSApp();
33
34 // Called by the JS mojo module to quit this JS app. See mojo.js.
35 void Quit();
36
37 // Called by the JS mojo module to connect to a Mojo application.
38 MessagePipeHandle ConnectToApplication(const std::string& application_url);
39
40 // Called by the JS mojo module to retrieve the ServiceProvider message
41 // pipe handle passed to the JS application's AcceptConnection() method.
42 MessagePipeHandle RequestorMessagePipeHandle();
43
44 private:
45 // Application methods:
46 void AcceptConnection(const String& requestor_url,
47 ServiceProviderPtr provider) override;
48 void Initialize(Array<String> args) override;
49
50 void QuitInternal();
51
52 ShellPtr shell_;
53 js::MojoRunnerDelegate runner_delegate;
54 gin::IsolateHolder isolate_holder_;
55 scoped_ptr<gin::ShellRunner> shell_runner_;
56 std::string source_;
57 std::string file_name_;
58 ScopedMessagePipeHandle requestor_handle_;
59
60 DISALLOW_COPY_AND_ASSIGN(JSApp);
61 };
62
63 } // namespace apps
64 } // namespace mojo
65
66 #endif // MOJO_APPS_JS_JS_APP_H_
OLDNEW
« no previous file with comments | « mojo/apps/js/content_handler_main.cc ('k') | mojo/apps/js/js_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698