| Index: ash/common/shelf/shelf_window_watcher_item_delegate.cc
 | 
| diff --git a/ash/common/shelf/shelf_window_watcher_item_delegate.cc b/ash/common/shelf/shelf_window_watcher_item_delegate.cc
 | 
| index a1450e171d42059cb1f0af117e2f9180ea446c36..e1dc5ce981de3c3e9c73dd2cfb52166d0bb460d0 100644
 | 
| --- a/ash/common/shelf/shelf_window_watcher_item_delegate.cc
 | 
| +++ b/ash/common/shelf/shelf_window_watcher_item_delegate.cc
 | 
| @@ -4,18 +4,44 @@
 | 
|  
 | 
|  #include "ash/common/shelf/shelf_window_watcher_item_delegate.h"
 | 
|  
 | 
| +#include "ash/common/shelf/shelf_controller.h"
 | 
| +#include "ash/common/shelf/shelf_model.h"
 | 
| +#include "ash/common/wm/window_state.h"
 | 
| +#include "ash/common/wm_shell.h"
 | 
|  #include "ash/common/wm_window.h"
 | 
|  #include "ui/events/event.h"
 | 
|  
 | 
|  namespace ash {
 | 
|  
 | 
| -ShelfWindowWatcherItemDelegate::ShelfWindowWatcherItemDelegate(WmWindow* window)
 | 
| -    : window_(window) {}
 | 
| +namespace {
 | 
| +
 | 
| +ShelfItemType GetShelfItemType(ShelfID id) {
 | 
| +  ShelfModel* model = WmShell::Get()->shelf_controller()->model();
 | 
| +  ShelfItems::const_iterator item = model->ItemByID(id);
 | 
| +  return item == model->items().end() ? TYPE_UNDEFINED : item->type;
 | 
| +}
 | 
| +
 | 
| +}  // namespace
 | 
| +
 | 
| +ShelfWindowWatcherItemDelegate::ShelfWindowWatcherItemDelegate(ShelfID id,
 | 
| +                                                               WmWindow* window)
 | 
| +    : id_(id), window_(window) {
 | 
| +  DCHECK_NE(kInvalidShelfID, id_);
 | 
| +  DCHECK(window_);
 | 
| +}
 | 
|  
 | 
|  ShelfWindowWatcherItemDelegate::~ShelfWindowWatcherItemDelegate() {}
 | 
|  
 | 
|  ShelfItemDelegate::PerformedAction ShelfWindowWatcherItemDelegate::ItemSelected(
 | 
|      const ui::Event& event) {
 | 
| +  // Move panels attached on another display to the current display.
 | 
| +  if (GetShelfItemType(id_) == TYPE_APP_PANEL &&
 | 
| +      window_->GetWindowState()->panel_attached() &&
 | 
| +      window_->MoveToEventRoot(event)) {
 | 
| +    window_->Activate();
 | 
| +    return kExistingWindowActivated;
 | 
| +  }
 | 
| +
 | 
|    if (window_->IsActive()) {
 | 
|      if (event.type() & ui::ET_KEY_RELEASED) {
 | 
|        window_->Animate(::wm::WINDOW_ANIMATION_TYPE_BOUNCE);
 | 
| @@ -42,11 +68,13 @@ bool ShelfWindowWatcherItemDelegate::IsDraggable() {
 | 
|  }
 | 
|  
 | 
|  bool ShelfWindowWatcherItemDelegate::CanPin() const {
 | 
| -  return true;
 | 
| +  return GetShelfItemType(id_) != TYPE_APP_PANEL;
 | 
|  }
 | 
|  
 | 
|  bool ShelfWindowWatcherItemDelegate::ShouldShowTooltip() {
 | 
| -  return true;
 | 
| +  // Do not show tooltips for visible attached app panel windows.
 | 
| +  return GetShelfItemType(id_) != TYPE_APP_PANEL || !window_->IsVisible() ||
 | 
| +         !window_->GetWindowState()->panel_attached();
 | 
|  }
 | 
|  
 | 
|  void ShelfWindowWatcherItemDelegate::Close() {
 | 
| 
 |