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

Unified Diff: mojo/services/view_manager/public/cpp/lib/view.cc

Issue 880743002: Plumb ViewportMetrics change notifications around the world and back. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix typo Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
+ 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_.
+ 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;
« no previous file with comments | « no previous file | mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698