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

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

Issue 327523004: Introduce very beginning of navigation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: goto fail 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/embedded_app/embedded_app.cc ('k') | mojo/mojo_examples.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/examples/window_manager/window_manager.cc
diff --git a/mojo/examples/window_manager/window_manager.cc b/mojo/examples/window_manager/window_manager.cc
index b4d6c829a39cc0ec1441bd5cc22bba57ce01937d..e1713b5ac9205cce4e1367c874d76a60f9a145a9 100644
--- a/mojo/examples/window_manager/window_manager.cc
+++ b/mojo/examples/window_manager/window_manager.cc
@@ -4,8 +4,10 @@
#include "base/basictypes.h"
#include "base/bind.h"
+#include "base/strings/stringprintf.h"
#include "mojo/examples/window_manager/window_manager.mojom.h"
#include "mojo/public/cpp/application/application.h"
+#include "mojo/services/navigation/navigation.mojom.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"
@@ -30,6 +32,17 @@ namespace examples {
class WindowManager;
+namespace {
+
+const SkColor kColors[] = { SK_ColorYELLOW,
+ SK_ColorRED,
+ SK_ColorGREEN,
+ SK_ColorMAGENTA };
+
+const char* kEmbeddedAppURL = "mojo:mojo_embedded_app";
+
+} // namespace
+
class WindowManagerConnection : public InterfaceImpl<IWindowManager> {
public:
explicit WindowManagerConnection(WindowManager* window_manager)
@@ -106,8 +119,23 @@ class WindowManager : public Application,
node->AddChild(embedded);
embedded->SetBounds(bounds);
embedded->Embed(url);
+
+ if (!view_navigator_.get()) {
+ // TODO(aa): This means that there can only ever be one instance of every
+ // app, which seems wrong. Instead, perhaps embedder should get back a
+ // service provider that allows it to talk to embeddee.
+ ConnectTo(kEmbeddedAppURL, &view_navigator_);
Ben Goodger (Google) 2014/06/09 20:17:05 can't you resolve this by having view_navigator_ b
Aaron Boodman 2014/06/10 19:41:29 I wasn't referring to the shared member variable.
+ }
+
+ navigation::NavigationDetailsPtr details(
+ navigation::NavigationDetails::New());
+ size_t index = node->children().size() - 1;
+ details->url = base::StringPrintf(
+ "%s/%x", kEmbeddedAppURL, kColors[index % arraysize(kColors)]);
+ view_navigator_->Navigate(embedded->id(), details.Pass());
}
+ navigation::ViewNavigatorPtr view_navigator_;
ViewManager* view_manager_;
Id parent_node_id_;
@@ -125,4 +153,4 @@ Application* Application::Create() {
return new examples::WindowManager;
}
-} // namespace mojo
+} // namespace mojo
« no previous file with comments | « mojo/examples/embedded_app/embedded_app.cc ('k') | mojo/mojo_examples.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698