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

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: convert everything over, remove ApplicationConnection::AddService 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..f4a078a2bf894bfdace9dba30f10fc3cd7268064 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/context_interface_factory.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:
@@ -40,10 +41,14 @@ class NavigatorImpl : public InterfaceImpl<navigation::Navigator> {
};
class HTMLViewer : public ApplicationDelegate,
- public view_manager::ViewManagerDelegate {
+ public view_manager::ViewManagerDelegate,
+ public ContextInterfaceFactory<NavigatorImpl, HTMLViewer> {
public:
- HTMLViewer() : application_impl_(NULL), document_view_(NULL) {
- }
+ HTMLViewer()
+ : ContextInterfaceFactory(this),
+ application_impl_(NULL),
+ document_view_(NULL),
+ view_manager_client_factory_(this) {}
virtual ~HTMLViewer() {
blink::shutdown();
}
@@ -64,8 +69,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 +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