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

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

Issue 467263006: JavaScript Content Handler Version 0.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Working and relatively complete Created 6 years, 3 months 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 | Annotate | Revision Log
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 JS_CONTENT_HANDLER_H_
Aaron Boodman 2014/09/10 02:22:09 See http://google-styleguide.googlecode.com/svn/tr
hansmuller 2014/09/11 00:26:17 Done.
6 #define JS_CONTENT_HANDLER_H_
7
8 #include "base/bind.h"
Aaron Boodman 2014/09/10 02:22:09 Is this used?
hansmuller 2014/09/11 00:26:17 No, I've removed it.
9 #include "base/memory/ref_counted.h"
10 #include "mojo/public/cpp/application/application_delegate.h"
11 #include "mojo/public/cpp/application/application_impl.h"
Aaron Boodman 2014/09/10 02:22:10 I think you can forward declare ApplicationImpl to
hansmuller 2014/09/11 00:26:17 Good point, I've forwarded it.
12 #include "mojo/public/cpp/application/interface_factory_impl.h"
13 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom. h"
14
15 namespace mojo {
16 namespace apps {
17
18 class JSContentHandlerApp;
19 class JSApp;
20
21 class JSContentHandlerImpl : public InterfaceImpl<ContentHandler> {
Aaron Boodman 2014/09/10 02:22:09 Is there any reason for the "JS" prefix? Why not j
hansmuller 2014/09/11 00:26:17 I thought the prefix was warranted since this was
22 public:
23 JSContentHandlerImpl(JSContentHandlerApp* content_handler_app);
24 virtual ~JSContentHandlerImpl();
25
26 private:
27 virtual void OnConnect(
28 const mojo::String& url,
29 URLResponsePtr content,
30 InterfaceRequest<ServiceProvider> service_provider) MOJO_OVERRIDE;
31
32 JSContentHandlerApp* content_handler_app_;
33 };
34
35 class JSContentHandlerApp :
Aaron Boodman 2014/09/10 02:22:09 I think it is confusing to call this ContentHandle
hansmuller 2014/09/11 00:26:17 OK, I'll remove the JS prefixes I agree that the
36 public ApplicationDelegate,
37 public base::RefCountedThreadSafe<JSContentHandlerApp> {
38
39 public:
40 JSContentHandlerApp();
41 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE;
Aaron Boodman 2014/09/10 02:22:09 Add a comment like: // ApplicationDelegate method
hansmuller 2014/09/11 00:26:17 Done.
42 virtual bool ConfigureIncomingConnection(
43 ApplicationConnection* connection) MOJO_OVERRIDE;
44
45 void StartJSApp(const std::string& url, URLResponsePtr content);
46 void QuitJSApp(JSApp* app);
47
48 void ConnectToService(ScopedMessagePipeHandle pipe_handle1,
49 const std::string& application_url, const std::string& interface_name);
50
51 private:
52 typedef std::vector<scoped_refptr<JSApp> > Apps;
Aaron Boodman 2014/09/10 02:22:09 We would typically call this type AppVector, but s
hansmuller 2014/09/11 00:26:17 I've changed the type to AppVector since we haven'
53
54 ApplicationImpl* applicationImpl_;
Aaron Boodman 2014/09/10 02:22:10 application_impl_, but see comments about saving S
55 InterfaceFactoryImplWithContext<
56 JSContentHandlerImpl, JSContentHandlerApp> content_handler_factory_;
57 Apps apps_;
58
59 virtual ~JSContentHandlerApp();
Aaron Boodman 2014/09/10 02:22:09 The ordering is incorrect. See http://google-style
hansmuller 2014/09/11 00:26:17 Done.
60 friend class base::RefCountedThreadSafe<JSContentHandlerApp>;
61 DISALLOW_COPY_AND_ASSIGN(JSContentHandlerApp);
62 };
63
64 } // namespace apps
65 } // namespace mojo
66
67 #endif // JS_CONTENT_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698