| 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 private: | 172 private: |
| 171 friend class ChromeLauncherControllerImplTest; | 173 friend class ChromeLauncherControllerImplTest; |
| 172 friend class ShelfAppBrowserTest; | 174 friend class ShelfAppBrowserTest; |
| 173 friend class LauncherPlatformAppBrowserTest; | 175 friend class LauncherPlatformAppBrowserTest; |
| 174 FRIEND_TEST_ALL_PREFIXES(ChromeLauncherControllerImplTest, AppPanels); | 176 FRIEND_TEST_ALL_PREFIXES(ChromeLauncherControllerImplTest, AppPanels); |
| 175 | 177 |
| 176 typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap; | 178 typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap; |
| 177 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap; | 179 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap; |
| 178 | 180 |
| 179 // Remembers / restores list of running applications. | 181 // Remembers / restores list of running applications. |
| 180 // Note that this order will neither be stored in the preference nor will it | 182 // Note that this order will neither be stored in the preference nor will it |
| 181 // remember the order of closed applications since it is only temporary. | 183 // remember the order of closed applications since it is only temporary. |
| 182 void RememberUnpinnedRunningApplicationOrder(); | 184 void RememberUnpinnedRunningApplicationOrder(); |
| 183 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id); | 185 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id); |
| 184 | 186 |
| 185 // Creates a new app shortcut item and controller on the shelf at |index|. | 187 // Creates a new app shortcut item and controller on the shelf at |index|. |
| 186 // Use kInsertItemAtEnd to add a shortcut as the last item. | 188 // Use kInsertItemAtEnd to add a shortcut as the last item. |
| 187 ash::ShelfID CreateAppShortcutLauncherItemWithType( | 189 ash::ShelfID CreateAppShortcutLauncherItemWithType( |
| 188 const ash::launcher::AppLauncherId& app_launcher_id, | 190 const ash::launcher::AppLauncherId& app_launcher_id, |
| 191 const std::string& title, |
| 189 int index, | 192 int index, |
| 190 ash::ShelfItemType shelf_item_type); | 193 ash::ShelfItemType shelf_item_type); |
| 191 | 194 |
| 192 // Invoked when the associated browser or app is closed. | 195 // Invoked when the associated browser or app is closed. |
| 193 void LauncherItemClosed(ash::ShelfID id); | 196 void LauncherItemClosed(ash::ShelfID id); |
| 194 | 197 |
| 195 // Internal helpers for pinning and unpinning that handle both | 198 // Internal helpers for pinning and unpinning that handle both |
| 196 // client-triggered and internal pinning operations. | 199 // client-triggered and internal pinning operations. |
| 197 void DoPinAppWithID(const std::string& app_id); | 200 void DoPinAppWithID(const std::string& app_id); |
| 198 void DoUnpinAppWithID(const std::string& app_id, bool update_prefs); | 201 void DoUnpinAppWithID(const std::string& app_id, bool update_prefs); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 typedef std::vector<std::string> RunningAppListIds; | 323 typedef std::vector<std::string> RunningAppListIds; |
| 321 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; | 324 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; |
| 322 RunningAppListIdMap last_used_running_application_order_; | 325 RunningAppListIdMap last_used_running_application_order_; |
| 323 | 326 |
| 324 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_; | 327 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_; |
| 325 | 328 |
| 326 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl); | 329 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl); |
| 327 }; | 330 }; |
| 328 | 331 |
| 329 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ | 332 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ |
| OLD | NEW |