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

Unified Diff: mojo/services/view_manager/server_view.cc

Issue 745743002: Makes views be initially hidden (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: feedback Created 6 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 side-by-side diff with in-line comments
Download patch
Index: mojo/services/view_manager/server_view.cc
diff --git a/mojo/services/view_manager/server_view.cc b/mojo/services/view_manager/server_view.cc
index 991ab8e0d1f1db3603a852912a86bcbc6585a29a..c741b75ccc1170e472f606a2f71c041cbc0fa375 100644
--- a/mojo/services/view_manager/server_view.cc
+++ b/mojo/services/view_manager/server_view.cc
@@ -4,13 +4,18 @@
#include "mojo/services/view_manager/server_view.h"
+#include "base/strings/stringprintf.h"
#include "mojo/services/view_manager/server_view_delegate.h"
namespace mojo {
namespace service {
ServerView::ServerView(ServerViewDelegate* delegate, const ViewId& id)
- : delegate_(delegate), id_(id), parent_(NULL), visible_(true), opacity_(1) {
+ : delegate_(delegate),
+ id_(id),
+ parent_(nullptr),
+ visible_(false),
+ opacity_(1) {
DCHECK(delegate); // Must provide a delegate.
}
@@ -165,6 +170,25 @@ void ServerView::SetSurfaceId(cc::SurfaceId surface_id) {
delegate_->OnViewSurfaceIdChanged(this);
}
+#if !defined(NDEBUG)
+std::string ServerView::GetDebugWindowHierarchy() const {
+ std::string result;
+ BuildDebugInfo(std::string(), &result);
+ return result;
+}
+
+void ServerView::BuildDebugInfo(const std::string& depth,
+ std::string* result) const {
+ *result += base::StringPrintf(
+ "%sid=%d,%d visible=%s bounds=%d,%d %dx%d surface_id=%ld\n",
+ depth.c_str(), static_cast<int>(id_.connection_id),
+ static_cast<int>(id_.view_id), visible_ ? "true" : "false", bounds_.x(),
+ bounds_.y(), bounds_.width(), bounds_.height(), surface_id_.id);
+ for (const ServerView* child : children_)
+ child->BuildDebugInfo(depth + " ", result);
+}
+#endif
+
void ServerView::RemoveImpl(ServerView* view) {
view->parent_ = NULL;
children_.erase(std::find(children_.begin(), children_.end(), view));
« no previous file with comments | « mojo/services/view_manager/server_view.h ('k') | mojo/services/view_manager/view_manager_service_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698