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/shelf/shelf.h" | 5 #include "ash/shelf/shelf.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "ash/aura/wm_window_aura.h" | 10 #include "ash/aura/wm_window_aura.h" |
11 #include "ash/common/shelf/shelf_item_delegate.h" | 11 #include "ash/common/shelf/shelf_item_delegate.h" |
12 #include "ash/common/shelf/shelf_item_delegate_manager.h" | |
13 #include "ash/common/shelf/shelf_model.h" | 12 #include "ash/common/shelf/shelf_model.h" |
14 #include "ash/common/shelf/shelf_navigator.h" | 13 #include "ash/common/shelf/shelf_navigator.h" |
15 #include "ash/common/shelf/wm_shelf_util.h" | 14 #include "ash/common/shelf/wm_shelf_util.h" |
16 #include "ash/common/shell_window_ids.h" | 15 #include "ash/common/shell_window_ids.h" |
17 #include "ash/root_window_controller.h" | 16 #include "ash/root_window_controller.h" |
18 #include "ash/screen_util.h" | 17 #include "ash/screen_util.h" |
19 #include "ash/shelf/shelf_delegate.h" | 18 #include "ash/shelf/shelf_delegate.h" |
20 #include "ash/shelf/shelf_layout_manager.h" | 19 #include "ash/shelf/shelf_layout_manager.h" |
21 #include "ash/shelf/shelf_util.h" | 20 #include "ash/shelf/shelf_util.h" |
22 #include "ash/shelf/shelf_view.h" | 21 #include "ash/shelf/shelf_view.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 131 |
133 void Shelf::ActivateShelfItem(int index) { | 132 void Shelf::ActivateShelfItem(int index) { |
134 // We pass in a keyboard event which will then trigger a switch to the | 133 // We pass in a keyboard event which will then trigger a switch to the |
135 // next item if the current one is already active. | 134 // next item if the current one is already active. |
136 ui::KeyEvent event(ui::ET_KEY_RELEASED, | 135 ui::KeyEvent event(ui::ET_KEY_RELEASED, |
137 ui::VKEY_UNKNOWN, // The actual key gets ignored. | 136 ui::VKEY_UNKNOWN, // The actual key gets ignored. |
138 ui::EF_NONE); | 137 ui::EF_NONE); |
139 | 138 |
140 const ShelfItem& item = shelf_view_->model()->items()[index]; | 139 const ShelfItem& item = shelf_view_->model()->items()[index]; |
141 ShelfItemDelegate* item_delegate = | 140 ShelfItemDelegate* item_delegate = |
142 Shell::GetInstance()->shelf_item_delegate_manager()->GetShelfItemDelegate( | 141 shelf_view_->model()->GetShelfItemDelegate(item.id); |
143 item.id); | |
144 item_delegate->ItemSelected(event); | 142 item_delegate->ItemSelected(event); |
145 } | 143 } |
146 | 144 |
147 void Shelf::CycleWindowLinear(CycleDirection direction) { | 145 void Shelf::CycleWindowLinear(CycleDirection direction) { |
148 int item_index = | 146 int item_index = |
149 GetNextActivatedItemIndex(*(shelf_view_->model()), direction); | 147 GetNextActivatedItemIndex(*(shelf_view_->model()), direction); |
150 if (item_index >= 0) | 148 if (item_index >= 0) |
151 ActivateShelfItem(item_index); | 149 ActivateShelfItem(item_index); |
152 } | 150 } |
153 | 151 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 208 |
211 gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const { | 209 gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const { |
212 return shelf_view_->GetVisibleItemsBoundsInScreen(); | 210 return shelf_view_->GetVisibleItemsBoundsInScreen(); |
213 } | 211 } |
214 | 212 |
215 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() { | 213 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() { |
216 return shelf_view_; | 214 return shelf_view_; |
217 } | 215 } |
218 | 216 |
219 } // namespace ash | 217 } // namespace ash |
OLD | NEW |