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

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

Issue 331563003: Launching + Views (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 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
« no previous file with comments | « mojo/examples/browser/browser.cc ('k') | mojo/examples/image_viewer/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ab41d95c93f4617d93090f182731cb50ac027380..de37c516312bf3f5d33438a27b2419a612028ebb 100644
--- a/mojo/examples/html_viewer/html_viewer.cc
+++ b/mojo/examples/html_viewer/html_viewer.cc
@@ -3,6 +3,11 @@
// found in the LICENSE file.
#include "mojo/public/cpp/application/application.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_delegate.h"
+#include "mojo/services/public/cpp/view_manager/view_manager_types.h"
+#include "mojo/services/public/cpp/view_manager/view_tree_node.h"
#include "mojo/services/public/interfaces/launcher/launcher.mojom.h"
namespace mojo {
@@ -12,14 +17,15 @@ class HTMLViewer;
class LaunchableConnection : public InterfaceImpl<launcher::Launchable> {
public:
- LaunchableConnection() {}
+ explicit LaunchableConnection(HTMLViewer* viewer) : viewer_(viewer) {}
virtual ~LaunchableConnection() {}
private:
// Overridden from launcher::Launchable:
virtual void OnLaunch(
URLResponsePtr response,
- ScopedDataPipeConsumerHandle response_body_stream) MOJO_OVERRIDE {
+ ScopedDataPipeConsumerHandle response_body_stream,
+ view_manager::Id node_id) MOJO_OVERRIDE {
printf("In HTMLViewer, rendering url: %s\n", response->url.data());
printf("HTML: \n");
for (;;) {
@@ -41,21 +47,49 @@ class LaunchableConnection : public InterfaceImpl<launcher::Launchable> {
}
}
printf("\n>>>> EOF <<<<\n\n");
+
+ UpdateView();
}
+
+ void UpdateView();
+
+ HTMLViewer* viewer_;
+
+ DISALLOW_COPY_AND_ASSIGN(LaunchableConnection);
};
-class HTMLViewer : public Application {
+class HTMLViewer : public Application,
+ public view_manager::ViewManagerDelegate {
public:
- HTMLViewer() {}
+ HTMLViewer() : content_view_(NULL) {}
virtual ~HTMLViewer() {}
private:
+ friend class LaunchableConnection;
+
// Overridden from Application:
- virtual void Initialize() MOJO_OVERRIDE {
- AddService<LaunchableConnection>();
+ virtual void Initialize() OVERRIDE {
+ AddService<LaunchableConnection>(this);
+ view_manager::ViewManager::Create(this, this);
}
+
+ // Overridden from view_manager::ViewManagerDelegate:
+ virtual void OnRootAdded(view_manager::ViewManager* view_manager,
+ view_manager::ViewTreeNode* root) OVERRIDE {
+ content_view_ = view_manager::View::Create(view_manager);
+ root->SetActiveView(content_view_);
+ content_view_->SetColor(SK_ColorRED);
+ }
+
+ view_manager::View* content_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(HTMLViewer);
};
+void LaunchableConnection::UpdateView() {
+ viewer_->content_view_->SetColor(SK_ColorGREEN);
+}
+
}
// static
« no previous file with comments | « mojo/examples/browser/browser.cc ('k') | mojo/examples/image_viewer/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698