summaryrefslogtreecommitdiffstats
path: root/mojo/examples/window_manager
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-22 04:27:05 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-22 04:27:05 +0000
commitb9e6a3d30f8ddda8bc64b31bb59982a062be588e (patch)
treeab9e0bea6222d6cccfc26db815f642e9785bbc71 /mojo/examples/window_manager
parentfcee682084ee13f0372842de5d8d851f71a46aef (diff)
downloadchromium_src-b9e6a3d30f8ddda8bc64b31bb59982a062be588e.zip
chromium_src-b9e6a3d30f8ddda8bc64b31bb59982a062be588e.tar.gz
chromium_src-b9e6a3d30f8ddda8bc64b31bb59982a062be588e.tar.bz2
Allow EmbedRoot to be called multiple times.
Subsequent calls to EmbedRoot are now delegated to the window manager. This allows an application that was not created via the embed flow to obtain a connection to the view manager by asking the view manager init service to embed it somewhere. The init service just forwards this to the window manager. This is effectively like asking the window manager to create a toplevel window. R=sky@chromium.org BUG=none Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=284322 Review URL: https://codereview.chromium.org/403083002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284624 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/examples/window_manager')
-rw-r--r--mojo/examples/window_manager/window_manager.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/mojo/examples/window_manager/window_manager.cc b/mojo/examples/window_manager/window_manager.cc
index e1cb54d..057c101 100644
--- a/mojo/examples/window_manager/window_manager.cc
+++ b/mojo/examples/window_manager/window_manager.cc
@@ -15,9 +15,9 @@
#include "mojo/services/public/cpp/view_manager/node.h"
#include "mojo/services/public/cpp/view_manager/node_observer.h"
#include "mojo/services/public/cpp/view_manager/view.h"
-#include "mojo/services/public/cpp/view_manager/view_event_dispatcher.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/window_manager_delegate.h"
#include "mojo/services/public/interfaces/input_events/input_events.mojom.h"
#include "mojo/services/public/interfaces/launcher/launcher.mojom.h"
#include "mojo/services/public/interfaces/navigation/navigation.mojom.h"
@@ -34,10 +34,10 @@ using mojo::view_manager::Id;
using mojo::view_manager::Node;
using mojo::view_manager::NodeObserver;
using mojo::view_manager::View;
-using mojo::view_manager::ViewEventDispatcher;
using mojo::view_manager::ViewManager;
using mojo::view_manager::ViewManagerDelegate;
using mojo::view_manager::ViewObserver;
+using mojo::view_manager::WindowManagerDelegate;
namespace mojo {
namespace examples {
@@ -252,7 +252,7 @@ class RootLayoutManager : public NodeObserver {
class WindowManager : public ApplicationDelegate,
public DebugPanel::Delegate,
public ViewManagerDelegate,
- public ViewEventDispatcher {
+ public WindowManagerDelegate {
public:
WindowManager()
: launcher_ui_(NULL),
@@ -339,7 +339,7 @@ class WindowManager : public ApplicationDelegate,
virtual void OnRootAdded(ViewManager* view_manager, Node* root) OVERRIDE {
DCHECK(!view_manager_);
view_manager_ = view_manager;
- view_manager_->SetEventDispatcher(this);
+ view_manager_->SetWindowManagerDelegate(this);
Node* node = Node::Create(view_manager_);
root->AddChild(node);
@@ -366,7 +366,12 @@ class WindowManager : public ApplicationDelegate,
base::MessageLoop::current()->Quit();
}
- // Overridden from ViewEventDispatcher:
+ // Overridden from WindowManagerDelegate:
+ virtual void EmbedRoot(const String& url) OVERRIDE {
+ CreateWindow(url,
+ navigation::NavigationDetailsPtr().Pass(),
+ navigation::ResponseDetailsPtr().Pass());
+ }
virtual void DispatchEvent(View* target, EventPtr event) OVERRIDE {
// TODO(beng): More sophisticated focus handling than this is required!
if (event->action == ui::ET_MOUSE_PRESSED &&