Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: ash/shell.cc

Issue 68523017: ash: Add GetItemIndexForType() function to ShelfModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 24 matching lines...) Expand all
35 #include "ash/magnifier/magnification_controller.h" 35 #include "ash/magnifier/magnification_controller.h"
36 #include "ash/magnifier/partial_magnification_controller.h" 36 #include "ash/magnifier/partial_magnification_controller.h"
37 #include "ash/media_delegate.h" 37 #include "ash/media_delegate.h"
38 #include "ash/new_window_delegate.h" 38 #include "ash/new_window_delegate.h"
39 #include "ash/root_window_controller.h" 39 #include "ash/root_window_controller.h"
40 #include "ash/screen_ash.h" 40 #include "ash/screen_ash.h"
41 #include "ash/session_state_delegate.h" 41 #include "ash/session_state_delegate.h"
42 #include "ash/shelf/app_list_shelf_item_delegate.h" 42 #include "ash/shelf/app_list_shelf_item_delegate.h"
43 #include "ash/shelf/shelf_layout_manager.h" 43 #include "ash/shelf/shelf_layout_manager.h"
44 #include "ash/shelf/shelf_model.h" 44 #include "ash/shelf/shelf_model.h"
45 #include "ash/shelf/shelf_model_util.h"
46 #include "ash/shelf/shelf_widget.h" 45 #include "ash/shelf/shelf_widget.h"
47 #include "ash/shell_delegate.h" 46 #include "ash/shell_delegate.h"
48 #include "ash/shell_factory.h" 47 #include "ash/shell_factory.h"
49 #include "ash/shell_window_ids.h" 48 #include "ash/shell_window_ids.h"
50 #include "ash/system/locale/locale_notification_controller.h" 49 #include "ash/system/locale/locale_notification_controller.h"
51 #include "ash/system/status_area_widget.h" 50 #include "ash/system/status_area_widget.h"
52 #include "ash/system/tray/system_tray_delegate.h" 51 #include "ash/system/tray/system_tray_delegate.h"
53 #include "ash/system/tray/system_tray_notifier.h" 52 #include "ash/system/tray/system_tray_notifier.h"
54 #include "ash/wm/app_list_controller.h" 53 #include "ash/wm/app_list_controller.h"
55 #include "ash/wm/ash_focus_rules.h" 54 #include "ash/wm/ash_focus_rules.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 launcher_item_delegate_manager_.reset( 491 launcher_item_delegate_manager_.reset(
493 new LauncherItemDelegateManager(shelf_model_.get())); 492 new LauncherItemDelegateManager(shelf_model_.get()));
494 493
495 launcher_delegate_.reset( 494 launcher_delegate_.reset(
496 delegate_->CreateLauncherDelegate(shelf_model_.get())); 495 delegate_->CreateLauncherDelegate(shelf_model_.get()));
497 scoped_ptr<LauncherItemDelegate> controller( 496 scoped_ptr<LauncherItemDelegate> controller(
498 new internal::AppListShelfItemDelegate); 497 new internal::AppListShelfItemDelegate);
499 498
500 // Finding the shelf model's location of the app list and setting its 499 // Finding the shelf model's location of the app list and setting its
501 // LauncherItemDelegate. 500 // LauncherItemDelegate.
502 int app_list_index = GetShelfItemIndexForType(TYPE_APP_LIST, *shelf_model_); 501 int app_list_index = shelf_model_->GetItemIndexForType(TYPE_APP_LIST);
503 DCHECK_GE(app_list_index, 0); 502 DCHECK_GE(app_list_index, 0);
504 LauncherID app_list_id = shelf_model_->items()[app_list_index].id; 503 LauncherID app_list_id = shelf_model_->items()[app_list_index].id;
505 DCHECK(app_list_id); 504 DCHECK(app_list_id);
506 launcher_item_delegate_manager_->SetLauncherItemDelegate( 505 launcher_item_delegate_manager_->SetLauncherItemDelegate(
507 app_list_id, 506 app_list_id,
508 controller.Pass()); 507 controller.Pass());
509 } 508 }
510 return launcher_delegate_.get(); 509 return launcher_delegate_.get();
511 } 510 }
512 511
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 //////////////////////////////////////////////////////////////////////////////// 988 ////////////////////////////////////////////////////////////////////////////////
990 // Shell, aura::client::ActivationChangeObserver implementation: 989 // Shell, aura::client::ActivationChangeObserver implementation:
991 990
992 void Shell::OnWindowActivated(aura::Window* gained_active, 991 void Shell::OnWindowActivated(aura::Window* gained_active,
993 aura::Window* lost_active) { 992 aura::Window* lost_active) {
994 if (gained_active) 993 if (gained_active)
995 target_root_window_ = gained_active->GetRootWindow(); 994 target_root_window_ = gained_active->GetRootWindow();
996 } 995 }
997 996
998 } // namespace ash 997 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698