Revert of Fix sandbox target in Windows GN build and enable it. (patchset #1 id:1...
[chromium-blink-merge.git] / mojo / services / public / cpp / view_manager / lib / view_private.h
bloba27a963cce2cf8c78871b0606146c746d3db9267
1 // Copyright 2014 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.
5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_PRIVATE_H_
6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_PRIVATE_H_
8 #include "base/basictypes.h"
10 #include "mojo/services/public/cpp/view_manager/view.h"
12 namespace mojo {
14 // This class is a friend of a View and contains functions to mutate internal
15 // state of View.
16 class ViewPrivate {
17 public:
18 explicit ViewPrivate(View* view);
19 ~ViewPrivate();
21 // Creates and returns a new View. Caller owns the return value.
22 static View* LocalCreate();
24 ObserverList<ViewObserver>* observers() { return &view_->observers_; }
26 void ClearParent() { view_->parent_ = NULL; }
28 void set_visible(bool visible) { view_->visible_ = visible; }
30 void set_drawn(bool drawn) { view_->drawn_ = drawn; }
32 void set_id(Id id) { view_->id_ = id; }
34 ViewManager* view_manager() { return view_->manager_; }
35 void set_view_manager(ViewManager* manager) {
36 view_->manager_ = manager;
39 void set_properties(const std::map<std::string, std::vector<uint8_t>>& data) {
40 view_->properties_ = data;
43 void LocalDestroy() {
44 view_->LocalDestroy();
46 void LocalAddChild(View* child) {
47 view_->LocalAddChild(child);
49 void LocalRemoveChild(View* child) {
50 view_->LocalRemoveChild(child);
52 void LocalReorder(View* relative, OrderDirection direction) {
53 view_->LocalReorder(relative, direction);
55 void LocalSetBounds(const Rect& old_bounds,
56 const Rect& new_bounds) {
57 view_->LocalSetBounds(old_bounds, new_bounds);
59 void LocalSetDrawn(bool drawn) { view_->LocalSetDrawn(drawn); }
61 private:
62 View* view_;
64 DISALLOW_COPY_AND_ASSIGN(ViewPrivate);
67 } // namespace mojo
69 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_PRIVATE_H_