Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller.h |
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h |
index 6583eff6b983fdb104ba34f3aea5bca405b0280e..80576260cadf53bf3a1a0e1ed6cb98941b4ef1f0 100644 |
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h |
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h |
@@ -46,6 +46,7 @@ class ShellWindowLauncherController; |
class TabContents; |
namespace ash { |
+class LauncherItemDelegateManager; |
class LauncherModel; |
} |
@@ -85,10 +86,7 @@ class ChromeLauncherControllerUserSwitchObserver { |
// * App shell windows have ShellWindowLauncherItemController, owned by |
// ShellWindowLauncherController. |
// * Shortcuts have no LauncherItemController. |
-// TODO(simon.hong81): Move LauncherItemDelegate out from |
-// ChromeLauncherController and makes separate subclass with it. |
class ChromeLauncherController : public ash::LauncherDelegate, |
- public ash::LauncherItemDelegate, |
public ash::LauncherModelObserver, |
public ash::ShellObserver, |
public ash::DisplayController::Observer, |
@@ -296,18 +294,6 @@ class ChromeLauncherController : public ash::LauncherDelegate, |
virtual bool CanPin() const OVERRIDE; |
virtual void UnpinAppWithID(const std::string& app_id) OVERRIDE; |
- // ash::LauncherItemDelegate overrides: |
- virtual void ItemSelected(const ash::LauncherItem& item, |
- const ui::Event& event) OVERRIDE; |
- virtual string16 GetTitle(const ash::LauncherItem& item) OVERRIDE; |
- virtual ui::MenuModel* CreateContextMenu( |
- const ash::LauncherItem& item, aura::RootWindow* root) OVERRIDE; |
- virtual ash::LauncherMenuModel* CreateApplicationMenu( |
- const ash::LauncherItem& item, |
- int event_flags) OVERRIDE; |
- virtual bool IsDraggable(const ash::LauncherItem& item) OVERRIDE; |
- virtual bool ShouldShowTooltip(const ash::LauncherItem& item) OVERRIDE; |
- |
// ash::LauncherModelObserver overrides: |
virtual void LauncherItemAdded(int index) OVERRIDE; |
virtual void LauncherItemRemoved(int index, ash::LauncherID id) OVERRIDE; |
@@ -385,6 +371,8 @@ class ChromeLauncherController : public ash::LauncherDelegate, |
BrowserShortcutLauncherItemController* |
GetBrowserShortcutLauncherItemController(); |
+ LauncherItemController* GetLauncherItemController(const ash::LauncherID id); |
+ |
protected: |
// Creates a new app shortcut item and controller on the launcher at |index|. |
// Use kInsertItemAtEnd to add a shortcut as the last item. |
@@ -397,6 +385,11 @@ class ChromeLauncherController : public ash::LauncherDelegate, |
void SetAppIconLoaderForTest(extensions::AppIconLoader* loader); |
const std::string& GetAppIdFromLauncherIdForTest(ash::LauncherID id); |
+ // Sets the ash::LauncherItemDelegateManager only for unittests and doesn't |
+ // take an ownership of it. |
+ void SetLauncherItemDelegateManagerForTest( |
+ ash::LauncherItemDelegateManager* manager); |
+ |
private: |
friend class ChromeLauncherControllerTest; |
friend class LauncherAppBrowserTest; |
@@ -508,8 +501,10 @@ class ChromeLauncherController : public ash::LauncherDelegate, |
// deleted. |
void CloseWindowedAppsFromRemovedExtension(const std::string& app_id); |
- // Register LauncherItemDelegate. |
- void RegisterLauncherItemDelegate(); |
+ // Set LauncherItemDelegate |item_delegate| for |id| and take an ownership. |
+ // TODO(simon.hong81): Make this take a scoped_ptr of |item_delegate|. |
+ void SetLauncherItemDelegate(ash::LauncherID id, |
+ ash::LauncherItemDelegate* item_delegate); |
// Attach to a specific profile. |
void AttachProfile(Profile* proifile); |
@@ -521,6 +516,8 @@ class ChromeLauncherController : public ash::LauncherDelegate, |
ash::LauncherModel* model_; |
+ ash::LauncherItemDelegateManager* item_delegate_manager_; |
+ |
// Profile used for prefs and loading extensions. This is NOT necessarily the |
// profile new windows are created with. |
Profile* profile_; |
@@ -553,9 +550,6 @@ class ChromeLauncherController : public ash::LauncherDelegate, |
// Launchers that are currently being observed. |
std::set<ash::Launcher*> launchers_; |
- // The owned browser shortcut item. |
- scoped_ptr<BrowserShortcutLauncherItemController> browser_item_controller_; |
- |
// The owned browser status monitor. |
scoped_ptr<BrowserStatusMonitor> browser_status_monitor_; |