summaryrefslogtreecommitdiffstats
path: root/mojo/examples/media_viewer
diff options
context:
space:
mode:
authordavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-25 21:57:02 +0000
committerdavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-25 21:57:02 +0000
commit8fc44a9f0c97c5f2e61fc8125a4822a057c67446 (patch)
tree0e3745a55a87d85cc5463b4a157aadccd0713c45 /mojo/examples/media_viewer
parentcf0c55a04cc3cb7e996d823eaf574e70d305a303 (diff)
downloadchromium_src-8fc44a9f0c97c5f2e61fc8125a4822a057c67446.zip
chromium_src-8fc44a9f0c97c5f2e61fc8125a4822a057c67446.tar.gz
chromium_src-8fc44a9f0c97c5f2e61fc8125a4822a057c67446.tar.bz2
Split ServiceProvider into 3
BUG= R=darin@chromium.org, qsr@chromium.org Review URL: https://codereview.chromium.org/347333002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279830 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/examples/media_viewer')
-rw-r--r--mojo/examples/media_viewer/media_viewer.cc32
1 files changed, 22 insertions, 10 deletions
diff --git a/mojo/examples/media_viewer/media_viewer.cc b/mojo/examples/media_viewer/media_viewer.cc
index 29d4b06..b727b59 100644
--- a/mojo/examples/media_viewer/media_viewer.cc
+++ b/mojo/examples/media_viewer/media_viewer.cc
@@ -7,7 +7,9 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/application/application.h"
+#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_impl.h"
#include "mojo/services/public/cpp/view_manager/node.h"
#include "mojo/services/public/cpp/view_manager/view.h"
@@ -23,7 +25,8 @@ class MediaViewer;
class NavigatorImpl : public InterfaceImpl<navigation::Navigator> {
public:
- explicit NavigatorImpl(MediaViewer* viewer) : viewer_(viewer) {}
+ explicit NavigatorImpl(ApplicationConnection* connection,
+ MediaViewer* viewer) : viewer_(viewer) {}
virtual ~NavigatorImpl() {}
private:
@@ -38,10 +41,11 @@ class NavigatorImpl : public InterfaceImpl<navigation::Navigator> {
DISALLOW_COPY_AND_ASSIGN(NavigatorImpl);
};
-class MediaViewer : public Application,
+class MediaViewer : public ApplicationDelegate,
public view_manager::ViewManagerDelegate {
public:
- MediaViewer() : content_node_(NULL),
+ MediaViewer() : app_(NULL),
+ content_node_(NULL),
view_manager_(NULL) {
handler_map_["image/png"] = "mojo:mojo_png_viewer";
}
@@ -72,7 +76,7 @@ class MediaViewer : public Application,
if (navigation_details) {
navigation::NavigatorPtr navigator;
- ConnectTo(handler, &navigator);
+ app_->ConnectToService(handler, &navigator);
navigator->Navigate(content_node_->id(), navigation_details.Pass(),
response_details.Pass());
}
@@ -87,10 +91,17 @@ class MediaViewer : public Application,
navigation::ResponseDetailsPtr response_details;
};
- // Overridden from Application:
- virtual void Initialize() OVERRIDE {
- AddService<NavigatorImpl>(this);
- view_manager::ViewManager::Create(this, this);
+
+ // Overridden from ApplicationDelegate:
+ virtual void Initialize(ApplicationImpl* app) OVERRIDE {
+ app_ = app;
+ }
+
+ virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
+ OVERRIDE {
+ connection->AddService<NavigatorImpl>(this);
+ view_manager::ViewManager::ConfigureIncomingConnection(connection, this);
+ return true;
}
// Overridden from view_manager::ViewManagerDelegate:
@@ -117,6 +128,7 @@ class MediaViewer : public Application,
return it != handler_map_.end() ? it->second : std::string();
}
+ ApplicationImpl* app_;
view_manager::Node* content_node_;
view_manager::ViewManager* view_manager_;
HandlerMap handler_map_;
@@ -136,7 +148,7 @@ void NavigatorImpl::Navigate(
} // namespace examples
// static
-Application* Application::Create() {
+ApplicationDelegate* ApplicationDelegate::Create() {
return new examples::MediaViewer;
}