| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_PRIVATE_H_ | |
| 6 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_PRIVATE_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 | |
| 10 #include "view_manager/public/cpp/view.h" | |
| 11 | |
| 12 namespace mojo { | |
| 13 | |
| 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(); | |
| 20 | |
| 21 // Creates and returns a new View. Caller owns the return value. | |
| 22 static View* LocalCreate(); | |
| 23 | |
| 24 ObserverList<ViewObserver>* observers() { return &view_->observers_; } | |
| 25 | |
| 26 void ClearParent() { view_->parent_ = NULL; } | |
| 27 | |
| 28 void set_visible(bool visible) { view_->visible_ = visible; } | |
| 29 | |
| 30 void set_drawn(bool drawn) { view_->drawn_ = drawn; } | |
| 31 | |
| 32 void set_id(Id id) { view_->id_ = id; } | |
| 33 | |
| 34 void set_view_manager(ViewManager* manager) { | |
| 35 view_->manager_ = manager; | |
| 36 } | |
| 37 | |
| 38 void set_properties(const std::map<std::string, std::vector<uint8_t>>& data) { | |
| 39 view_->properties_ = data; | |
| 40 } | |
| 41 | |
| 42 void LocalSetViewportMetrics(const ViewportMetrics& old_metrics, | |
| 43 const ViewportMetrics& new_metrics) { | |
| 44 view_->LocalSetViewportMetrics(new_metrics, new_metrics); | |
| 45 } | |
| 46 | |
| 47 void LocalDestroy() { | |
| 48 view_->LocalDestroy(); | |
| 49 } | |
| 50 void LocalAddChild(View* child) { | |
| 51 view_->LocalAddChild(child); | |
| 52 } | |
| 53 void LocalRemoveChild(View* child) { | |
| 54 view_->LocalRemoveChild(child); | |
| 55 } | |
| 56 void LocalReorder(View* relative, OrderDirection direction) { | |
| 57 view_->LocalReorder(relative, direction); | |
| 58 } | |
| 59 void LocalSetBounds(const Rect& old_bounds, | |
| 60 const Rect& new_bounds) { | |
| 61 view_->LocalSetBounds(old_bounds, new_bounds); | |
| 62 } | |
| 63 void LocalSetDrawn(bool drawn) { view_->LocalSetDrawn(drawn); } | |
| 64 | |
| 65 private: | |
| 66 View* view_; | |
| 67 | |
| 68 DISALLOW_COPY_AND_ASSIGN(ViewPrivate); | |
| 69 }; | |
| 70 | |
| 71 } // namespace mojo | |
| 72 | |
| 73 #endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_PRIVATE_H_ | |
| OLD | NEW |