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

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

Issue 1679023006: Reify view ownership as a message pipe. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « examples/ui/tile/tile_app.cc ('k') | examples/ui/tile/tile_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 EXAMPLES_UI_TILE_TILE_VIEW_H_ 5 #ifndef EXAMPLES_UI_TILE_TILE_VIEW_H_
6 #define EXAMPLES_UI_TILE_TILE_VIEW_H_ 6 #define EXAMPLES_UI_TILE_TILE_VIEW_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 10
11 #include "mojo/services/ui/views/interfaces/view_provider.mojom.h"
11 #include "mojo/ui/base_view.h" 12 #include "mojo/ui/base_view.h"
12 13
13 namespace examples { 14 namespace examples {
14 15
15 class TileView : public mojo::ui::BaseView { 16 class TileView : public mojo::ui::BaseView {
16 public: 17 public:
17 TileView(mojo::ApplicationImpl* app_impl_, 18 TileView(mojo::ApplicationImpl* app_impl_,
18 const std::vector<std::string>& view_urls, 19 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request,
19 const mojo::ui::ViewProvider::CreateViewCallback& callback); 20 const std::vector<std::string>& view_urls);
20 21
21 ~TileView() override; 22 ~TileView() override;
22 23
23 private: 24 private:
24 struct ViewData { 25 struct ViewData {
25 explicit ViewData(const std::string& url, uint32_t key); 26 explicit ViewData(const std::string& url, uint32_t key);
26 ~ViewData(); 27 ~ViewData();
27 28
28 const std::string url; 29 const std::string url;
29 const uint32_t key; 30 const uint32_t key;
30 31
31 bool layout_pending; 32 bool layout_pending;
32 mojo::ui::ViewLayoutParamsPtr layout_params; 33 mojo::ui::ViewLayoutParamsPtr layout_params;
33 mojo::ui::ViewLayoutInfoPtr layout_info; 34 mojo::ui::ViewLayoutInfoPtr layout_info;
34 mojo::Rect layout_bounds; 35 mojo::Rect layout_bounds;
35 }; 36 };
36 37
37 // |BaseView|: 38 // |BaseView|:
38 void OnLayout(mojo::ui::ViewLayoutParamsPtr layout_params, 39 void OnLayout(mojo::ui::ViewLayoutParamsPtr layout_params,
39 mojo::Array<uint32_t> children_needing_layout, 40 mojo::Array<uint32_t> children_needing_layout,
40 const OnLayoutCallback& callback) override; 41 const OnLayoutCallback& callback) override;
41 void OnChildUnavailable(uint32_t child_key, 42 void OnChildUnavailable(uint32_t child_key,
42 const OnChildUnavailableCallback& callback) override; 43 const OnChildUnavailableCallback& callback) override;
43 44
44 void ConnectViews(); 45 void ConnectViews();
45 void OnChildConnectionError(uint32_t child_key, const std::string& url);
46 void OnChildCreated(uint32_t child_key,
47 const std::string& url,
48 mojo::ui::ViewProviderPtr provider,
49 mojo::ui::ViewTokenPtr token);
50 void OnChildLayoutFinished(uint32_t child_key, 46 void OnChildLayoutFinished(uint32_t child_key,
51 mojo::ui::ViewLayoutInfoPtr child_layout_info); 47 mojo::ui::ViewLayoutInfoPtr child_layout_info);
52 void FinishLayout(); 48 void FinishLayout();
53 49
54 void OnFrameSubmitted(); 50 void OnFrameSubmitted();
55 51
56 std::vector<std::string> view_urls_; 52 std::vector<std::string> view_urls_;
57 std::map<uint32_t, std::unique_ptr<ViewData>> views_; 53 std::map<uint32_t, std::unique_ptr<ViewData>> views_;
58 54
59 mojo::Size size_; 55 mojo::Size size_;
60 OnLayoutCallback pending_layout_callback_; 56 OnLayoutCallback pending_layout_callback_;
61 uint32_t pending_child_layout_count_ = 0u; 57 uint32_t pending_child_layout_count_ = 0u;
62 58
63 DISALLOW_COPY_AND_ASSIGN(TileView); 59 DISALLOW_COPY_AND_ASSIGN(TileView);
64 }; 60 };
65 61
66 } // namespace examples 62 } // namespace examples
67 63
68 #endif // EXAMPLES_UI_TILE_TILE_VIEW_H_ 64 #endif // EXAMPLES_UI_TILE_TILE_VIEW_H_
OLDNEW
« no previous file with comments | « examples/ui/tile/tile_app.cc ('k') | examples/ui/tile/tile_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698