| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 BrowserShortcutLauncherItemController* | 121 BrowserShortcutLauncherItemController* |
| 122 GetBrowserShortcutLauncherItemController() override; | 122 GetBrowserShortcutLauncherItemController() override; |
| 123 LauncherItemController* GetLauncherItemController( | 123 LauncherItemController* GetLauncherItemController( |
| 124 const ash::ShelfID id) override; | 124 const ash::ShelfID id) override; |
| 125 bool ShelfBoundsChangesProbablyWithUser( | 125 bool ShelfBoundsChangesProbablyWithUser( |
| 126 ash::WmShelf* shelf, | 126 ash::WmShelf* shelf, |
| 127 const AccountId& account_id) const override; | 127 const AccountId& account_id) const override; |
| 128 void OnUserProfileReadyToSwitch(Profile* profile) override; | 128 void OnUserProfileReadyToSwitch(Profile* profile) override; |
| 129 ArcAppDeferredLauncherController* GetArcDeferredLauncher() override; | 129 ArcAppDeferredLauncherController* GetArcDeferredLauncher() override; |
| 130 const std::string& GetLaunchIDForShelfID(ash::ShelfID id) override; | 130 const std::string& GetLaunchIDForShelfID(ash::ShelfID id) override; |
| 131 const std::string& GetTitleForShelfID(ash::ShelfID id) override; |
| 131 void AttachProfile(Profile* profile_to_attach) override; | 132 void AttachProfile(Profile* profile_to_attach) override; |
| 132 | 133 |
| 133 // Access to the BrowserStatusMonitor for tests. | 134 // Access to the BrowserStatusMonitor for tests. |
| 134 BrowserStatusMonitor* browser_status_monitor_for_test() { | 135 BrowserStatusMonitor* browser_status_monitor_for_test() { |
| 135 return browser_status_monitor_.get(); | 136 return browser_status_monitor_.get(); |
| 136 } | 137 } |
| 137 | 138 |
| 138 // Access to the AppWindowLauncherController list for tests. | 139 // Access to the AppWindowLauncherController list for tests. |
| 139 const std::vector<std::unique_ptr<AppWindowLauncherController>>& | 140 const std::vector<std::unique_ptr<AppWindowLauncherController>>& |
| 140 app_window_controllers_for_test() { | 141 app_window_controllers_for_test() { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 158 void OnAppUpdated(content::BrowserContext* browser_context, | 159 void OnAppUpdated(content::BrowserContext* browser_context, |
| 159 const std::string& app_id) override; | 160 const std::string& app_id) override; |
| 160 void OnAppUninstalledPrepared(content::BrowserContext* browser_context, | 161 void OnAppUninstalledPrepared(content::BrowserContext* browser_context, |
| 161 const std::string& app_id) override; | 162 const std::string& app_id) override; |
| 162 | 163 |
| 163 protected: | 164 protected: |
| 164 // Creates a new app shortcut item and controller on the shelf at |index|. | 165 // Creates a new app shortcut item and controller on the shelf at |index|. |
| 165 // Use kInsertItemAtEnd to add a shortcut as the last item. | 166 // Use kInsertItemAtEnd to add a shortcut as the last item. |
| 166 ash::ShelfID CreateAppShortcutLauncherItem( | 167 ash::ShelfID CreateAppShortcutLauncherItem( |
| 167 const ash::launcher::AppLauncherId& app_launcher_id, | 168 const ash::launcher::AppLauncherId& app_launcher_id, |
| 169 const std::string& title, |
| 168 int index); | 170 int index); |
| 169 | 171 |
| 170 const std::string& GetAppIdFromShelfIdForTest(ash::ShelfID id); | 172 const std::string& GetAppIdFromShelfIdForTest(ash::ShelfID id); |
| 171 | 173 |
| 172 private: | 174 private: |
| 173 friend class ChromeLauncherControllerImplTest; | 175 friend class ChromeLauncherControllerImplTest; |
| 174 friend class ShelfAppBrowserTest; | 176 friend class ShelfAppBrowserTest; |
| 175 friend class LauncherPlatformAppBrowserTest; | 177 friend class LauncherPlatformAppBrowserTest; |
| 176 FRIEND_TEST_ALL_PREFIXES(ChromeLauncherControllerImplTest, AppPanels); | 178 FRIEND_TEST_ALL_PREFIXES(ChromeLauncherControllerImplTest, AppPanels); |
| 177 | 179 |
| 178 typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap; | 180 typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap; |
| 179 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap; | 181 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap; |
| 180 | 182 |
| 181 // Remembers / restores list of running applications. | 183 // Remembers / restores list of running applications. |
| 182 // Note that this order will neither be stored in the preference nor will it | 184 // Note that this order will neither be stored in the preference nor will it |
| 183 // remember the order of closed applications since it is only temporary. | 185 // remember the order of closed applications since it is only temporary. |
| 184 void RememberUnpinnedRunningApplicationOrder(); | 186 void RememberUnpinnedRunningApplicationOrder(); |
| 185 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id); | 187 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id); |
| 186 | 188 |
| 187 // Creates a new app shortcut item and controller on the shelf at |index|. | 189 // Creates a new app shortcut item and controller on the shelf at |index|. |
| 188 // Use kInsertItemAtEnd to add a shortcut as the last item. | 190 // Use kInsertItemAtEnd to add a shortcut as the last item. |
| 189 ash::ShelfID CreateAppShortcutLauncherItemWithType( | 191 ash::ShelfID CreateAppShortcutLauncherItemWithType( |
| 190 const ash::launcher::AppLauncherId& app_launcher_id, | 192 const ash::launcher::AppLauncherId& app_launcher_id, |
| 193 const std::string& title, |
| 191 int index, | 194 int index, |
| 192 ash::ShelfItemType shelf_item_type); | 195 ash::ShelfItemType shelf_item_type); |
| 193 | 196 |
| 194 // Invoked when the associated browser or app is closed. | 197 // Invoked when the associated browser or app is closed. |
| 195 void LauncherItemClosed(ash::ShelfID id); | 198 void LauncherItemClosed(ash::ShelfID id); |
| 196 | 199 |
| 197 // Internal helpers for pinning and unpinning that handle both | 200 // Internal helpers for pinning and unpinning that handle both |
| 198 // client-triggered and internal pinning operations. | 201 // client-triggered and internal pinning operations. |
| 199 void DoPinAppWithID(const std::string& app_id); | 202 void DoPinAppWithID(const std::string& app_id); |
| 200 void DoUnpinAppWithID(const std::string& app_id, bool update_prefs); | 203 void DoUnpinAppWithID(const std::string& app_id, bool update_prefs); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 typedef std::vector<std::string> RunningAppListIds; | 325 typedef std::vector<std::string> RunningAppListIds; |
| 323 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; | 326 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; |
| 324 RunningAppListIdMap last_used_running_application_order_; | 327 RunningAppListIdMap last_used_running_application_order_; |
| 325 | 328 |
| 326 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_; | 329 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_; |
| 327 | 330 |
| 328 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl); | 331 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl); |
| 329 }; | 332 }; |
| 330 | 333 |
| 331 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ | 334 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ |
| OLD | NEW |