| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "examples/wm_flow/wm/frame_controller.h" | 5 #include "examples/wm_flow/wm/frame_controller.h" |
| 6 #include "mojo/application/application_runner_chromium.h" | 6 #include "mojo/application/application_runner_chromium.h" |
| 7 #include "mojo/public/c/system/main.h" | 7 #include "mojo/public/c/system/main.h" |
| 8 #include "mojo/public/cpp/application/application_delegate.h" | 8 #include "mojo/public/cpp/application/application_delegate.h" |
| 9 #include "mojo/public/cpp/application/application_impl.h" | 9 #include "mojo/public/cpp/application/application_impl.h" |
| 10 #include "mojo/public/cpp/application/service_provider_impl.h" | 10 #include "mojo/public/cpp/application/service_provider_impl.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 url_ = GURL(impl->args()[1]); | 39 url_ = GURL(impl->args()[1]); |
| 40 window_manager_app_->Initialize(impl); | 40 window_manager_app_->Initialize(impl); |
| 41 } | 41 } |
| 42 virtual bool ConfigureIncomingConnection( | 42 virtual bool ConfigureIncomingConnection( |
| 43 mojo::ApplicationConnection* connection) override { | 43 mojo::ApplicationConnection* connection) override { |
| 44 window_manager_app_->ConfigureIncomingConnection(connection); | 44 window_manager_app_->ConfigureIncomingConnection(connection); |
| 45 return true; | 45 return true; |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Overridden from mojo::ViewManagerDelegate: | 48 // Overridden from mojo::ViewManagerDelegate: |
| 49 virtual void OnEmbed( | 49 virtual void OnEmbed(mojo::View* root, |
| 50 mojo::View* root, | 50 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 51 mojo::ServiceProviderImpl* exported_services, | 51 mojo::ServiceProviderPtr exposed_services) override { |
| 52 scoped_ptr<mojo::ServiceProvider> remote_service_provider) override { | |
| 53 root_ = root; | 52 root_ = root; |
| 54 | 53 |
| 55 window_container_ = root->view_manager()->CreateView(); | 54 window_container_ = root->view_manager()->CreateView(); |
| 56 window_container_->SetBounds(root_->bounds()); | 55 window_container_->SetBounds(root_->bounds()); |
| 57 root_->AddChild(window_container_); | 56 root_->AddChild(window_container_); |
| 58 window_container_->SetVisible(true); | 57 window_container_->SetVisible(true); |
| 59 | 58 |
| 60 window_manager_app_->InitFocus(make_scoped_ptr( | 59 window_manager_app_->InitFocus(make_scoped_ptr( |
| 61 new window_manager::BasicFocusRules(window_container_))); | 60 new window_manager::BasicFocusRules(window_container_))); |
| 62 } | 61 } |
| 63 virtual void OnViewManagerDisconnected( | 62 virtual void OnViewManagerDisconnected( |
| 64 mojo::ViewManager* view_manager) override { | 63 mojo::ViewManager* view_manager) override { |
| 65 root_ = NULL; | 64 root_ = NULL; |
| 66 } | 65 } |
| 67 | 66 |
| 68 // Overridden from mojo::WindowManagerDelegate: | 67 // Overridden from mojo::WindowManagerDelegate: |
| 69 virtual void Embed( | 68 virtual void Embed(const mojo::String& url, |
| 70 const mojo::String& url, | 69 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 71 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) override { | 70 mojo::ServiceProviderPtr exposed_services) override { |
| 72 DCHECK(root_); | 71 DCHECK(root_); |
| 73 mojo::View* app_view = NULL; | 72 mojo::View* app_view = NULL; |
| 74 CreateTopLevelWindow(&app_view); | 73 CreateTopLevelWindow(&app_view); |
| 75 app_view->Embed(url, service_provider.Pass()); | 74 app_view->Embed(url, services.Pass(), exposed_services.Pass()); |
| 76 } | 75 } |
| 77 | 76 |
| 78 // Overridden from mojo::ViewObserver: | 77 // Overridden from mojo::ViewObserver: |
| 79 virtual void OnViewInputEvent(mojo::View* view, | 78 virtual void OnViewInputEvent(mojo::View* view, |
| 80 const mojo::EventPtr& event) override { | 79 const mojo::EventPtr& event) override { |
| 81 if (event->action == mojo::EVENT_TYPE_MOUSE_RELEASED && | 80 if (event->action == mojo::EVENT_TYPE_MOUSE_RELEASED && |
| 82 event->flags & mojo::EVENT_FLAGS_RIGHT_MOUSE_BUTTON && | 81 event->flags & mojo::EVENT_FLAGS_RIGHT_MOUSE_BUTTON && |
| 83 view->parent() == window_container_) { | 82 view->parent() == window_container_) { |
| 84 CloseWindow(view); | 83 CloseWindow(view); |
| 85 } | 84 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 121 |
| 123 DISALLOW_COPY_AND_ASSIGN(SimpleWM); | 122 DISALLOW_COPY_AND_ASSIGN(SimpleWM); |
| 124 }; | 123 }; |
| 125 | 124 |
| 126 } // namespace examples | 125 } // namespace examples |
| 127 | 126 |
| 128 MojoResult MojoMain(MojoHandle shell_handle) { | 127 MojoResult MojoMain(MojoHandle shell_handle) { |
| 129 mojo::ApplicationRunnerChromium runner(new examples::SimpleWM); | 128 mojo::ApplicationRunnerChromium runner(new examples::SimpleWM); |
| 130 return runner.Run(shell_handle); | 129 return runner.Run(shell_handle); |
| 131 } | 130 } |
| OLD | NEW |