summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/login/webui_login_display_host.cc2
-rw-r--r--chrome/browser/ui/views/aura/status_area_host_aura.cc2
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc3
-rw-r--r--ui/aura/desktop.cc2
-rw-r--r--ui/aura/window.cc38
-rw-r--r--ui/aura/window.h5
-rw-r--r--ui/aura_shell/desktop_background_view.cc2
-rw-r--r--ui/aura_shell/examples/lock_view.cc2
-rw-r--r--ui/aura_shell/examples/toplevel_window.cc2
-rw-r--r--ui/aura_shell/examples/widgets.cc2
-rw-r--r--ui/aura_shell/examples/window_type_launcher.cc6
-rw-r--r--ui/aura_shell/launcher/launcher.cc2
-rw-r--r--ui/aura_shell/modal_container_layout_manager.cc2
-rw-r--r--ui/aura_shell/shell_accelerator_controller.cc10
-rw-r--r--ui/aura_shell/status_area_view.cc2
15 files changed, 55 insertions, 27 deletions
diff --git a/chrome/browser/chromeos/login/webui_login_display_host.cc b/chrome/browser/chromeos/login/webui_login_display_host.cc
index e0d4298..60dc6c2 100644
--- a/chrome/browser/chromeos/login/webui_login_display_host.cc
+++ b/chrome/browser/chromeos/login/webui_login_display_host.cc
@@ -139,7 +139,7 @@ void WebUILoginDisplayHost::LoadURL(const GURL& url) {
login_window_->Show();
#if defined(USE_AURA)
- login_window_->GetNativeView()->set_name("WebUILoginView");
+ login_window_->GetNativeView()->SetName("WebUILoginView");
#endif
login_view_->OnWindowCreated();
}
diff --git a/chrome/browser/ui/views/aura/status_area_host_aura.cc b/chrome/browser/ui/views/aura/status_area_host_aura.cc
index 7daad39..24be266 100644
--- a/chrome/browser/ui/views/aura/status_area_host_aura.cc
+++ b/chrome/browser/ui/views/aura/status_area_host_aura.cc
@@ -74,7 +74,7 @@ views::Widget* StatusAreaHostAura::CreateStatusArea() {
status_area_widget_->Init(params);
status_area_widget_->SetContentsView(status_area_view_);
status_area_widget_->Show();
- status_area_widget_->GetNativeView()->set_name("StatusAreaView");
+ status_area_widget_->GetNativeView()->SetName("StatusAreaView");
return status_area_widget_;
}
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 101581d..8c4288a 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -106,6 +106,7 @@ RenderWidgetHostViewAura::~RenderWidgetHostViewAura() {
void RenderWidgetHostViewAura::InitAsChild() {
window_->Init(ui::Layer::LAYER_HAS_TEXTURE);
+ window_->SetName("RenderWidgetHostViewAura");
}
////////////////////////////////////////////////////////////////////////////////
@@ -118,6 +119,7 @@ void RenderWidgetHostViewAura::InitAsPopup(
static_cast<RenderWidgetHostViewAura*>(parent_host_view);
window_->SetType(aura::WINDOW_TYPE_MENU);
window_->Init(ui::Layer::LAYER_HAS_TEXTURE);
+ window_->SetName("RenderWidgetHostViewAura");
window_->SetParent(NULL);
Show();
@@ -136,6 +138,7 @@ void RenderWidgetHostViewAura::InitAsFullscreen(
is_fullscreen_ = true;
window_->SetType(aura::WINDOW_TYPE_NORMAL);
window_->Init(ui::Layer::LAYER_HAS_TEXTURE);
+ window_->SetName("RenderWidgetHostViewAura");
window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
window_->SetParent(NULL);
Show();
diff --git a/ui/aura/desktop.cc b/ui/aura/desktop.cc
index fd2e38a..38818e6 100644
--- a/ui/aura/desktop.cc
+++ b/ui/aura/desktop.cc
@@ -410,7 +410,7 @@ Desktop::Desktop()
mouse_moved_handler_(NULL),
focused_window_(NULL),
touch_event_handler_(NULL) {
- set_name("RootWindow");
+ SetName("RootWindow");
gfx::Screen::SetInstance(screen_);
host_->SetDesktop(this);
last_mouse_location_ = host_->QueryMouseLocation();
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
diff --git a/ui/aura/window.h b/ui/aura/window.h
index 5392af2..6fa3adc 100644
--- a/ui/aura/window.h
+++ b/ui/aura/window.h
@@ -64,7 +64,7 @@ class AURA_EXPORT Window : public ui::LayerDelegate {
void set_id(int id) { id_ = id; }
const std::string& name() const { return name_; }
- void set_name(const std::string& name) { name_ = name; }
+ void SetName(const std::string& name);
const string16 title() const { return title_; }
void set_title(const string16& title) { title_ = title; }
@@ -304,6 +304,9 @@ class AURA_EXPORT Window : public ui::LayerDelegate {
// Overridden from ui::LayerDelegate:
virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE;
+ // Updates the layer name with a name based on the window's name and id.
+ void UpdateLayerName(const std::string& name);
+
WindowType type_;
WindowDelegate* delegate_;
diff --git a/ui/aura_shell/desktop_background_view.cc b/ui/aura_shell/desktop_background_view.cc
index 3f26f36..25532bb 100644
--- a/ui/aura_shell/desktop_background_view.cc
+++ b/ui/aura_shell/desktop_background_view.cc
@@ -55,7 +55,7 @@ views::Widget* CreateDesktopBackground() {
AddChild(desktop_widget->GetNativeView());
desktop_widget->SetContentsView(view);
desktop_widget->Show();
- desktop_widget->GetNativeView()->set_name("DesktopBackgroundView");
+ desktop_widget->GetNativeView()->SetName("DesktopBackgroundView");
return desktop_widget;
}
diff --git a/ui/aura_shell/examples/lock_view.cc b/ui/aura_shell/examples/lock_view.cc
index 68bb333..9929d16 100644
--- a/ui/aura_shell/examples/lock_view.cc
+++ b/ui/aura_shell/examples/lock_view.cc
@@ -65,7 +65,7 @@ void CreateLockScreen() {
AddChild(widget->GetNativeView());
widget->SetContentsView(lock_view);
widget->Show();
- widget->GetNativeView()->set_name("LockView");
+ widget->GetNativeView()->SetName("LockView");
}
} // namespace examples
diff --git a/ui/aura_shell/examples/toplevel_window.cc b/ui/aura_shell/examples/toplevel_window.cc
index f823c77..ade333a 100644
--- a/ui/aura_shell/examples/toplevel_window.cc
+++ b/ui/aura_shell/examples/toplevel_window.cc
@@ -23,7 +23,7 @@ void ToplevelWindow::CreateToplevelWindow(const CreateParams& params) {
views::Widget* widget =
views::Widget::CreateWindowWithBounds(new ToplevelWindow(params),
gfx::Rect(120, 150, 400, 300));
- widget->GetNativeView()->set_name("Examples:ToplevelWindow");
+ widget->GetNativeView()->SetName("Examples:ToplevelWindow");
widget->Show();
}
diff --git a/ui/aura_shell/examples/widgets.cc b/ui/aura_shell/examples/widgets.cc
index 73f55f3..9c4b52b 100644
--- a/ui/aura_shell/examples/widgets.cc
+++ b/ui/aura_shell/examples/widgets.cc
@@ -135,7 +135,7 @@ void CreateWidgetsWindow() {
gfx::Rect bounds(kWindowLeft, kWindowTop, kWindowWidth, kWindowHeight);
views::Widget* widget =
views::Widget::CreateWindowWithBounds(new WidgetsWindow, bounds);
- widget->GetNativeView()->set_name("WidgetsWindow");
+ widget->GetNativeView()->SetName("WidgetsWindow");
widget->Show();
}
diff --git a/ui/aura_shell/examples/window_type_launcher.cc b/ui/aura_shell/examples/window_type_launcher.cc
index 4573e0c..395f614 100644
--- a/ui/aura_shell/examples/window_type_launcher.cc
+++ b/ui/aura_shell/examples/window_type_launcher.cc
@@ -49,7 +49,7 @@ class ModalWindow : public views::WidgetDelegateView,
static void OpenModalWindow(aura::Window* parent) {
views::Widget* widget =
views::Widget::CreateWindowWithParent(new ModalWindow, parent);
- widget->GetNativeView()->set_name("ModalWindow");
+ widget->GetNativeView()->SetName("ModalWindow");
widget->Show();
}
@@ -108,7 +108,7 @@ class NonModalTransient : public views::WidgetDelegateView {
static void OpenNonModalTransient(aura::Window* parent) {
views::Widget* widget =
views::Widget::CreateWindowWithParent(new NonModalTransient, parent);
- widget->GetNativeView()->set_name("NonModalTransient");
+ widget->GetNativeView()->SetName("NonModalTransient");
widget->Show();
}
@@ -143,7 +143,7 @@ void InitWindowTypeLauncher() {
views::Widget* widget =
views::Widget::CreateWindowWithBounds(new WindowTypeLauncher,
gfx::Rect(120, 150, 400, 300));
- widget->GetNativeView()->set_name("WindowTypeLauncher");
+ widget->GetNativeView()->SetName("WindowTypeLauncher");
widget->Show();
}
diff --git a/ui/aura_shell/launcher/launcher.cc b/ui/aura_shell/launcher/launcher.cc
index 64a6c88..8b0ae38 100644
--- a/ui/aura_shell/launcher/launcher.cc
+++ b/ui/aura_shell/launcher/launcher.cc
@@ -38,7 +38,7 @@ Launcher::Launcher(aura::Window* window_container)
widget_->SetBounds(gfx::Rect(0, 0, pref.width(), pref.height()));
widget_->SetContentsView(launcher_view);
widget_->Show();
- widget_->GetNativeView()->set_name("LauncherView");
+ widget_->GetNativeView()->SetName("LauncherView");
}
Launcher::~Launcher() {
diff --git a/ui/aura_shell/modal_container_layout_manager.cc b/ui/aura_shell/modal_container_layout_manager.cc
index 7410a23..3b94903 100644
--- a/ui/aura_shell/modal_container_layout_manager.cc
+++ b/ui/aura_shell/modal_container_layout_manager.cc
@@ -160,7 +160,7 @@ void ModalContainerLayoutManager::CreateModalScreen() {
params.bounds = gfx::Rect(0, 0, container_->bounds().width(),
container_->bounds().height());
modal_screen_->Init(params);
- modal_screen_->GetNativeView()->set_name(
+ modal_screen_->GetNativeView()->SetName(
"ModalContainerLayoutManager.ModalScreen");
modal_screen_->SetContentsView(new ScreenView);
modal_screen_->GetNativeView()->layer()->SetOpacity(0.0f);
diff --git a/ui/aura_shell/shell_accelerator_controller.cc b/ui/aura_shell/shell_accelerator_controller.cc
index b381086..cc4a6ac 100644
--- a/ui/aura_shell/shell_accelerator_controller.cc
+++ b/ui/aura_shell/shell_accelerator_controller.cc
@@ -10,6 +10,7 @@
#include "ui/aura_shell/shell.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/accelerators/accelerator_manager.h"
+#include "ui/gfx/compositor/debug_utils.h"
#include "ui/gfx/compositor/layer_animation_sequence.h"
#include "ui/gfx/compositor/layer_animator.h"
#include "ui/gfx/compositor/screen_rotation.h"
@@ -22,6 +23,7 @@ enum AcceleratorAction {
TAKE_SCREENSHOT,
#if !defined(NDEBUG)
ROTATE_SCREEN,
+ PRINT_LAYER_HIERARCHY,
TOGGLE_DESKTOP_FULL_SCREEN,
#endif
};
@@ -41,6 +43,7 @@ struct AcceleratorData {
#if !defined(NDEBUG)
{ ui::VKEY_HOME, false, true, false, ROTATE_SCREEN },
{ ui::VKEY_F11, false, true, false, TOGGLE_DESKTOP_FULL_SCREEN },
+ { ui::VKEY_L, false, false, true, PRINT_LAYER_HIERARCHY },
#endif
};
@@ -98,6 +101,11 @@ bool HandleToggleDesktopFullScreen() {
aura::Desktop::GetInstance()->ToggleFullScreen();
return true;
}
+
+bool HandlePrintLayerHierarchy() {
+ ui::PrintLayerHierarchy(aura::Desktop::GetInstance()->layer());
+ return true;
+}
#endif
} // namespace
@@ -168,6 +176,8 @@ bool ShellAcceleratorController::AcceleratorPressed(
return HandleRotateScreen();
case TOGGLE_DESKTOP_FULL_SCREEN:
return HandleToggleDesktopFullScreen();
+ case PRINT_LAYER_HIERARCHY:
+ return HandlePrintLayerHierarchy();
#endif
default:
NOTREACHED() << "Unhandled action " << it->second;;
diff --git a/ui/aura_shell/status_area_view.cc b/ui/aura_shell/status_area_view.cc
index 94d73ab..af95c3a 100644
--- a/ui/aura_shell/status_area_view.cc
+++ b/ui/aura_shell/status_area_view.cc
@@ -45,7 +45,7 @@ AURA_SHELL_EXPORT views::Widget* CreateStatusArea() {
widget->Init(params);
widget->SetContentsView(status_area_view);
widget->Show();
- widget->GetNativeView()->set_name("StatusAreaView");
+ widget->GetNativeView()->SetName("StatusAreaView");
return widget;
}