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

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

Issue 687273002: mojo: Update content handler API (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Add missing comment 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/BUILD.gn ('k') | mojo/apps/js/application_delegate_impl.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_CONTENT_HANDLER_H_
6 #define MOJO_APPS_JS_CONTENT_HANDLER_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h"
10 #include "mojo/public/cpp/application/application_delegate.h"
11 #include "mojo/public/cpp/bindings/interface_request.h"
12 #include "mojo/public/cpp/system/message_pipe.h"
13 #include "mojo/public/interfaces/application/service_provider.mojom.h"
14
15 namespace mojo {
16
17 class ApplcationImpl;
18
19 namespace apps {
20
21 class ApplicationDelegateImpl;
22 class JSApp;
23
24 // Manages the JSApps started by this content handler. This class owns the one
25 // reference to the Mojo shell. JSApps post a task to the content handler's
26 // thread to connect to a service or to quit.
27 //
28 // The lifetime each JSApp is defined by its entry in AppVector. When the entry
29 // is removed ("erased") by QuitJSApp(), the JSApp is destroyed.
30
31 class ApplicationDelegateImpl : public ApplicationDelegate {
32 public:
33 ApplicationDelegateImpl();
34 ~ApplicationDelegateImpl() override;
35
36 // Add app to the AppVector and call its Start() method.
37 void StartJSApp(scoped_ptr<JSApp> app);
38
39 // Remove app from the AppVector; destroys the app.
40 void QuitJSApp(JSApp *app);
41
42 // Use the shell to connect to a ServiceProvider for application_url.
43 void ConnectToApplication(const std::string& application_url,
44 InterfaceRequest<ServiceProvider> request);
45
46 protected:
47 // ApplicationDelegate:
48 void Initialize(ApplicationImpl* app) override;
49
50 private:
51 typedef ScopedVector<JSApp> AppVector;
52 ApplicationImpl* application_impl_; // Owns the shell used by all JSApps.
53 AppVector app_vector_;
54 };
55
56 } // namespace apps
57 } // namespace mojo
58
59 #endif // MOJO_APPS_JS_CONTENT_HANDLER_H_
OLDNEW
« no previous file with comments | « mojo/apps/js/BUILD.gn ('k') | mojo/apps/js/application_delegate_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698