| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "mojo/application/application_runner_chromium.h" | 7 #include "mojo/application/application_runner_chromium.h" |
| 8 #include "mojo/examples/wm_flow/wm/frame_controller.h" | 8 #include "mojo/examples/wm_flow/wm/frame_controller.h" |
| 9 #include "mojo/public/c/system/main.h" | 9 #include "mojo/public/c/system/main.h" |
| 10 #include "mojo/public/cpp/application/application_delegate.h" | 10 #include "mojo/public/cpp/application/application_delegate.h" |
| 11 #include "mojo/public/cpp/application/application_impl.h" | 11 #include "mojo/public/cpp/application/application_impl.h" |
| 12 #include "mojo/public/cpp/application/service_provider_impl.h" | 12 #include "mojo/public/cpp/application/service_provider_impl.h" |
| 13 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 13 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
| 14 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" | 14 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" |
| 15 #include "mojo/services/public/cpp/view_manager/view_observer.h" | 15 #include "mojo/services/public/cpp/view_manager/view_observer.h" |
| 16 #include "mojo/services/public/cpp/view_manager/window_manager_delegate.h" | |
| 17 #include "mojo/services/public/interfaces/input_events/input_events.mojom.h" | 16 #include "mojo/services/public/interfaces/input_events/input_events.mojom.h" |
| 18 #include "mojo/services/window_manager/window_manager_app.h" | 17 #include "mojo/services/window_manager/window_manager_app.h" |
| 18 #include "mojo/services/window_manager/window_manager_delegate.h" |
| 19 #include "mojo/views/views_init.h" | 19 #include "mojo/views/views_init.h" |
| 20 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 21 #include "ui/wm/core/focus_rules.h" | 21 #include "ui/wm/core/focus_rules.h" |
| 22 #include "ui/wm/public/activation_client.h" | 22 #include "ui/wm/public/activation_client.h" |
| 23 | 23 |
| 24 namespace examples { | 24 namespace examples { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 class WMFocusRules : public wm::FocusRules { | 28 class WMFocusRules : public wm::FocusRules { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 mojo::View* frame_view = CreateTopLevelWindow(&app_view); | 141 mojo::View* frame_view = CreateTopLevelWindow(&app_view); |
| 142 window_container_->AddChild(frame_view); | 142 window_container_->AddChild(frame_view); |
| 143 | 143 |
| 144 // TODO(beng): We're dropping the |service_provider| passed from the client | 144 // TODO(beng): We're dropping the |service_provider| passed from the client |
| 145 // on the floor here and passing our own. Seems like we should | 145 // on the floor here and passing our own. Seems like we should |
| 146 // be sending both. I'm not yet sure how this sould work for | 146 // be sending both. I'm not yet sure how this sould work for |
| 147 // N levels of proxying. | 147 // N levels of proxying. |
| 148 app_view->Embed(url, scoped_ptr<mojo::ServiceProviderImpl>( | 148 app_view->Embed(url, scoped_ptr<mojo::ServiceProviderImpl>( |
| 149 new mojo::ServiceProviderImpl).Pass()); | 149 new mojo::ServiceProviderImpl).Pass()); |
| 150 } | 150 } |
| 151 virtual void DispatchEvent(mojo::EventPtr event) override {} | |
| 152 | 151 |
| 153 // Overridden from mojo::ViewObserver: | 152 // Overridden from mojo::ViewObserver: |
| 154 virtual void OnViewInputEvent(mojo::View* view, | 153 virtual void OnViewInputEvent(mojo::View* view, |
| 155 const mojo::EventPtr& event) override { | 154 const mojo::EventPtr& event) override { |
| 156 if (event->action == mojo::EVENT_TYPE_MOUSE_RELEASED && | 155 if (event->action == mojo::EVENT_TYPE_MOUSE_RELEASED && |
| 157 event->flags & mojo::EVENT_FLAGS_RIGHT_MOUSE_BUTTON && | 156 event->flags & mojo::EVENT_FLAGS_RIGHT_MOUSE_BUTTON && |
| 158 view->parent() == window_container_) { | 157 view->parent() == window_container_) { |
| 159 CloseWindow(view); | 158 CloseWindow(view); |
| 160 } | 159 } |
| 161 } | 160 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 DISALLOW_COPY_AND_ASSIGN(SimpleWM); | 194 DISALLOW_COPY_AND_ASSIGN(SimpleWM); |
| 196 }; | 195 }; |
| 197 | 196 |
| 198 } // namespace examples | 197 } // namespace examples |
| 199 | 198 |
| 200 MojoResult MojoMain(MojoHandle shell_handle) { | 199 MojoResult MojoMain(MojoHandle shell_handle) { |
| 201 mojo::ViewsInit views_init; | 200 mojo::ViewsInit views_init; |
| 202 mojo::ApplicationRunnerChromium runner(new examples::SimpleWM); | 201 mojo::ApplicationRunnerChromium runner(new examples::SimpleWM); |
| 203 return runner.Run(shell_handle); | 202 return runner.Run(shell_handle); |
| 204 } | 203 } |
| OLD | NEW |