Chromium Code Reviews| Index: mojo/services/view_manager/public/cpp/lib/view.cc |
| diff --git a/mojo/services/view_manager/public/cpp/lib/view.cc b/mojo/services/view_manager/public/cpp/lib/view.cc |
| index c07edebd2f9e05a8ba746d76124043126b2995de..f7e77844ce9cfbd191051b8594da239aa3b71cce 100644 |
| --- a/mojo/services/view_manager/public/cpp/lib/view.cc |
| +++ b/mojo/services/view_manager/public/cpp/lib/view.cc |
| @@ -382,10 +382,20 @@ void View::Embed(const String& url, |
| //////////////////////////////////////////////////////////////////////////////// |
| // View, protected: |
| +namespace { |
| + |
| +ViewportMetricsPtr CreateEmptyViewportMetrics() { |
|
eseidel
2015/01/27 22:46:58
This is unfortunate, but makes it so the caller ne
|
| + ViewportMetricsPtr metrics = ViewportMetrics::New(); |
| + metrics->size = Size::New(); |
| + return metrics; |
| +} |
| +} |
| + |
| View::View() |
| : manager_(NULL), |
| id_(static_cast<Id>(-1)), |
| parent_(NULL), |
| + viewport_metrics_(CreateEmptyViewportMetrics()), |
| visible_(true), |
| drawn_(false) { |
| } |
| @@ -425,6 +435,7 @@ View::View(ViewManager* manager, Id id) |
| : manager_(manager), |
| id_(id), |
| parent_(nullptr), |
| + viewport_metrics_(CreateEmptyViewportMetrics()), |
| visible_(false), |
| drawn_(false) { |
| } |
| @@ -489,6 +500,15 @@ void View::LocalSetBounds(const Rect& old_bounds, |
| bounds_ = new_bounds; |
| } |
| +void View::LocalSetViewportMetrics(const ViewportMetrics& old_metrics, |
| + const ViewportMetrics& new_metrics) { |
| + // TODO(eseidel): We could check old_metrics against viewport_metrics_. |
|
eseidel
2015/01/27 22:46:58
I tried, but wasn't able to get them to pass.
|
| + viewport_metrics_ = new_metrics.Clone(); |
| + FOR_EACH_OBSERVER( |
| + ViewObserver, observers_, |
| + OnViewViewportMetricsChanged(this, old_metrics, new_metrics)); |
| +} |
| + |
| void View::LocalSetDrawn(bool value) { |
| if (drawn_ == value) |
| return; |