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

Unified Diff: mojo/examples/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: review feedback 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/examples/html_viewer/html_viewer.cc
diff --git a/mojo/examples/html_viewer/html_viewer.cc b/mojo/examples/html_viewer/html_viewer.cc
index 9fbf3a45061a0f6ad051c88243c00c573811d8c3..8f9fd31ae73f6f3a1b970629e4df0e9ffdd3cc75 100644
--- a/mojo/examples/html_viewer/html_viewer.cc
+++ b/mojo/examples/html_viewer/html_viewer.cc
@@ -8,10 +8,12 @@
#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/application/interface_factory_with_context.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"
@@ -23,8 +25,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:
@@ -39,11 +40,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();
}
@@ -64,8 +70,8 @@ class HTMLViewer : public ApplicationDelegate,
virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
OVERRIDE {
- connection->AddService<NavigatorImpl>(this);
- view_manager::ViewManager::ConfigureIncomingConnection(connection, this);
+ connection->AddServiceFactory(this);
+ connection->AddServiceFactory(&view_manager_client_factory_);
return true;
}
@@ -94,6 +100,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