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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc

Issue 22429004: Refactor LauncherDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 7 years, 4 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/launcher/launcher.h" 10 #include "ash/launcher/launcher.h"
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 launchers_.insert(launcher); 970 launchers_.insert(launcher);
971 launcher->shelf_widget()->shelf_layout_manager()->AddObserver(this); 971 launcher->shelf_widget()->shelf_layout_manager()->AddObserver(this);
972 } 972 }
973 973
974 void ChromeLauncherController::OnLauncherDestroyed(ash::Launcher* launcher) { 974 void ChromeLauncherController::OnLauncherDestroyed(ash::Launcher* launcher) {
975 launchers_.erase(launcher); 975 launchers_.erase(launcher);
976 // RemoveObserver is not called here, since by the time this method is called 976 // RemoveObserver is not called here, since by the time this method is called
977 // Launcher is already in its destructor. 977 // Launcher is already in its destructor.
978 } 978 }
979 979
980 // TODO(simon.hong81): Remove LauncherItemDelegate interface from
981 // ChromeLauncherController. LauncherItemDelegate should be derived by
982 // LauncherItemController.
983 ash::LauncherItemDelegate* ChromeLauncherController::GetLauncherItemDelegate(
984 const ash::LauncherItem& item) {
985 IDToItemControllerMap::iterator iter =
986 id_to_item_controller_map_.find(item.id);
987 return iter != id_to_item_controller_map_.end() ? this : NULL;
988 }
989
980 void ChromeLauncherController::LauncherItemAdded(int index) { 990 void ChromeLauncherController::LauncherItemAdded(int index) {
981 } 991 }
982 992
983 void ChromeLauncherController::LauncherItemRemoved(int index, 993 void ChromeLauncherController::LauncherItemRemoved(int index,
984 ash::LauncherID id) { 994 ash::LauncherID id) {
985 } 995 }
986 996
987 void ChromeLauncherController::LauncherItemMoved(int start_index, 997 void ChromeLauncherController::LauncherItemMoved(int start_index,
988 int target_index) { 998 int target_index) {
989 ash::LauncherID id = model_->items()[target_index].id; 999 ash::LauncherID id = model_->items()[target_index].id;
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 browser_to_close.pop_back(); 1659 browser_to_close.pop_back();
1650 } 1660 }
1651 } 1661 }
1652 1662
1653 void 1663 void
1654 ChromeLauncherController::MoveItemWithoutPinnedStateChangeNotification( 1664 ChromeLauncherController::MoveItemWithoutPinnedStateChangeNotification(
1655 int source_index, int target_index) { 1665 int source_index, int target_index) {
1656 base::AutoReset<bool> auto_reset(&ignore_persist_pinned_state_change_, true); 1666 base::AutoReset<bool> auto_reset(&ignore_persist_pinned_state_change_, true);
1657 model_->Move(source_index, target_index); 1667 model_->Move(source_index, target_index);
1658 } 1668 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698