| 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/common/shelf/wm_shelf.h" | 5 #include "ash/common/shelf/wm_shelf.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_delegate.h" | 8 #include "ash/common/shelf/shelf_delegate.h" |
| 9 #include "ash/common/shelf/shelf_layout_manager.h" | 9 #include "ash/common/shelf/shelf_layout_manager.h" |
| 10 #include "ash/common/shelf/shelf_locking_manager.h" | 10 #include "ash/common/shelf/shelf_locking_manager.h" |
| 11 #include "ash/common/shelf/shelf_model.h" | 11 #include "ash/common/shelf/shelf_model.h" |
| 12 #include "ash/common/shelf/shelf_widget.h" | 12 #include "ash/common/shelf/shelf_widget.h" |
| 13 #include "ash/common/shelf/wm_shelf_observer.h" | 13 #include "ash/common/shelf/wm_shelf_observer.h" |
| 14 #include "ash/common/system/tray/system_tray_delegate.h" | 14 #include "ash/common/system/tray/system_tray_delegate.h" |
| 15 #include "ash/common/wm_shell.h" | 15 #include "ash/common/wm_shell.h" |
| 16 #include "ash/common/wm_window.h" | 16 #include "ash/common/wm_window.h" |
| 17 #include "ash/public/cpp/shelf_item_delegate.h" |
| 17 #include "ash/public/cpp/shell_window_ids.h" | 18 #include "ash/public/cpp/shell_window_ids.h" |
| 18 #include "ash/public/interfaces/shelf.mojom.h" | |
| 19 #include "ash/root_window_controller.h" | 19 #include "ash/root_window_controller.h" |
| 20 #include "ash/shelf/shelf_bezel_event_handler.h" | 20 #include "ash/shelf/shelf_bezel_event_handler.h" |
| 21 #include "ash/shell.h" | 21 #include "ash/shell.h" |
| 22 #include "base/logging.h" | 22 #include "base/logging.h" |
| 23 #include "base/memory/ptr_util.h" | 23 #include "base/memory/ptr_util.h" |
| 24 #include "ui/display/types/display_constants.h" | 24 #include "ui/display/types/display_constants.h" |
| 25 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
| 26 | 26 |
| 27 namespace ash { | 27 namespace ash { |
| 28 | 28 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 if (found_index >= 0 && (indexes_left == -1 || item_index < 0)) { | 292 if (found_index >= 0 && (indexes_left == -1 || item_index < 0)) { |
| 293 // Then set this one as active (or advance to the next item of its kind). | 293 // Then set this one as active (or advance to the next item of its kind). |
| 294 ActivateShelfItem(found_index); | 294 ActivateShelfItem(found_index); |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 // static | 298 // static |
| 299 void WmShelf::ActivateShelfItem(int item_index) { | 299 void WmShelf::ActivateShelfItem(int item_index) { |
| 300 ShelfModel* shelf_model = Shell::Get()->shelf_model(); | 300 ShelfModel* shelf_model = Shell::Get()->shelf_model(); |
| 301 const ShelfItem& item = shelf_model->items()[item_index]; | 301 const ShelfItem& item = shelf_model->items()[item_index]; |
| 302 mojom::ShelfItemDelegate* item_delegate = | 302 ShelfItemDelegate* item_delegate = shelf_model->GetShelfItemDelegate(item.id); |
| 303 shelf_model->GetShelfItemDelegate(item.id); | |
| 304 std::unique_ptr<ui::Event> event = base::MakeUnique<ui::KeyEvent>( | 303 std::unique_ptr<ui::Event> event = base::MakeUnique<ui::KeyEvent>( |
| 305 ui::ET_KEY_RELEASED, ui::VKEY_UNKNOWN, ui::EF_NONE); | 304 ui::ET_KEY_RELEASED, ui::VKEY_UNKNOWN, ui::EF_NONE); |
| 306 item_delegate->ItemSelected(std::move(event), display::kInvalidDisplayId, | 305 item_delegate->ItemSelected(std::move(event), display::kInvalidDisplayId, |
| 307 LAUNCH_FROM_UNKNOWN, base::Bind(&NoopCallback)); | 306 LAUNCH_FROM_UNKNOWN, base::Bind(&NoopCallback)); |
| 308 } | 307 } |
| 309 | 308 |
| 310 bool WmShelf::ProcessGestureEvent(const ui::GestureEvent& event) { | 309 bool WmShelf::ProcessGestureEvent(const ui::GestureEvent& event) { |
| 311 // Can be called at login screen. | 310 // Can be called at login screen. |
| 312 if (!shelf_layout_manager_) | 311 if (!shelf_layout_manager_) |
| 313 return false; | 312 return false; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 375 |
| 377 void WmShelf::OnBackgroundUpdated(ShelfBackgroundType background_type, | 376 void WmShelf::OnBackgroundUpdated(ShelfBackgroundType background_type, |
| 378 AnimationChangeType change_type) { | 377 AnimationChangeType change_type) { |
| 379 if (background_type == GetBackgroundType()) | 378 if (background_type == GetBackgroundType()) |
| 380 return; | 379 return; |
| 381 for (auto& observer : observers_) | 380 for (auto& observer : observers_) |
| 382 observer.OnBackgroundTypeChanged(background_type, change_type); | 381 observer.OnBackgroundTypeChanged(background_type, change_type); |
| 383 } | 382 } |
| 384 | 383 |
| 385 } // namespace ash | 384 } // namespace ash |
| OLD | NEW |