| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/common/shelf/shelf_window_watcher_item_delegate.h" | 5 #include "ash/common/shelf/shelf_window_watcher_item_delegate.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/shelf_controller.h" | 7 #include "ash/common/shelf/shelf_controller.h" |
| 8 #include "ash/common/shelf/shelf_model.h" | 8 #include "ash/common/shelf/shelf_model.h" |
| 9 #include "ash/common/wm/window_state.h" | 9 #include "ash/common/wm/window_state.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| 11 #include "ash/common/wm_window.h" | 11 #include "ash/common/wm_window.h" |
| 12 #include "ash/common/wm_window_property.h" | 12 #include "ash/public/cpp/window_properties.h" |
| 13 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
| 14 #include "ui/aura/window.h" |
| 14 #include "ui/events/event_constants.h" | 15 #include "ui/events/event_constants.h" |
| 15 | 16 |
| 16 namespace ash { | 17 namespace ash { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 ShelfItemType GetShelfItemType(ShelfID id) { | 21 ShelfItemType GetShelfItemType(ShelfID id) { |
| 21 ShelfModel* model = WmShell::Get()->shelf_controller()->model(); | 22 ShelfModel* model = WmShell::Get()->shelf_controller()->model(); |
| 22 ShelfItems::const_iterator item = model->ItemByID(id); | 23 ShelfItems::const_iterator item = model->ItemByID(id); |
| 23 return item == model->items().end() ? TYPE_UNDEFINED : item->type; | 24 return item == model->items().end() ? TYPE_UNDEFINED : item->type; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 | 35 |
| 35 ShelfWindowWatcherItemDelegate::~ShelfWindowWatcherItemDelegate() {} | 36 ShelfWindowWatcherItemDelegate::~ShelfWindowWatcherItemDelegate() {} |
| 36 | 37 |
| 37 ShelfAction ShelfWindowWatcherItemDelegate::ItemSelected( | 38 ShelfAction ShelfWindowWatcherItemDelegate::ItemSelected( |
| 38 ui::EventType event_type, | 39 ui::EventType event_type, |
| 39 int event_flags, | 40 int event_flags, |
| 40 int64_t display_id, | 41 int64_t display_id, |
| 41 ShelfLaunchSource source) { | 42 ShelfLaunchSource source) { |
| 42 // Move panels attached on another display to the current display. | 43 // Move panels attached on another display to the current display. |
| 43 if (GetShelfItemType(id_) == TYPE_APP_PANEL && | 44 if (GetShelfItemType(id_) == TYPE_APP_PANEL && |
| 44 window_->GetBoolProperty(WmWindowProperty::PANEL_ATTACHED) && | 45 window_->aura_window()->GetProperty(kPanelAttachedKey) && |
| 45 wm::MoveWindowToDisplay(window_->aura_window(), display_id)) { | 46 wm::MoveWindowToDisplay(window_->aura_window(), display_id)) { |
| 46 window_->Activate(); | 47 window_->Activate(); |
| 47 return SHELF_ACTION_WINDOW_ACTIVATED; | 48 return SHELF_ACTION_WINDOW_ACTIVATED; |
| 48 } | 49 } |
| 49 | 50 |
| 50 if (window_->IsActive()) { | 51 if (window_->IsActive()) { |
| 51 if (event_type == ui::ET_KEY_RELEASED) { | 52 if (event_type == ui::ET_KEY_RELEASED) { |
| 52 window_->Animate(::wm::WINDOW_ANIMATION_TYPE_BOUNCE); | 53 window_->Animate(::wm::WINDOW_ANIMATION_TYPE_BOUNCE); |
| 53 return SHELF_ACTION_NONE; | 54 return SHELF_ACTION_NONE; |
| 54 } | 55 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 69 int event_flags) { | 70 int event_flags) { |
| 70 // This delegate does not support showing an application menu. | 71 // This delegate does not support showing an application menu. |
| 71 NOTIMPLEMENTED(); | 72 NOTIMPLEMENTED(); |
| 72 } | 73 } |
| 73 | 74 |
| 74 void ShelfWindowWatcherItemDelegate::Close() { | 75 void ShelfWindowWatcherItemDelegate::Close() { |
| 75 window_->CloseWidget(); | 76 window_->CloseWidget(); |
| 76 } | 77 } |
| 77 | 78 |
| 78 } // namespace ash | 79 } // namespace ash |
| OLD | NEW |