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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 launcher_model_.reset(new LauncherModel); | 489 launcher_model_.reset(new LauncherModel); |
490 // Creates LauncherItemDelegateManager before LauncherDelegate. | 490 // Creates LauncherItemDelegateManager before LauncherDelegate. |
491 launcher_item_delegate_manager_.reset( | 491 launcher_item_delegate_manager_.reset( |
492 new LauncherItemDelegateManager(launcher_model_.get())); | 492 new LauncherItemDelegateManager(launcher_model_.get())); |
493 | 493 |
494 launcher_delegate_.reset( | 494 launcher_delegate_.reset( |
495 delegate_->CreateLauncherDelegate(launcher_model_.get())); | 495 delegate_->CreateLauncherDelegate(launcher_model_.get())); |
496 scoped_ptr<LauncherItemDelegate> controller( | 496 scoped_ptr<LauncherItemDelegate> controller( |
497 new internal::AppListShelfItemDelegate); | 497 new internal::AppListShelfItemDelegate); |
498 | 498 |
499 ash::LauncherID app_list_id = 0; | |
500 // TODO(simon.hong81): Make function for this in shelf_util.h | |
501 // Finding the launcher model's location of the app list and setting its | 499 // Finding the launcher model's location of the app list and setting its |
502 // LauncherItemDelegate. | 500 // LauncherItemDelegate. |
503 for (size_t i = 0; i < launcher_model_->items().size(); ++i) { | 501 int app_list_index = |
504 if (launcher_model_->items()[i].type == ash::TYPE_APP_LIST) { | 502 ash::GetLauncherItemIndexForType(ash::TYPE_APP_LIST, *launcher_model_); |
505 app_list_id = launcher_model_->items()[i].id; | 503 DCHECK_GE(app_list_index, 0); |
506 break; | 504 ash::LauncherID app_list_id = launcher_model_->items()[app_list_index].id; |
507 } | |
508 } | |
509 DCHECK(app_list_id); | 505 DCHECK(app_list_id); |
510 launcher_item_delegate_manager_->SetLauncherItemDelegate( | 506 launcher_item_delegate_manager_->SetLauncherItemDelegate( |
511 app_list_id, | 507 app_list_id, |
512 controller.Pass()); | 508 controller.Pass()); |
513 } | 509 } |
514 return launcher_delegate_.get(); | 510 return launcher_delegate_.get(); |
515 } | 511 } |
516 | 512 |
517 void Shell::SetTouchHudProjectionEnabled(bool enabled) { | 513 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
518 if (is_touch_hud_projection_enabled_ == enabled) | 514 if (is_touch_hud_projection_enabled_ == enabled) |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 //////////////////////////////////////////////////////////////////////////////// | 1000 //////////////////////////////////////////////////////////////////////////////// |
1005 // Shell, aura::client::ActivationChangeObserver implementation: | 1001 // Shell, aura::client::ActivationChangeObserver implementation: |
1006 | 1002 |
1007 void Shell::OnWindowActivated(aura::Window* gained_active, | 1003 void Shell::OnWindowActivated(aura::Window* gained_active, |
1008 aura::Window* lost_active) { | 1004 aura::Window* lost_active) { |
1009 if (gained_active) | 1005 if (gained_active) |
1010 target_root_window_ = gained_active->GetRootWindow(); | 1006 target_root_window_ = gained_active->GetRootWindow(); |
1011 } | 1007 } |
1012 | 1008 |
1013 } // namespace ash | 1009 } // namespace ash |
OLD | NEW |