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

Unified Diff: mojo/services/html_viewer/html_viewer.cc

Issue 567803002: Hook WebMediaPlayerImpl up to Mojo's HTMLDocumentView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move factory ownership to HTMLViewer. 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 side-by-side diff with in-line comments
Download patch
Index: mojo/services/html_viewer/html_viewer.cc
diff --git a/mojo/services/html_viewer/html_viewer.cc b/mojo/services/html_viewer/html_viewer.cc
index e8b5c76314bbf01afa43a1b6b037f18a495b866b..8bddb9c54c1b849095fbd71c44d2a602f4c9d4b1 100644
--- a/mojo/services/html_viewer/html_viewer.cc
+++ b/mojo/services/html_viewer/html_viewer.cc
@@ -11,6 +11,7 @@
#include "mojo/public/cpp/application/interface_factory_impl.h"
#include "mojo/services/html_viewer/blink_platform_impl.h"
#include "mojo/services/html_viewer/html_document_view.h"
+#include "mojo/services/html_viewer/webmediaplayer_factory.h"
#include "mojo/services/public/interfaces/content_handler/content_handler.mojom.h"
#include "third_party/WebKit/public/web/WebKit.h"
@@ -20,7 +21,9 @@ class HTMLViewer;
class ContentHandlerImpl : public InterfaceImpl<ContentHandler> {
public:
- explicit ContentHandlerImpl(Shell* shell) : shell_(shell) {}
+ explicit ContentHandlerImpl(HTMLViewer* html_viewer)
+ : html_viewer_(html_viewer) {
+ }
virtual ~ContentHandlerImpl() {}
private:
@@ -28,12 +31,9 @@ class ContentHandlerImpl : public InterfaceImpl<ContentHandler> {
virtual void OnConnect(
const mojo::String& url,
URLResponsePtr response,
- InterfaceRequest<ServiceProvider> service_provider_request) OVERRIDE {
- new HTMLDocumentView(
- response.Pass(), service_provider_request.Pass(), shell_);
- }
+ InterfaceRequest<ServiceProvider> service_provider_request) OVERRIDE;
- Shell* shell_;
+ HTMLViewer* html_viewer_;
DISALLOW_COPY_AND_ASSIGN(ContentHandlerImpl);
};
@@ -44,12 +44,20 @@ class HTMLViewer : public ApplicationDelegate {
virtual ~HTMLViewer() { blink::shutdown(); }
+ WebMediaPlayerFactory* web_media_player_factory() const {
+ return web_media_player_factory_.get();
+ }
+
+ Shell* shell() const { return app_->shell(); }
+
private:
// Overridden from ApplicationDelegate:
virtual void Initialize(ApplicationImpl* app) OVERRIDE {
+ app_ = app;
+ web_media_player_factory_.reset(new WebMediaPlayerFactory());
content_handler_factory_.reset(
- new InterfaceFactoryImplWithContext<ContentHandlerImpl, Shell>(
- app->shell()));
+ new InterfaceFactoryImplWithContext<ContentHandlerImpl, HTMLViewer>(
+ this));
blink_platform_impl_.reset(new BlinkPlatformImpl(app));
blink::initialize(blink_platform_impl_.get());
}
@@ -60,13 +68,26 @@ class HTMLViewer : public ApplicationDelegate {
return true;
}
+ ApplicationImpl* app_;
scoped_ptr<BlinkPlatformImpl> blink_platform_impl_;
- scoped_ptr<InterfaceFactoryImplWithContext<ContentHandlerImpl, Shell> >
+ scoped_ptr<WebMediaPlayerFactory> web_media_player_factory_;
+ scoped_ptr<InterfaceFactoryImplWithContext<ContentHandlerImpl, HTMLViewer> >
content_handler_factory_;
DISALLOW_COPY_AND_ASSIGN(HTMLViewer);
};
+void ContentHandlerImpl::OnConnect(
+ const mojo::String& url,
+ URLResponsePtr response,
+ InterfaceRequest<ServiceProvider> service_provider_request) {
+ new HTMLDocumentView(
+ response.Pass(),
+ service_provider_request.Pass(),
+ html_viewer_->shell(),
+ html_viewer_->web_media_player_factory());
+}
+
} // namespace mojo
MojoResult MojoMain(MojoHandle shell_handle) {

Powered by Google App Engine
This is Rietveld 408576698