| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef MOJO_UI_BASE_VIEW_H_ | 5 #ifndef MOJO_UI_BASE_VIEW_H_ |
| 6 #define MOJO_UI_BASE_VIEW_H_ | 6 #define MOJO_UI_BASE_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
| 11 #include "mojo/public/cpp/bindings/strong_binding.h" | 11 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 12 #include "mojo/public/cpp/system/macros.h" | 12 #include "mojo/public/cpp/system/macros.h" |
| 13 #include "mojo/public/interfaces/application/service_provider.mojom.h" | 13 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
| 14 #include "mojo/services/gfx/composition/interfaces/scenes.mojom.h" | 14 #include "mojo/services/gfx/composition/interfaces/scenes.mojom.h" |
| 15 #include "mojo/services/ui/views/interfaces/view_manager.mojom.h" | 15 #include "mojo/services/ui/views/interfaces/view_manager.mojom.h" |
| 16 #include "mojo/services/ui/views/interfaces/view_provider.mojom.h" | |
| 17 #include "mojo/services/ui/views/interfaces/views.mojom.h" | 16 #include "mojo/services/ui/views/interfaces/views.mojom.h" |
| 18 | 17 |
| 19 namespace mojo { | 18 namespace mojo { |
| 20 namespace ui { | 19 namespace ui { |
| 21 | 20 |
| 22 // Abstract base implementation of the View interface for simple applications. | 21 // Abstract base implementation of the View interface for simple applications. |
| 23 // Subclasses must handle layout and provide content for the scene by | 22 // Subclasses must handle layout and provide content for the scene by |
| 24 // implementing the methods of the |View| mojom interface. | 23 // implementing the methods of the |View| mojom interface. |
| 25 // | 24 // |
| 26 // It is not necessary to use this class to implement all Views. | 25 // It is not necessary to use this class to implement all Views. |
| 27 // This class is merely intended to make the simple apps easier to write. | 26 // This class is merely intended to make the simple apps easier to write. |
| 28 class BaseView : public mojo::ui::View { | 27 class BaseView : public mojo::ui::View { |
| 29 public: | 28 public: |
| 30 // TODO(jeffbrown): Consider switching this over to an ApplicationConnector | 29 // TODO(jeffbrown): Consider switching this over to an ApplicationConnector |
| 31 // but having ApplicationImpl is handy for simple examples. | 30 // but having ApplicationImpl is handy for simple examples. |
| 32 BaseView( | 31 BaseView(mojo::ApplicationImpl* app_impl, |
| 33 mojo::ApplicationImpl* app_impl, | 32 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, |
| 34 const std::string& label, | 33 const std::string& label); |
| 35 const mojo::ui::ViewProvider::CreateViewCallback& create_view_callback); | |
| 36 | 34 |
| 37 ~BaseView() override; | 35 ~BaseView() override; |
| 38 | 36 |
| 39 // Gets the application implementation object provided at creation time. | 37 // Gets the application implementation object provided at creation time. |
| 40 mojo::ApplicationImpl* app_impl() { return app_impl_; } | 38 mojo::ApplicationImpl* app_impl() { return app_impl_; } |
| 41 | 39 |
| 42 // Gets the view manager. | 40 // Gets the view manager. |
| 43 mojo::ui::ViewManager* view_manager() { return view_manager_.get(); } | 41 mojo::ui::ViewManager* view_manager() { return view_manager_.get(); } |
| 44 | 42 |
| 45 // Gets the view host for the view. | 43 // Gets the view host for the view. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 71 mojo::ServiceProviderPtr view_service_provider_; | 69 mojo::ServiceProviderPtr view_service_provider_; |
| 72 mojo::gfx::composition::ScenePtr scene_; | 70 mojo::gfx::composition::ScenePtr scene_; |
| 73 | 71 |
| 74 MOJO_DISALLOW_COPY_AND_ASSIGN(BaseView); | 72 MOJO_DISALLOW_COPY_AND_ASSIGN(BaseView); |
| 75 }; | 73 }; |
| 76 | 74 |
| 77 } // namespace ui | 75 } // namespace ui |
| 78 } // namespace mojo | 76 } // namespace mojo |
| 79 | 77 |
| 80 #endif // MOJO_UI_BASE_VIEW_H_ | 78 #endif // MOJO_UI_BASE_VIEW_H_ |
| OLD | NEW |