| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 void OnAppUninstalledPrepared(content::BrowserContext* browser_context, | 149 void OnAppUninstalledPrepared(content::BrowserContext* browser_context, |
| 150 const std::string& app_id) override; | 150 const std::string& app_id) override; |
| 151 | 151 |
| 152 protected: | 152 protected: |
| 153 // ChromeLauncherController: | 153 // ChromeLauncherController: |
| 154 void OnInit() override; | 154 void OnInit() override; |
| 155 | 155 |
| 156 // Creates a new app shortcut item and controller on the shelf at |index|. | 156 // Creates a new app shortcut item and controller on the shelf at |index|. |
| 157 // Use kInsertItemAtEnd to add a shortcut as the last item. | 157 // Use kInsertItemAtEnd to add a shortcut as the last item. |
| 158 ash::ShelfID CreateAppShortcutLauncherItem( | 158 ash::ShelfID CreateAppShortcutLauncherItem( |
| 159 const ash::launcher::AppLauncherId& app_launcher_id, | 159 const ash::AppLauncherId& app_launcher_id, |
| 160 int index); | 160 int index); |
| 161 | 161 |
| 162 private: | 162 private: |
| 163 friend class ChromeLauncherControllerImplTest; | 163 friend class ChromeLauncherControllerImplTest; |
| 164 friend class ShelfAppBrowserTest; | 164 friend class ShelfAppBrowserTest; |
| 165 friend class LauncherPlatformAppBrowserTest; | 165 friend class LauncherPlatformAppBrowserTest; |
| 166 friend class TestChromeLauncherControllerImpl; | 166 friend class TestChromeLauncherControllerImpl; |
| 167 FRIEND_TEST_ALL_PREFIXES(ChromeLauncherControllerImplTest, AppPanels); | 167 FRIEND_TEST_ALL_PREFIXES(ChromeLauncherControllerImplTest, AppPanels); |
| 168 | 168 |
| 169 typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap; | 169 typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap; |
| 170 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap; | 170 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap; |
| 171 | 171 |
| 172 // Remembers / restores list of running applications. | 172 // Remembers / restores list of running applications. |
| 173 // Note that this order will neither be stored in the preference nor will it | 173 // Note that this order will neither be stored in the preference nor will it |
| 174 // remember the order of closed applications since it is only temporary. | 174 // remember the order of closed applications since it is only temporary. |
| 175 void RememberUnpinnedRunningApplicationOrder(); | 175 void RememberUnpinnedRunningApplicationOrder(); |
| 176 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id); | 176 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id); |
| 177 | 177 |
| 178 // Creates a new app shortcut item and controller on the shelf at |index|. | 178 // Creates a new app shortcut item and controller on the shelf at |index|. |
| 179 // Use kInsertItemAtEnd to add a shortcut as the last item. | 179 // Use kInsertItemAtEnd to add a shortcut as the last item. |
| 180 ash::ShelfID CreateAppShortcutLauncherItemWithType( | 180 ash::ShelfID CreateAppShortcutLauncherItemWithType( |
| 181 const ash::launcher::AppLauncherId& app_launcher_id, | 181 const ash::AppLauncherId& app_launcher_id, |
| 182 int index, | 182 int index, |
| 183 ash::ShelfItemType shelf_item_type); | 183 ash::ShelfItemType shelf_item_type); |
| 184 | 184 |
| 185 // Invoked when the associated browser or app is closed. | 185 // Invoked when the associated browser or app is closed. |
| 186 void LauncherItemClosed(ash::ShelfID id); | 186 void LauncherItemClosed(ash::ShelfID id); |
| 187 | 187 |
| 188 // Internal helpers for pinning and unpinning that handle both | 188 // Internal helpers for pinning and unpinning that handle both |
| 189 // client-triggered and internal pinning operations. | 189 // client-triggered and internal pinning operations. |
| 190 void DoPinAppWithID(const std::string& app_id); | 190 void DoPinAppWithID(const std::string& app_id); |
| 191 void DoUnpinAppWithID(const std::string& app_id, bool update_prefs); | 191 void DoUnpinAppWithID(const std::string& app_id, bool update_prefs); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 typedef std::vector<std::string> RunningAppListIds; | 315 typedef std::vector<std::string> RunningAppListIds; |
| 316 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; | 316 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; |
| 317 RunningAppListIdMap last_used_running_application_order_; | 317 RunningAppListIdMap last_used_running_application_order_; |
| 318 | 318 |
| 319 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_; | 319 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_; |
| 320 | 320 |
| 321 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl); | 321 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl); |
| 322 }; | 322 }; |
| 323 | 323 |
| 324 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ | 324 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ |
| OLD | NEW |