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

Unified Diff: mojo/services/window_manager/main.cc

Issue 466273002: Remove OpenWindow from the WindowManager interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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/services/window_manager/main.cc
diff --git a/mojo/services/window_manager/main.cc b/mojo/services/window_manager/main.cc
index b77d3885a469c72bf7777220e8dec2654c8f3bd4..9bc50e43fada2179bf983d6615d03da0ffb08142 100644
--- a/mojo/services/window_manager/main.cc
+++ b/mojo/services/window_manager/main.cc
@@ -2,7 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/memory/scoped_ptr.h"
#include "mojo/public/cpp/application/application_delegate.h"
+#include "mojo/public/cpp/application/service_provider_impl.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/window_manager/window_manager_app.h"
// ApplicationDelegate implementation file for WindowManager users (e.g.
@@ -11,9 +16,62 @@
namespace mojo {
+class DefaultWindowManager : public ApplicationDelegate,
+ public ViewManagerDelegate,
+ public WindowManagerDelegate {
+ public:
+ DefaultWindowManager()
+ : window_manager_app_(new WindowManagerApp(this)),
+ view_manager_(NULL),
+ root_(NULL) {}
+ virtual ~DefaultWindowManager() {}
+
+ private:
+ // Overridden from ApplicationDelegate:
+ virtual void Initialize(ApplicationImpl* impl) MOJO_OVERRIDE {
+ window_manager_app_->Initialize(impl);
+ }
+ virtual bool ConfigureIncomingConnection(
+ ApplicationConnection* connection) MOJO_OVERRIDE {
+ window_manager_app_->ConfigureIncomingConnection(connection);
+ return true;
+ }
+
+ // Overridden from ViewManagerDelegate:
+ virtual void OnEmbed(
+ ViewManager* view_manager,
+ View* root,
+ ServiceProviderImpl* exported_services,
+ scoped_ptr<ServiceProvider> imported_services) MOJO_OVERRIDE {
+ view_manager_ = view_manager;
+ root_ = root;
+ view_manager_->SetWindowManagerDelegate(this);
+ }
+ virtual void OnViewManagerDisconnected(
+ ViewManager* view_manager) MOJO_OVERRIDE {}
+
+ // Overridden from WindowManagerDelegate:
+ virtual void Embed(
+ const String& url,
+ InterfaceRequest<ServiceProvider> service_provider) MOJO_OVERRIDE {
+ View* view = View::Create(view_manager_);
+ root_->AddChild(view);
+ view->Embed(url, scoped_ptr<mojo::ServiceProviderImpl>(
+ new mojo::ServiceProviderImpl).Pass());
+ }
+ virtual void DispatchEvent(View* target, EventPtr event) MOJO_OVERRIDE {}
+
+ scoped_ptr<WindowManagerApp> window_manager_app_;
+
+ ViewManager* view_manager_;
+ View* root_;
+
+ MOJO_DISALLOW_COPY_AND_ASSIGN(DefaultWindowManager);
+};
+
// static
ApplicationDelegate* ApplicationDelegate::Create() {
- return new WindowManagerApp(NULL);
+ return new DefaultWindowManager;
}
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698