| 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> |
| 11 | 11 |
| 12 #include "ash/display/window_tree_host_manager.h" | 12 #include "ash/display/window_tree_host_manager.h" |
| 13 #include "ash/public/cpp/shelf_item_delegate.h" | 13 #include "ash/public/cpp/shelf_item_delegate.h" |
| 14 #include "ash/public/cpp/shelf_types.h" | 14 #include "ash/public/cpp/shelf_types.h" |
| 15 #include "ash/public/interfaces/shelf.mojom.h" | 15 #include "ash/public/interfaces/shelf.mojom.h" |
| 16 #include "ash/shelf/shelf_model_observer.h" | 16 #include "ash/shelf/shelf_model_observer.h" |
| 17 #include "base/auto_reset.h" | 17 #include "base/auto_reset.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 20 #include "chrome/browser/ui/app_icon_loader_delegate.h" | 20 #include "chrome/browser/ui/app_icon_loader_delegate.h" |
| 21 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 21 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
| 22 #include "chrome/browser/ui/ash/app_sync_ui_state_observer.h" | 22 #include "chrome/browser/ui/ash/app_sync_ui_state_observer.h" |
| 23 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 23 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 24 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" | 24 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" |
| 25 #include "chrome/browser/ui/ash/launcher/settings_window_observer.h" | 25 #include "chrome/browser/ui/ash/launcher/settings_window_observer.h" |
| 26 #include "components/prefs/pref_change_registrar.h" | 26 #include "components/prefs/pref_change_registrar.h" |
| 27 #include "components/sync_preferences/pref_service_syncable_observer.h" | 27 #include "components/sync_preferences/pref_service_syncable_observer.h" |
| 28 #include "mojo/public/cpp/bindings/associated_binding.h" | 28 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 29 #include "mojo/public/cpp/bindings/binding.h" |
| 30 #include "mojo/public/cpp/bindings/interface_ptr_set.h" |
| 29 | 31 |
| 30 class AccountId; | 32 class AccountId; |
| 31 class AppIconLoader; | 33 class AppIconLoader; |
| 32 class AppSyncUIState; | 34 class AppSyncUIState; |
| 33 class AppWindowLauncherController; | 35 class AppWindowLauncherController; |
| 34 class ArcAppDeferredLauncherController; | 36 class ArcAppDeferredLauncherController; |
| 35 class BrowserShortcutLauncherItemController; | 37 class BrowserShortcutLauncherItemController; |
| 36 class BrowserStatusMonitor; | 38 class BrowserStatusMonitor; |
| 37 class ChromeLauncherControllerUserSwitchObserver; | 39 class ChromeLauncherControllerUserSwitchObserver; |
| 38 class ChromeLauncherPrefsObserver; | 40 class ChromeLauncherPrefsObserver; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 351 |
| 350 // Forget the current profile to allow attaching to a new one. | 352 // Forget the current profile to allow attaching to a new one. |
| 351 void ReleaseProfile(); | 353 void ReleaseProfile(); |
| 352 | 354 |
| 353 // ash::mojom::ShelfObserver: | 355 // ash::mojom::ShelfObserver: |
| 354 void OnShelfInitialized(int64_t display_id) override; | 356 void OnShelfInitialized(int64_t display_id) override; |
| 355 void OnAlignmentChanged(ash::ShelfAlignment alignment, | 357 void OnAlignmentChanged(ash::ShelfAlignment alignment, |
| 356 int64_t display_id) override; | 358 int64_t display_id) override; |
| 357 void OnAutoHideBehaviorChanged(ash::ShelfAutoHideBehavior auto_hide, | 359 void OnAutoHideBehaviorChanged(ash::ShelfAutoHideBehavior auto_hide, |
| 358 int64_t display_id) override; | 360 int64_t display_id) override; |
| 361 void OnShelfItemAdded(int32_t index, const ash::ShelfItem& item) override; |
| 362 void OnShelfItemRemoved(const ash::ShelfID& id) override; |
| 363 void OnShelfItemMoved(const ash::ShelfID& id, int32_t index) override; |
| 364 void OnShelfItemUpdated(const ash::ShelfItem& item) override; |
| 365 void OnShelfItemDelegateChanged( |
| 366 const ash::ShelfID& id, |
| 367 ash::mojom::ShelfItemDelegatePtr delegate) override; |
| 359 | 368 |
| 360 // ash::ShelfModelObserver: | 369 // ash::ShelfModelObserver: |
| 361 void ShelfItemAdded(int index) override; | 370 void ShelfItemAdded(int index) override; |
| 362 void ShelfItemRemoved(int index, const ash::ShelfItem& old_item) override; | 371 void ShelfItemRemoved(int index, const ash::ShelfItem& old_item) override; |
| 363 void ShelfItemMoved(int start_index, int target_index) override; | 372 void ShelfItemMoved(int start_index, int target_index) override; |
| 364 void ShelfItemChanged(int index, const ash::ShelfItem& old_item) override; | 373 void ShelfItemChanged(int index, const ash::ShelfItem& old_item) override; |
| 374 void ShelfItemDelegateChanged(const ash::ShelfID& id, |
| 375 ash::ShelfItemDelegate* delegate) override; |
| 365 | 376 |
| 366 // ash::WindowTreeHostManager::Observer: | 377 // ash::WindowTreeHostManager::Observer: |
| 367 void OnDisplayConfigurationChanged() override; | 378 void OnDisplayConfigurationChanged() override; |
| 368 | 379 |
| 369 // AppSyncUIStateObserver: | 380 // AppSyncUIStateObserver: |
| 370 void OnAppSyncUIStatusChanged() override; | 381 void OnAppSyncUIStatusChanged() override; |
| 371 | 382 |
| 372 // app_list::AppListSyncableService::Observer: | 383 // app_list::AppListSyncableService::Observer: |
| 373 void OnSyncModelUpdated() override; | 384 void OnSyncModelUpdated() override; |
| 374 | 385 |
| 375 // sync_preferences::PrefServiceSyncableObserver: | 386 // sync_preferences::PrefServiceSyncableObserver: |
| 376 void OnIsSyncingChanged() override; | 387 void OnIsSyncingChanged() override; |
| 377 | 388 |
| 378 // An internal helper to unpin a shelf item; this does not update prefs. | 389 // An internal helper to unpin a shelf item; this does not update prefs. |
| 379 void UnpinShelfItemInternal(const ash::ShelfID& id); | 390 void UnpinShelfItemInternal(const ash::ShelfID& id); |
| 380 | 391 |
| 381 static ChromeLauncherController* instance_; | 392 static ChromeLauncherController* instance_; |
| 382 | 393 |
| 383 // The currently loaded profile used for prefs and loading extensions. This is | 394 // The currently loaded profile used for prefs and loading extensions. This is |
| 384 // NOT necessarily the profile new windows are created with. Note that in | 395 // NOT necessarily the profile new windows are created with. Note that in |
| 385 // multi-profile use cases this might change over time. | 396 // multi-profile use cases this might change over time. |
| 386 Profile* profile_ = nullptr; | 397 Profile* profile_ = nullptr; |
| 387 | 398 |
| 399 // 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 |
| 401 // ChromeBrowserMainExtraPartsAsh, and synchronized with Ash's ShelfModel. |
| 388 ash::ShelfModel* model_; | 402 ash::ShelfModel* model_; |
| 389 | 403 |
| 390 // Ash's mojom::ShelfController used to change shelf state. | 404 // Ash's mojom::ShelfController used to change shelf state. |
| 391 ash::mojom::ShelfControllerPtr shelf_controller_; | 405 ash::mojom::ShelfControllerPtr shelf_controller_; |
| 392 | 406 |
| 393 // The binding this instance uses to implment mojom::ShelfObserver | 407 // The binding this instance uses to implment mojom::ShelfObserver |
| 394 mojo::AssociatedBinding<ash::mojom::ShelfObserver> observer_binding_; | 408 mojo::AssociatedBinding<ash::mojom::ShelfObserver> observer_binding_; |
| 395 | 409 |
| 396 // True when setting a shelf pref in response to an observer notification. | 410 // True when setting a shelf pref in response to an observer notification. |
| 397 bool updating_shelf_pref_from_observer_ = false; | 411 bool updating_shelf_pref_from_observer_ = false; |
| 398 | 412 |
| 413 // True when applying changes from the remote ShelfModel owned by Ash. |
| 414 // Changes to the local ShelfModel should not be reported during this time. |
| 415 bool applying_remote_shelf_model_changes_ = false; |
| 416 |
| 399 // When true, changes to pinned shelf items should update the sync model. | 417 // When true, changes to pinned shelf items should update the sync model. |
| 400 bool should_sync_pin_changes_ = true; | 418 bool should_sync_pin_changes_ = true; |
| 401 | 419 |
| 402 // Used to get app info for tabs. | 420 // Used to get app info for tabs. |
| 403 std::unique_ptr<LauncherControllerHelper> launcher_controller_helper_; | 421 std::unique_ptr<LauncherControllerHelper> launcher_controller_helper_; |
| 404 | 422 |
| 405 // An observer that manages the shelf title and icon for settings windows. | 423 // An observer that manages the shelf title and icon for settings windows. |
| 406 SettingsWindowObserver settings_window_observer_; | 424 SettingsWindowObserver settings_window_observer_; |
| 407 | 425 |
| 408 // Used to load the images for app items. | 426 // Used to load the images for app items. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 438 using RunningAppListIds = std::vector<std::string>; | 456 using RunningAppListIds = std::vector<std::string>; |
| 439 using RunningAppListIdMap = std::map<std::string, RunningAppListIds>; | 457 using RunningAppListIdMap = std::map<std::string, RunningAppListIds>; |
| 440 RunningAppListIdMap last_used_running_application_order_; | 458 RunningAppListIdMap last_used_running_application_order_; |
| 441 | 459 |
| 442 base::WeakPtrFactory<ChromeLauncherController> weak_ptr_factory_; | 460 base::WeakPtrFactory<ChromeLauncherController> weak_ptr_factory_; |
| 443 | 461 |
| 444 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 462 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
| 445 }; | 463 }; |
| 446 | 464 |
| 447 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 465 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
| OLD | NEW |