OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/wm_shelf.h" | 5 #include "ash/shelf/wm_shelf.h" |
6 | 6 |
7 #include "ash/public/cpp/config.h" | 7 #include "ash/public/cpp/config.h" |
8 #include "ash/public/cpp/shelf_item_delegate.h" | 8 #include "ash/public/cpp/shelf_item_delegate.h" |
9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 // found (which is true when indexes_left is -1) or b.) the last item was | 288 // found (which is true when indexes_left is -1) or b.) the last item was |
289 // requested (which is true when index was passed in as a negative number). | 289 // requested (which is true when index was passed in as a negative number). |
290 if (found_index >= 0 && (indexes_left == -1 || item_index < 0)) { | 290 if (found_index >= 0 && (indexes_left == -1 || item_index < 0)) { |
291 // Then set this one as active (or advance to the next item of its kind). | 291 // Then set this one as active (or advance to the next item of its kind). |
292 ActivateShelfItem(found_index); | 292 ActivateShelfItem(found_index); |
293 } | 293 } |
294 } | 294 } |
295 | 295 |
296 // static | 296 // static |
297 void WmShelf::ActivateShelfItem(int item_index) { | 297 void WmShelf::ActivateShelfItem(int item_index) { |
298 ActivateShelfItemInDisplay(item_index, display::kInvalidDisplayId); | |
299 } | |
300 | |
301 // static | |
302 void WmShelf::ActivateShelfItemInDisplay(int item_index, int64_t display_id) { | |
Mr4D (OOO till 08-26)
2017/05/22 15:02:28
Maybe .. onDisplay which sounds much better here.
weidongg
2017/05/23 16:37:46
Done.
| |
298 ShelfModel* shelf_model = Shell::Get()->shelf_model(); | 303 ShelfModel* shelf_model = Shell::Get()->shelf_model(); |
299 const ShelfItem& item = shelf_model->items()[item_index]; | 304 const ShelfItem& item = shelf_model->items()[item_index]; |
300 ShelfItemDelegate* item_delegate = shelf_model->GetShelfItemDelegate(item.id); | 305 ShelfItemDelegate* item_delegate = shelf_model->GetShelfItemDelegate(item.id); |
301 std::unique_ptr<ui::Event> event = base::MakeUnique<ui::KeyEvent>( | 306 std::unique_ptr<ui::Event> event = base::MakeUnique<ui::KeyEvent>( |
302 ui::ET_KEY_RELEASED, ui::VKEY_UNKNOWN, ui::EF_NONE); | 307 ui::ET_KEY_RELEASED, ui::VKEY_UNKNOWN, ui::EF_NONE); |
303 item_delegate->ItemSelected(std::move(event), display::kInvalidDisplayId, | 308 item_delegate->ItemSelected(std::move(event), display_id, LAUNCH_FROM_UNKNOWN, |
304 LAUNCH_FROM_UNKNOWN, base::Bind(&NoopCallback)); | 309 base::Bind(&NoopCallback)); |
305 } | 310 } |
306 | 311 |
307 bool WmShelf::ProcessGestureEvent(const ui::GestureEvent& event) { | 312 bool WmShelf::ProcessGestureEvent(const ui::GestureEvent& event) { |
308 // Can be called at login screen. | 313 // Can be called at login screen. |
309 if (!shelf_layout_manager_) | 314 if (!shelf_layout_manager_) |
310 return false; | 315 return false; |
311 return shelf_layout_manager_->ProcessGestureEvent(event); | 316 return shelf_layout_manager_->ProcessGestureEvent(event); |
312 } | 317 } |
313 | 318 |
314 void WmShelf::AddObserver(WmShelfObserver* observer) { | 319 void WmShelf::AddObserver(WmShelfObserver* observer) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 | 379 |
375 void WmShelf::OnBackgroundUpdated(ShelfBackgroundType background_type, | 380 void WmShelf::OnBackgroundUpdated(ShelfBackgroundType background_type, |
376 AnimationChangeType change_type) { | 381 AnimationChangeType change_type) { |
377 if (background_type == GetBackgroundType()) | 382 if (background_type == GetBackgroundType()) |
378 return; | 383 return; |
379 for (auto& observer : observers_) | 384 for (auto& observer : observers_) |
380 observer.OnBackgroundTypeChanged(background_type, change_type); | 385 observer.OnBackgroundTypeChanged(background_type, change_type); |
381 } | 386 } |
382 | 387 |
383 } // namespace ash | 388 } // namespace ash |
OLD | NEW |