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

Side by Side Diff: services/ui/view_manager/view_tree_state.h

Issue 1415493003: mozart: Initial commit of the view manager. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: applied 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 2015 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 SERVICES_UI_VIEW_MANAGER_VIEW_TREE_STATE_H_
6 #define SERVICES_UI_VIEW_MANAGER_VIEW_TREE_STATE_H_
7
8 #include <memory>
9 #include <set>
10 #include <unordered_map>
11
12 #include "base/callback.h"
13 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h"
15 #include "mojo/public/cpp/bindings/binding.h"
16 #include "mojo/services/ui/views/interfaces/view_trees.mojom.h"
17 #include "services/ui/view_manager/view_state.h"
18
19 namespace view_manager {
20
21 // Describes the state of a particular view tree.
22 // This object is owned by the ViewRegistry that created it.
23 class ViewTreeState : public base::SupportsWeakPtr<ViewTreeState> {
jamesr 2015/10/27 23:13:11 ditto re SupportsWeak
jeffbrown 2015/10/28 01:37:29 Done.
24 public:
25 ViewTreeState(mojo::ui::ViewTreePtr view_tree);
jamesr 2015/10/27 23:13:11 explicit
jeffbrown 2015/10/28 01:37:29 Done.
26 ~ViewTreeState();
27
28 // Gets the view tree interface, never null.
29 // Caller does not obtain ownership of the view.
30 mojo::ui::ViewTree* view_tree() const { return view_tree_.get(); }
31
32 // Sets the associated host implementation and takes ownership of it.
33 void set_view_tree_host(mojo::ui::ViewTreeHost* host) {
34 view_tree_host_.reset(host);
35 }
36
37 // Sets the connection error handler for the view.
38 void set_view_tree_connection_error_handler(const base::Closure& handler) {
39 view_tree_.set_connection_error_handler(handler);
40 }
41
42 // Gets the root of the view tree, or null if it is unavailable.
43 ViewState* root() const { return root_; }
44
45 // Sets the root of the view tree. Must not be null.
46 // The view specified as the new root must not have any parents.
47 void SetRoot(ViewState* root, uint32_t key);
48
49 // Resets the root view to null.
50 void ResetRoot();
51
52 // True if the client previously set but has not yet explicitly unset
53 // the root, independent of whether it is currently available.
54 bool root_was_set;
jamesr 2015/10/27 23:13:11 public member
jeffbrown 2015/10/28 01:37:29 Done.
55
56 // True if there is a pending layout request.
57 bool layout_request_pending;
58
59 // True if a layout request has been issued.
60 bool layout_request_issued;
61
62 private:
63 mojo::ui::ViewTreePtr view_tree_;
64 std::unique_ptr<mojo::ui::ViewTreeHost> view_tree_host_;
65
66 ViewState* root_;
67
68 DISALLOW_COPY_AND_ASSIGN(ViewTreeState);
69 };
70
71 } // namespace view_manager
72
73 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_TREE_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698