| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "mojo/examples/window_manager/window_manager.mojom.h" | 7 #include "mojo/examples/window_manager/window_manager.mojom.h" |
| 8 #include "mojo/public/cpp/application/application.h" | 8 #include "mojo/public/cpp/application/application.h" |
| 9 #include "mojo/services/public/cpp/view_manager/view.h" | 9 #include "mojo/services/public/cpp/view_manager/view.h" |
| 10 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 10 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 // Overridden from Application: | 62 // Overridden from Application: |
| 63 virtual void Initialize() MOJO_OVERRIDE { | 63 virtual void Initialize() MOJO_OVERRIDE { |
| 64 AddService<WindowManagerConnection>(this); | 64 AddService<WindowManagerConnection>(this); |
| 65 ViewManager::Create(this, this); | 65 ViewManager::Create(this, this); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Overridden from ViewObserver: | 68 // Overridden from ViewObserver: |
| 69 virtual void OnViewInputEvent(View* view, EventPtr event) OVERRIDE { | 69 virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE { |
| 70 if (event->action == ui::ET_MOUSE_RELEASED) { | 70 if (event->action == ui::ET_MOUSE_RELEASED) { |
| 71 if (event->flags & ui::EF_LEFT_MOUSE_BUTTON) | 71 if (event->flags & ui::EF_LEFT_MOUSE_BUTTON) |
| 72 CreateWindow("mojo:mojo_embedded_app"); | 72 CreateWindow("mojo:mojo_embedded_app"); |
| 73 else if (event->flags & ui::EF_RIGHT_MOUSE_BUTTON) | 73 else if (event->flags & ui::EF_RIGHT_MOUSE_BUTTON) |
| 74 CreateWindow("mojo:mojo_nesting_app"); | 74 CreateWindow("mojo:mojo_nesting_app"); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 // Overridden from ViewManagerDelegate: | 78 // Overridden from ViewManagerDelegate: |
| 79 virtual void OnRootAdded(ViewManager* view_manager, | 79 virtual void OnRootAdded(ViewManager* view_manager, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 window_manager_->CloseWindow(node_id); | 118 window_manager_->CloseWindow(node_id); |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace examples | 121 } // namespace examples |
| 122 | 122 |
| 123 // static | 123 // static |
| 124 Application* Application::Create() { | 124 Application* Application::Create() { |
| 125 return new examples::WindowManager; | 125 return new examples::WindowManager; |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace mojo | 128 } // namespace mojo |
| OLD | NEW |