summaryrefslogtreecommitdiffstats
path: root/ui/aura/window.cc
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 20:52:01 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 20:52:01 +0000
commitc912c08abb9332a9fd9a2d8a17563fefa0a23b7d (patch)
treec98c8e7da1f4920633ed691ae59af2b740f25d8e /ui/aura/window.cc
parentdf3fb512f19d28c2803d4b1d6b6c66143581492b (diff)
downloadchromium_src-c912c08abb9332a9fd9a2d8a17563fefa0a23b7d.zip
chromium_src-c912c08abb9332a9fd9a2d8a17563fefa0a23b7d.tar.gz
chromium_src-c912c08abb9332a9fd9a2d8a17563fefa0a23b7d.tar.bz2
Added hotkey support to 8508009
Alt-L (print layer tree) Added name in RenderWidgetHostViewAura Made Window::SetName update the layer name. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=112232 Review URL: http://codereview.chromium.org/8585007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112528 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/window.cc')
-rw-r--r--ui/aura/window.cc38
1 files changed, 25 insertions, 13 deletions
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 915623b..d54a67e 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -78,19 +78,7 @@ void Window::Init(ui::Layer::LayerType layer_type) {
layer_.reset(new ui::Layer(layer_type));
layer_->SetVisible(false);
layer_->set_delegate(this);
-
-#if !defined(NDEBUG)
- std::string layer_name(name_);
- if (layer_name.empty())
- layer_name.append("Unnamed Window");
-
- if (id_ != -1) {
- char id_buf[10];
- base::snprintf(id_buf, sizeof(id_buf), " %d", id_);
- layer_name.append(id_buf);
- }
- layer_->set_name(layer_name);
-#endif
+ UpdateLayerName(name_);
Desktop::GetInstance()->WindowInitialized(this);
}
@@ -101,6 +89,13 @@ void Window::SetType(WindowType type) {
type_ = type;
}
+void Window::SetName(const std::string& name) {
+ name_ = name;
+
+ if (layer())
+ UpdateLayerName(name_);
+}
+
void Window::Show() {
SetVisible(true);
}
@@ -560,4 +555,21 @@ void Window::OnPaintLayer(gfx::Canvas* canvas) {
delegate_->OnPaint(canvas);
}
+void Window::UpdateLayerName(const std::string& name) {
+#if !defined(NDEBUG)
+ DCHECK(layer());
+
+ std::string layer_name(name_);
+ if (layer_name.empty())
+ layer_name.append("Unnamed Window");
+
+ if (id_ != -1) {
+ char id_buf[10];
+ base::snprintf(id_buf, sizeof(id_buf), " %d", id_);
+ layer_name.append(id_buf);
+ }
+ layer()->set_name(layer_name);
+#endif
+}
+
} // namespace aura