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

Unified Diff: components/mus/ws/server_window.cc

Issue 1953193002: mus: Add debug key to print the server window hierarchy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
Index: components/mus/ws/server_window.cc
diff --git a/components/mus/ws/server_window.cc b/components/mus/ws/server_window.cc
index eeb5d7d44929e0275c949faff176438dcd2b5b56..2dea439196a37f6a2c87b4530228dfe37ab8b45b 100644
--- a/components/mus/ws/server_window.cc
+++ b/components/mus/ws/server_window.cc
@@ -9,6 +9,7 @@
#include "base/strings/stringprintf.h"
#include "components/mus/common/transient_window_utils.h"
+#include "components/mus/public/interfaces/window_manager.mojom.h"
#include "components/mus/ws/server_window_delegate.h"
#include "components/mus/ws/server_window_observer.h"
#include "components/mus/ws/server_window_surface_manager.h"
@@ -345,6 +346,13 @@ void ServerWindow::SetProperty(const std::string& name,
OnWindowSharedPropertyChanged(this, name, value));
}
+std::string ServerWindow::GetName() const {
+ auto it = properties_.find(mojom::WindowManager::kName_Property);
+ if (it == properties_.end())
+ return std::string();
+ return std::string(it->second.begin(), it->second.end());
msw 2016/05/05 22:12:07 nit: use the property_type_converter?
James Cook 2016/05/05 22:53:18 I can't, property_type_converters.cc is in compone
msw 2016/05/05 23:10:06 Nah, I guess this is fine as-is.
+}
+
void ServerWindow::SetTextInputState(const ui::TextInputState& state) {
const bool changed = !(text_input_state_ == state);
if (changed) {
@@ -402,10 +410,10 @@ std::string ServerWindow::GetDebugWindowHierarchy() const {
void ServerWindow::BuildDebugInfo(const std::string& depth,
std::string* result) const {
*result += base::StringPrintf(
- "%sid=%d,%d visible=%s bounds=%d,%d %dx%d" PRIu64 "\n", depth.c_str(),
+ "%sid=%d,%d visible=%s bounds=%d,%d %dx%d %s\n", depth.c_str(),
msw 2016/05/05 22:12:08 nit: maybe name='%s'?
James Cook 2016/05/05 22:53:18 Done.
static_cast<int>(id_.connection_id), static_cast<int>(id_.window_id),
visible_ ? "true" : "false", bounds_.x(), bounds_.y(), bounds_.width(),
- bounds_.height());
+ bounds_.height(), GetName().c_str());
for (const ServerWindow* child : children_)
child->BuildDebugInfo(depth + " ", result);
}

Powered by Google App Engine
This is Rietveld 408576698