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(int32_t index, const ash::ShelfItem& item) override; | |
363 void OnShelfItemMoved(int32_t start_index, int32_t target_index) override; | |
364 void OnShelfItemChanged(int32_t index, 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 |
388 ash::ShelfModel* model_; | 399 ash::ShelfModel* model_; |
James Cook
2017/05/30 22:47:48
nit: document what this means in mash vs. non-mash
msw
2017/05/31 16:55:22
Done.
| |
389 | 400 |
390 // Ash's mojom::ShelfController used to change shelf state. | 401 // Ash's mojom::ShelfController used to change shelf state. |
391 ash::mojom::ShelfControllerPtr shelf_controller_; | 402 ash::mojom::ShelfControllerPtr shelf_controller_; |
392 | 403 |
393 // The binding this instance uses to implment mojom::ShelfObserver | 404 // The binding this instance uses to implment mojom::ShelfObserver |
394 mojo::AssociatedBinding<ash::mojom::ShelfObserver> observer_binding_; | 405 mojo::AssociatedBinding<ash::mojom::ShelfObserver> observer_binding_; |
395 | 406 |
396 // True when setting a shelf pref in response to an observer notification. | 407 // True when setting a shelf pref in response to an observer notification. |
397 bool updating_shelf_pref_from_observer_ = false; | 408 bool updating_shelf_pref_from_observer_ = false; |
398 | 409 |
410 // True when applying changes from the remote ShelfModel owned by Ash. | |
411 // Changes to the local ShelfModel should not be reported during this time. | |
412 bool applying_remote_shelf_model_changes_ = false; | |
413 | |
399 // When true, changes to pinned shelf items should update the sync model. | 414 // When true, changes to pinned shelf items should update the sync model. |
400 bool should_sync_pin_changes_ = true; | 415 bool should_sync_pin_changes_ = true; |
401 | 416 |
402 // Used to get app info for tabs. | 417 // Used to get app info for tabs. |
403 std::unique_ptr<LauncherControllerHelper> launcher_controller_helper_; | 418 std::unique_ptr<LauncherControllerHelper> launcher_controller_helper_; |
404 | 419 |
405 // An observer that manages the shelf title and icon for settings windows. | 420 // An observer that manages the shelf title and icon for settings windows. |
406 SettingsWindowObserver settings_window_observer_; | 421 SettingsWindowObserver settings_window_observer_; |
407 | 422 |
408 // Used to load the images for app items. | 423 // Used to load the images for app items. |
(...skipping 29 matching lines...) Expand all Loading... | |
438 using RunningAppListIds = std::vector<std::string>; | 453 using RunningAppListIds = std::vector<std::string>; |
439 using RunningAppListIdMap = std::map<std::string, RunningAppListIds>; | 454 using RunningAppListIdMap = std::map<std::string, RunningAppListIds>; |
440 RunningAppListIdMap last_used_running_application_order_; | 455 RunningAppListIdMap last_used_running_application_order_; |
441 | 456 |
442 base::WeakPtrFactory<ChromeLauncherController> weak_ptr_factory_; | 457 base::WeakPtrFactory<ChromeLauncherController> weak_ptr_factory_; |
443 | 458 |
444 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 459 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
445 }; | 460 }; |
446 | 461 |
447 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 462 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
OLD | NEW |