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

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

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix message loop destruction order Created 6 years, 5 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 8490e691b3c954be3ab02342754fad693d7ba387..87093835706bef98f8091819a9b76450ec45cdd0 100644
--- a/mojo/services/html_viewer/html_viewer.cc
+++ b/mojo/services/html_viewer/html_viewer.cc
@@ -6,12 +6,14 @@
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/application_impl.h"
+#include "mojo/public/cpp/bindings/interface_factory_with_context.h"
#include "mojo/services/html_viewer/blink_platform_impl.h"
#include "mojo/services/html_viewer/html_document_view.h"
#include "mojo/services/public/cpp/view_manager/node.h"
#include "mojo/services/public/cpp/view_manager/types.h"
#include "mojo/services/public/cpp/view_manager/view.h"
#include "mojo/services/public/cpp/view_manager/view_manager.h"
+#include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h"
#include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
#include "mojo/services/public/interfaces/navigation/navigation.mojom.h"
#include "third_party/WebKit/public/web/WebKit.h"
@@ -22,8 +24,7 @@ class HTMLViewer;
class NavigatorImpl : public InterfaceImpl<navigation::Navigator> {
public:
- explicit NavigatorImpl(ApplicationConnection* connection,
- HTMLViewer* viewer) : viewer_(viewer) {}
+ explicit NavigatorImpl(HTMLViewer* viewer) : viewer_(viewer) {}
virtual ~NavigatorImpl() {}
private:
@@ -38,11 +39,16 @@ class NavigatorImpl : public InterfaceImpl<navigation::Navigator> {
DISALLOW_COPY_AND_ASSIGN(NavigatorImpl);
};
-class HTMLViewer : public ApplicationDelegate,
- public view_manager::ViewManagerDelegate {
+class HTMLViewer
+ : public ApplicationDelegate,
+ public view_manager::ViewManagerDelegate,
+ public InterfaceFactoryWithContext<NavigatorImpl, HTMLViewer> {
public:
- HTMLViewer() : application_impl_(NULL), document_view_(NULL) {
- }
+ HTMLViewer()
+ : InterfaceFactoryWithContext(this),
+ application_impl_(NULL),
+ document_view_(NULL),
+ view_manager_client_factory_(this) {}
virtual ~HTMLViewer() {
blink::shutdown();
}
@@ -63,8 +69,8 @@ class HTMLViewer : public ApplicationDelegate,
virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
OVERRIDE {
- connection->AddService<NavigatorImpl>(this);
- view_manager::ViewManager::ConfigureIncomingConnection(connection, this);
+ connection->AddService(this);
+ connection->AddService(&view_manager_client_factory_);
return true;
}
@@ -93,6 +99,7 @@ class HTMLViewer : public ApplicationDelegate,
// TODO(darin): Figure out proper ownership of this instance.
HTMLDocumentView* document_view_;
URLResponsePtr response_;
+ view_manager::ViewManagerClientFactory view_manager_client_factory_;
DISALLOW_COPY_AND_ASSIGN(HTMLViewer);
};

Powered by Google App Engine
This is Rietveld 408576698