OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shell.h" | 5 #include "ash/shell.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/accelerators/accelerator_controller.h" | 10 #include "ash/accelerators/accelerator_controller.h" |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 launcher_model_.reset(new LauncherModel); | 484 launcher_model_.reset(new LauncherModel); |
485 // Creates LauncherItemDelegateManager before LauncherDelegate. | 485 // Creates LauncherItemDelegateManager before LauncherDelegate. |
486 launcher_item_delegate_manager_.reset( | 486 launcher_item_delegate_manager_.reset( |
487 new LauncherItemDelegateManager(launcher_model_.get())); | 487 new LauncherItemDelegateManager(launcher_model_.get())); |
488 | 488 |
489 launcher_delegate_.reset( | 489 launcher_delegate_.reset( |
490 delegate_->CreateLauncherDelegate(launcher_model_.get())); | 490 delegate_->CreateLauncherDelegate(launcher_model_.get())); |
491 scoped_ptr<LauncherItemDelegate> controller( | 491 scoped_ptr<LauncherItemDelegate> controller( |
492 new internal::AppListShelfItemDelegate); | 492 new internal::AppListShelfItemDelegate); |
493 | 493 |
494 ash::LauncherID app_list_id = 0; | |
495 // TODO(simon.hong81): Make function for this in shelf_util.h | |
496 // Finding the launcher model's location of the app list and setting its | 494 // Finding the launcher model's location of the app list and setting its |
497 // LauncherItemDelegate. | 495 // LauncherItemDelegate. |
498 for (size_t i = 0; i < launcher_model_->items().size(); ++i) { | 496 int app_list_index = |
499 if (launcher_model_->items()[i].type == ash::TYPE_APP_LIST) { | 497 ash::GetLauncherItemIndexForType(ash::TYPE_APP_LIST, *launcher_model_); |
500 app_list_id = launcher_model_->items()[i].id; | 498 DCHECK_GE(app_list_index, 0); |
501 break; | 499 ash::LauncherID app_list_id = launcher_model_->items()[app_list_index].id; |
502 } | |
503 } | |
504 DCHECK(app_list_id); | 500 DCHECK(app_list_id); |
505 launcher_item_delegate_manager_->SetLauncherItemDelegate( | 501 launcher_item_delegate_manager_->SetLauncherItemDelegate( |
506 app_list_id, | 502 app_list_id, |
507 controller.Pass()); | 503 controller.Pass()); |
508 } | 504 } |
509 return launcher_delegate_.get(); | 505 return launcher_delegate_.get(); |
510 } | 506 } |
511 | 507 |
512 void Shell::SetTouchHudProjectionEnabled(bool enabled) { | 508 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
513 if (is_touch_hud_projection_enabled_ == enabled) | 509 if (is_touch_hud_projection_enabled_ == enabled) |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 //////////////////////////////////////////////////////////////////////////////// | 971 //////////////////////////////////////////////////////////////////////////////// |
976 // Shell, aura::client::ActivationChangeObserver implementation: | 972 // Shell, aura::client::ActivationChangeObserver implementation: |
977 | 973 |
978 void Shell::OnWindowActivated(aura::Window* gained_active, | 974 void Shell::OnWindowActivated(aura::Window* gained_active, |
979 aura::Window* lost_active) { | 975 aura::Window* lost_active) { |
980 if (gained_active) | 976 if (gained_active) |
981 target_root_window_ = gained_active->GetRootWindow(); | 977 target_root_window_ = gained_active->GetRootWindow(); |
982 } | 978 } |
983 | 979 |
984 } // namespace ash | 980 } // namespace ash |
OLD | NEW |