Chromium Code Reviews| Index: mojo/apps/js/js_content_handler_app.h |
| diff --git a/mojo/apps/js/js_content_handler_app.h b/mojo/apps/js/js_content_handler_app.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d7d65b1fec80e8b570067ebbb31068b60415964a |
| --- /dev/null |
| +++ b/mojo/apps/js/js_content_handler_app.h |
| @@ -0,0 +1,67 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#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.
|
| +#define JS_CONTENT_HANDLER_H_ |
| + |
| +#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.
|
| +#include "base/memory/ref_counted.h" |
| +#include "mojo/public/cpp/application/application_delegate.h" |
| +#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.
|
| +#include "mojo/public/cpp/application/interface_factory_impl.h" |
| +#include "mojo/services/public/interfaces/content_handler/content_handler.mojom.h" |
| + |
| +namespace mojo { |
| +namespace apps { |
| + |
| +class JSContentHandlerApp; |
| +class JSApp; |
| + |
| +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
|
| + public: |
| + JSContentHandlerImpl(JSContentHandlerApp* content_handler_app); |
| + virtual ~JSContentHandlerImpl(); |
| + |
| + private: |
| + virtual void OnConnect( |
| + const mojo::String& url, |
| + URLResponsePtr content, |
| + InterfaceRequest<ServiceProvider> service_provider) MOJO_OVERRIDE; |
| + |
| + JSContentHandlerApp* content_handler_app_; |
| +}; |
| + |
| +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
|
| + public ApplicationDelegate, |
| + public base::RefCountedThreadSafe<JSContentHandlerApp> { |
| + |
| + public: |
| + JSContentHandlerApp(); |
| + 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.
|
| + virtual bool ConfigureIncomingConnection( |
| + ApplicationConnection* connection) MOJO_OVERRIDE; |
| + |
| + void StartJSApp(const std::string& url, URLResponsePtr content); |
| + void QuitJSApp(JSApp* app); |
| + |
| + void ConnectToService(ScopedMessagePipeHandle pipe_handle1, |
| + const std::string& application_url, const std::string& interface_name); |
| + |
| + private: |
| + 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'
|
| + |
| + ApplicationImpl* applicationImpl_; |
|
Aaron Boodman
2014/09/10 02:22:10
application_impl_, but see comments about saving S
|
| + InterfaceFactoryImplWithContext< |
| + JSContentHandlerImpl, JSContentHandlerApp> content_handler_factory_; |
| + Apps apps_; |
| + |
| + 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.
|
| + friend class base::RefCountedThreadSafe<JSContentHandlerApp>; |
| + DISALLOW_COPY_AND_ASSIGN(JSContentHandlerApp); |
| +}; |
| + |
| +} // namespace apps |
| +} // namespace mojo |
| + |
| +#endif // JS_CONTENT_HANDLER_H_ |