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

Unified Diff: mojo/ui/base_view.h

Issue 1991853003: Make BaseView et al. take an ApplicationConnector instead of an ApplicationImpl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: doh Created 4 years, 7 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
« no previous file with comments | « mojo/public/cpp/application/lib/connect.cc ('k') | mojo/ui/base_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/ui/base_view.h
diff --git a/mojo/ui/base_view.h b/mojo/ui/base_view.h
index e5fe71c75a9b11ae2fe72cb9e46555731ee61403..a8f2b6910134a0c4b60b68531c70c8585b12143c 100644
--- a/mojo/ui/base_view.h
+++ b/mojo/ui/base_view.h
@@ -7,10 +7,11 @@
#include <string>
-#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/interface_handle.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/cpp/system/macros.h"
+#include "mojo/public/interfaces/application/application_connector.mojom.h"
#include "mojo/public/interfaces/application/service_provider.mojom.h"
#include "mojo/services/gfx/composition/interfaces/scenes.mojom.h"
#include "mojo/services/ui/views/interfaces/view_manager.mojom.h"
@@ -25,55 +26,51 @@ namespace ui {
//
// It is not necessary to use this class to implement all Views.
// This class is merely intended to make the simple apps easier to write.
-class BaseView : public mojo::ui::ViewListener,
- public mojo::ui::ViewContainerListener {
+class BaseView : public ViewListener, public ViewContainerListener {
public:
- // TODO(jeffbrown): Consider switching this over to an ApplicationConnector
- // but having ApplicationImpl is handy for simple examples.
- BaseView(mojo::ApplicationImpl* app_impl,
- mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request,
+ BaseView(InterfaceHandle<ApplicationConnector> app_connector,
+ InterfaceRequest<ViewOwner> view_owner_request,
const std::string& label);
~BaseView() override;
// Gets the application implementation object provided at creation time.
- mojo::ApplicationImpl* app_impl() { return app_impl_; }
+ ApplicationConnector* app_connector() { return app_connector_.get(); }
// Gets the view manager.
- mojo::ui::ViewManager* view_manager() { return view_manager_.get(); }
+ ViewManager* view_manager() { return view_manager_.get(); }
// Gets the underlying view interface.
- mojo::ui::View* view() { return view_.get(); }
+ View* view() { return view_.get(); }
// Gets the service provider for the view.
- mojo::ServiceProvider* GetViewServiceProvider();
+ ServiceProvider* GetViewServiceProvider();
// Gets the underlying view container interface.
- mojo::ui::ViewContainer* GetViewContainer();
+ ViewContainer* GetViewContainer();
// Gets the scene for the view.
// Returns nullptr if the |TakeScene| was called.
- mojo::gfx::composition::Scene* scene() { return scene_.get(); }
+ gfx::composition::Scene* scene() { return scene_.get(); }
// Takes the scene from the view.
// This is useful if the scene will be rendered by a separate component.
- mojo::gfx::composition::ScenePtr TakeScene() { return scene_.Pass(); }
+ gfx::composition::ScenePtr TakeScene() { return scene_.Pass(); }
// Gets the currently requested scene version.
uint32_t scene_version() { return scene_version_; }
// Gets the current view properties.
// Returns nullptr if none.
- mojo::ui::ViewProperties* properties() { return properties_.get(); }
+ ViewProperties* properties() { return properties_.get(); }
// Called when properties changed.
// Use |scene_version()| and |properties()| to get the current values.
virtual void OnPropertiesChanged(uint32_t old_scene_version,
- mojo::ui::ViewPropertiesPtr old_properties);
+ ViewPropertiesPtr old_properties);
// Called when a child is attached.
- virtual void OnChildAttached(uint32_t child_key,
- mojo::ui::ViewInfoPtr child_view_info);
+ virtual void OnChildAttached(uint32_t child_key, ViewInfoPtr child_view_info);
// Called when a child becomes unavailable.
virtual void OnChildUnavailable(uint32_t child_key);
@@ -82,28 +79,27 @@ class BaseView : public mojo::ui::ViewListener,
// |ViewListener|:
void OnPropertiesChanged(
uint32_t scene_version,
- mojo::ui::ViewPropertiesPtr properties,
+ ViewPropertiesPtr properties,
const OnPropertiesChangedCallback& callback) override;
// |ViewContainerListener|:
void OnChildAttached(uint32_t child_key,
- mojo::ui::ViewInfoPtr child_view_info,
+ ViewInfoPtr child_view_info,
const OnChildAttachedCallback& callback) override;
void OnChildUnavailable(uint32_t child_key,
const OnChildUnavailableCallback& callback) override;
- mojo::ApplicationImpl* app_impl_;
-
- mojo::StrongBinding<mojo::ui::ViewListener> view_listener_binding_;
- mojo::Binding<mojo::ui::ViewContainerListener>
- view_container_listener_binding_;
- mojo::ui::ViewManagerPtr view_manager_;
- mojo::ui::ViewPtr view_;
- mojo::ServiceProviderPtr view_service_provider_;
- mojo::ui::ViewContainerPtr view_container_;
- mojo::gfx::composition::ScenePtr scene_;
- uint32_t scene_version_ = mojo::gfx::composition::kSceneVersionNone;
- mojo::ui::ViewPropertiesPtr properties_;
+ ApplicationConnectorPtr app_connector_;
+
+ StrongBinding<ViewListener> view_listener_binding_;
+ Binding<ViewContainerListener> view_container_listener_binding_;
+ ViewManagerPtr view_manager_;
+ ViewPtr view_;
+ ServiceProviderPtr view_service_provider_;
+ ViewContainerPtr view_container_;
+ gfx::composition::ScenePtr scene_;
+ uint32_t scene_version_ = gfx::composition::kSceneVersionNone;
+ ViewPropertiesPtr properties_;
MOJO_DISALLOW_COPY_AND_ASSIGN(BaseView);
};
« no previous file with comments | « mojo/public/cpp/application/lib/connect.cc ('k') | mojo/ui/base_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698