Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.h

Issue 2833173002: mash: Support ShelfModel access in Chrome. (Closed)
Patch Set: Cleanup; Fix an Arc test by use CLC, not Ash's ShelfModel. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller.h
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h
index a4ca1ed851908b189411af7c10a2fe3297e55f39..860c4a41079c4c43936f88ef4fecb8bb03e0e303 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h
@@ -26,6 +26,8 @@
#include "components/prefs/pref_change_registrar.h"
#include "components/sync_preferences/pref_service_syncable_observer.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/interface_ptr_set.h"
class AccountId;
class AppIconLoader;
@@ -65,6 +67,7 @@ class ChromeLauncherController
: public LauncherAppUpdater::Delegate,
public AppIconLoaderDelegate,
private ash::mojom::ShelfObserver,
+ private ash::mojom::ShelfModelObserver,
private ash::ShelfModelObserver,
private ash::WindowTreeHostManager::Observer,
private AppSyncUIStateObserver,
@@ -353,6 +356,11 @@ class ChromeLauncherController
// Forget the current profile to allow attaching to a new one.
void ReleaseProfile();
+ // Add an observer for the local ShelfModel. Called by ash::ShelfController as
+ // a callback to establish two-way synchronization of ShelfModel state.
+ void LinkShelfModels(ash::mojom::ShelfModelObserverPtr observer,
+ const std::vector<ash::ShelfItem>& items);
+
// ash::mojom::ShelfObserver:
void OnShelfInitialized(int64_t display_id) override;
void OnAlignmentChanged(ash::ShelfAlignment alignment,
@@ -360,11 +368,22 @@ class ChromeLauncherController
void OnAutoHideBehaviorChanged(ash::ShelfAutoHideBehavior auto_hide,
int64_t display_id) override;
+ // ash::mojom::ShelfModelObserver:
+ void OnShelfItemAdded(int32_t index, const ash::ShelfItem& item) override;
+ void OnShelfItemRemoved(int32_t index, const ash::ShelfItem& item) override;
+ void OnShelfItemMoved(int32_t start_index, int32_t target_index) override;
+ void OnShelfItemChanged(int32_t index, const ash::ShelfItem& item) override;
+ void OnShelfItemDelegateChanged(
+ const ash::ShelfID& id,
+ ash::mojom::ShelfItemDelegatePtr delegate) override;
+
// ash::ShelfModelObserver:
void ShelfItemAdded(int index) override;
void ShelfItemRemoved(int index, const ash::ShelfItem& old_item) override;
void ShelfItemMoved(int start_index, int target_index) override;
void ShelfItemChanged(int index, const ash::ShelfItem& old_item) override;
+ void ShelfItemDelegateChanged(const ash::ShelfID& id,
+ ash::ShelfItemDelegate* delegate) override;
// ash::WindowTreeHostManager::Observer:
void OnDisplayConfigurationChanged() override;
@@ -399,6 +418,17 @@ class ChromeLauncherController
// True when setting a shelf pref in response to an observer notification.
bool updating_shelf_pref_from_observer_ = false;
+ // Binding for observation of the remote ShelfModel owned by Ash.
+ ash::mojom::ShelfModelObserverRequest shelf_model_observer_request_;
+ mojo::Binding<ash::mojom::ShelfModelObserver> shelf_model_observer_binding_;
+
+ // True when applying changes from the remote ShelfModel owned by Ash.
+ // Changes to the local ShelfModel should not be reported during this time.
+ bool applying_remote_shelf_model_changes_ = false;
+
+ // The set of shelf model observers notified about shelf model changes.
+ mojo::InterfacePtrSet<ash::mojom::ShelfModelObserver> shelf_model_observers_;
+
// When true, changes to pinned shelf items should update the sync model.
bool should_sync_pin_changes_ = true;

Powered by Google App Engine
This is Rietveld 408576698