| 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_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // otherwise launches and activates the app. | 143 // otherwise launches and activates the app. |
| 144 // Used by the app-list, and by pinned-app shelf items. | 144 // Used by the app-list, and by pinned-app shelf items. |
| 145 void ActivateApp(const std::string& app_id, | 145 void ActivateApp(const std::string& app_id, |
| 146 ash::ShelfLaunchSource source, | 146 ash::ShelfLaunchSource source, |
| 147 int event_flags); | 147 int event_flags); |
| 148 | 148 |
| 149 // Set the image for a specific shelf item (e.g. when set by the app). | 149 // Set the image for a specific shelf item (e.g. when set by the app). |
| 150 void SetLauncherItemImage(const ash::ShelfID& shelf_id, | 150 void SetLauncherItemImage(const ash::ShelfID& shelf_id, |
| 151 const gfx::ImageSkia& image); | 151 const gfx::ImageSkia& image); |
| 152 | 152 |
| 153 // Updates the image for a specific shelf item from the app's icon loader. |
| 154 void UpdateLauncherItemImage(const std::string& app_id); |
| 155 |
| 153 // Notify the controller that the state of an non platform app's tabs | 156 // Notify the controller that the state of an non platform app's tabs |
| 154 // have changed, | 157 // have changed, |
| 155 void UpdateAppState(content::WebContents* contents, AppState app_state); | 158 void UpdateAppState(content::WebContents* contents, AppState app_state); |
| 156 | 159 |
| 157 // Returns ShelfID for |contents|. If |contents| is not an app or is not | 160 // Returns ShelfID for |contents|. If |contents| is not an app or is not |
| 158 // pinned, returns the id of browser shrotcut. | 161 // pinned, returns the id of browser shrotcut. |
| 159 ash::ShelfID GetShelfIDForWebContents(content::WebContents* contents); | 162 ash::ShelfID GetShelfIDForWebContents(content::WebContents* contents); |
| 160 | 163 |
| 161 // Limits application refocusing to urls that match |url| for |id|. | 164 // Limits application refocusing to urls that match |url| for |id|. |
| 162 void SetRefocusURLPatternForTest(const ash::ShelfID& id, const GURL& url); | 165 void SetRefocusURLPatternForTest(const ash::ShelfID& id, const GURL& url); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // animation predictions. | 215 // animation predictions. |
| 213 bool ShelfBoundsChangesProbablyWithUser(ash::Shelf* shelf, | 216 bool ShelfBoundsChangesProbablyWithUser(ash::Shelf* shelf, |
| 214 const AccountId& account_id) const; | 217 const AccountId& account_id) const; |
| 215 | 218 |
| 216 // Called when the user profile is fully loaded and ready to switch to. | 219 // Called when the user profile is fully loaded and ready to switch to. |
| 217 void OnUserProfileReadyToSwitch(Profile* profile); | 220 void OnUserProfileReadyToSwitch(Profile* profile); |
| 218 | 221 |
| 219 // Controller to launch ARC apps in deferred mode. | 222 // Controller to launch ARC apps in deferred mode. |
| 220 ArcAppDeferredLauncherController* GetArcDeferredLauncher(); | 223 ArcAppDeferredLauncherController* GetArcDeferredLauncher(); |
| 221 | 224 |
| 222 AppIconLoader* GetAppIconLoaderForApp(const std::string& app_id); | |
| 223 | |
| 224 // Sets the shelf auto-hide and/or alignment behavior from prefs. | 225 // Sets the shelf auto-hide and/or alignment behavior from prefs. |
| 225 void SetShelfAutoHideBehaviorFromPrefs(); | 226 void SetShelfAutoHideBehaviorFromPrefs(); |
| 226 void SetShelfAlignmentFromPrefs(); | 227 void SetShelfAlignmentFromPrefs(); |
| 227 void SetShelfBehaviorsFromPrefs(); | 228 void SetShelfBehaviorsFromPrefs(); |
| 228 | 229 |
| 229 // Temporarily prevent pinned shelf item changes from updating the sync model. | 230 // Temporarily prevent pinned shelf item changes from updating the sync model. |
| 230 using ScopedPinSyncDisabler = std::unique_ptr<base::AutoReset<bool>>; | 231 using ScopedPinSyncDisabler = std::unique_ptr<base::AutoReset<bool>>; |
| 231 ScopedPinSyncDisabler GetScopedPinSyncDisabler(); | 232 ScopedPinSyncDisabler GetScopedPinSyncDisabler(); |
| 232 | 233 |
| 233 // Access to the BrowserStatusMonitor for tests. | 234 // Access to the BrowserStatusMonitor for tests. |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 383 |
| 383 // app_list::AppListSyncableService::Observer: | 384 // app_list::AppListSyncableService::Observer: |
| 384 void OnSyncModelUpdated() override; | 385 void OnSyncModelUpdated() override; |
| 385 | 386 |
| 386 // sync_preferences::PrefServiceSyncableObserver: | 387 // sync_preferences::PrefServiceSyncableObserver: |
| 387 void OnIsSyncingChanged() override; | 388 void OnIsSyncingChanged() override; |
| 388 | 389 |
| 389 // An internal helper to unpin a shelf item; this does not update prefs. | 390 // An internal helper to unpin a shelf item; this does not update prefs. |
| 390 void UnpinShelfItemInternal(const ash::ShelfID& id); | 391 void UnpinShelfItemInternal(const ash::ShelfID& id); |
| 391 | 392 |
| 393 // Resolves the app icon image loader for the app. |
| 394 AppIconLoader* GetAppIconLoaderForApp(const std::string& app_id); |
| 395 |
| 392 static ChromeLauncherController* instance_; | 396 static ChromeLauncherController* instance_; |
| 393 | 397 |
| 394 // The currently loaded profile used for prefs and loading extensions. This is | 398 // The currently loaded profile used for prefs and loading extensions. This is |
| 395 // NOT necessarily the profile new windows are created with. Note that in | 399 // NOT necessarily the profile new windows are created with. Note that in |
| 396 // multi-profile use cases this might change over time. | 400 // multi-profile use cases this might change over time. |
| 397 Profile* profile_ = nullptr; | 401 Profile* profile_ = nullptr; |
| 398 | 402 |
| 399 // In classic Ash, this the ShelfModel owned by ash::Shell's ShelfController. | 403 // In classic Ash, this the ShelfModel owned by ash::Shell's ShelfController. |
| 400 // In the mash config, this is a separate ShelfModel instance, owned by | 404 // In the mash config, this is a separate ShelfModel instance, owned by |
| 401 // ChromeBrowserMainExtraPartsAsh, and synchronized with Ash's ShelfModel. | 405 // ChromeBrowserMainExtraPartsAsh, and synchronized with Ash's ShelfModel. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 using RunningAppListIds = std::vector<std::string>; | 460 using RunningAppListIds = std::vector<std::string>; |
| 457 using RunningAppListIdMap = std::map<std::string, RunningAppListIds>; | 461 using RunningAppListIdMap = std::map<std::string, RunningAppListIds>; |
| 458 RunningAppListIdMap last_used_running_application_order_; | 462 RunningAppListIdMap last_used_running_application_order_; |
| 459 | 463 |
| 460 base::WeakPtrFactory<ChromeLauncherController> weak_ptr_factory_; | 464 base::WeakPtrFactory<ChromeLauncherController> weak_ptr_factory_; |
| 461 | 465 |
| 462 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 466 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
| 463 }; | 467 }; |
| 464 | 468 |
| 465 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 469 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
| OLD | NEW |