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

Side by Side Diff: examples/ui/tile/tile_view.h

Issue 1425543002: mozart: Add a simple tiling view manager. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: apply review comments Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef EXAMPLES_UI_TILE_TILE_VIEW_H_
6 #define EXAMPLES_UI_TILE_TILE_VIEW_H_
7
8 #include <map>
9 #include <memory>
10
11 #include "base/bind.h"
12 #include "base/memory/weak_ptr.h"
13 #include "mojo/public/cpp/application/application_impl.h"
14 #include "mojo/public/cpp/bindings/strong_binding.h"
15 #include "mojo/public/cpp/environment/environment.h"
16 #include "mojo/public/cpp/system/core.h"
17 #include "mojo/public/cpp/system/macros.h"
18 #include "mojo/services/geometry/interfaces/geometry.mojom.h"
19 #include "mojo/services/surfaces/interfaces/surfaces.mojom.h"
20 #include "mojo/services/ui/views/interfaces/view_manager.mojom.h"
21 #include "mojo/services/ui/views/interfaces/view_provider.mojom.h"
22 #include "mojo/services/ui/views/interfaces/views.mojom.h"
23
24 namespace examples {
25
26 class TileView : public mojo::ui::View {
27 public:
28 TileView(mojo::ApplicationImpl* app_impl_,
29 const std::vector<std::string>& view_urls,
30 const mojo::ui::ViewProvider::CreateViewCallback& callback);
31
32 ~TileView() override;
33
34 private:
35 class ViewData {
36 public:
37 ViewData(const std::string& url);
jamesr 2015/10/27 22:58:27 explicit
jeffbrown 2015/10/27 23:24:19 Done.
38 ~ViewData();
39
40 const std::string& url() const { return url_; }
41
42 bool layout_pending;
jamesr 2015/10/27 22:58:27 general style is to either be a struct with public
jeffbrown 2015/10/27 23:24:19 Done.
43 mojo::ui::ViewLayoutParamsPtr layout_params;
44 mojo::ui::ViewLayoutInfoPtr layout_info;
45 mojo::Rect layout_bounds;
46
47 private:
48 std::string url_;
49
50 DISALLOW_COPY_AND_ASSIGN(ViewData);
jamesr 2015/10/27 22:58:27 since you have ..Ptr members this won't be copyabl
jeffbrown 2015/10/27 23:24:19 True. Should I state that explicitly or let the c
51 };
52
53 // |View|:
54 void OnLayout(mojo::ui::ViewLayoutParamsPtr layout_params,
55 mojo::Array<uint32_t> children_needing_layout,
56 const OnLayoutCallback& callback) override;
57 void OnChildUnavailable(uint32_t child_key,
58 const OnChildUnavailableCallback& callback) override;
59
60 void OnSurfaceIdNamespaceAvailable(uint32_t id_namespace);
61
62 void InitView();
63 void OnChildConnectionError(uint32_t child_key, const std::string& url);
64 void OnChildCreated(uint32_t child_key,
65 const std::string& url,
66 mojo::ui::ViewProviderPtr provider,
67 mojo::ui::ViewTokenPtr token);
68 void OnChildLayoutFinished(uint32_t child_key,
69 mojo::ui::ViewLayoutInfoPtr child_layout_info);
70 void FinishLayout();
71
72 void OnFrameSubmitted();
73
74 mojo::ApplicationImpl* app_impl_;
75 std::vector<std::string> view_urls_;
76 mojo::ui::ViewProvider::CreateViewCallback callback_;
77 mojo::StrongBinding<mojo::ui::View> binding_;
78
79 mojo::SurfacePtr surfaces_;
80 mojo::SurfaceIdPtr surface_id_;
81 uint32_t surface_id_namespace_;
82
83 mojo::ui::ViewManagerPtr view_manager_;
84 mojo::ui::ViewHostPtr view_host_;
85
86 std::map<uint32_t, std::unique_ptr<ViewData>> views_;
87
88 mojo::Size size_;
89 OnLayoutCallback pending_layout_callback_;
90 uint32_t pending_child_layout_count_;
91 bool frame_pending_;
92
93 base::WeakPtrFactory<TileView> weak_ptr_factory_;
94
95 DISALLOW_COPY_AND_ASSIGN(TileView);
96 };
97
98 } // namespace examples
99
100 #endif // EXAMPLES_UI_TILE_TILE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698