Index: ash/launcher/launcher_util.cc |
diff --git a/ash/launcher/launcher_util.cc b/ash/launcher/launcher_util.cc |
index f7ba77f0bfc2f54263a3c9d571358d5e9de95528..f41ac7dce2932ad183cc3c89e6783e73950b0ddc 100644 |
--- a/ash/launcher/launcher_util.cc |
+++ b/ash/launcher/launcher_util.cc |
@@ -6,6 +6,11 @@ |
#include "ash/launcher/launcher_model.h" |
#include "ash/launcher/launcher_types.h" |
+#include "ash/shell.h" |
+#include "ui/aura/client/window_types.h" |
+#include "ui/aura/window.h" |
+#include "ui/views/view.h" |
+#include "ui/views/widget/widget.h" |
namespace ash { |
namespace launcher { |
@@ -18,5 +23,20 @@ int GetBrowserItemIndex(const LauncherModel& launcher_model) { |
return -1; |
} |
+void MoveToEventRootIfPanel(aura::Window* maybe_panel, |
+ const ui::Event& event) { |
+ if (maybe_panel->type() != aura::client::WINDOW_TYPE_PANEL) |
+ return; |
+ views::View* target = static_cast<views::View*>(event.target()); |
+ aura::RootWindow* target_root = |
+ target ? target->GetWidget()->GetNativeView()->GetRootWindow() : NULL; |
+ if (target_root && target_root != maybe_panel->GetRootWindow()) { |
+ aura::Window* panel_container = |
+ ash::Shell::GetContainer(target_root, maybe_panel->parent()->id()); |
+ // Move the panel to the target launcher. |
+ panel_container->AddChild(maybe_panel); |
+ } |
+} |
+ |
} // namespace launcher |
} // namespace ash |