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

Unified Diff: ash/common/shelf/shelf_controller.h

Issue 2474653003: PreferencesManager (Closed)
Patch Set: Rebase Created 4 years, 1 month 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: ash/common/shelf/shelf_controller.h
diff --git a/ash/common/shelf/shelf_controller.h b/ash/common/shelf/shelf_controller.h
index b058d4ffbf1b95880e98c55685a3c0f2635077d8..d6607826c935ad7f730887d62e50c41a6e1b6374 100644
--- a/ash/common/shelf/shelf_controller.h
+++ b/ash/common/shelf/shelf_controller.h
@@ -12,8 +12,10 @@
#include "ash/common/shelf/shelf_model.h"
#include "ash/public/cpp/shelf_types.h"
#include "ash/public/interfaces/shelf.mojom.h"
+#include "components/prefs/pref_store.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/bindings/interface_ptr_set.h"
+#include "services/preferences/public/cpp/pref_observer_store.h"
namespace ash {
@@ -21,7 +23,8 @@ class WmShelf;
// Ash's implementation of the mojom::ShelfController interface. Chrome connects
// to this interface to observe and manage the per-display ash shelf instances.
-class ShelfController : public mojom::ShelfController {
+class ShelfController : public mojom::ShelfController,
+ public PrefStore::Observer {
public:
ShelfController();
~ShelfController() override;
@@ -54,6 +57,10 @@ class ShelfController : public mojom::ShelfController {
void UnpinItem(const std::string& app_id) override;
void SetItemImage(const std::string& app_id, const SkBitmap& image) override;
+ // PrefStore::Observer:
+ void OnPrefValueChanged(const std::string& key) override;
+ void OnInitializationCompleted(bool succeeded) override;
+
private:
// The shelf model shared by all shelf instances.
ShelfModel model_;
@@ -64,6 +71,8 @@ class ShelfController : public mojom::ShelfController {
// The set of shelf observers notified about shelf state and settings changes.
mojo::AssociatedInterfacePtrSet<mojom::ShelfObserver> observers_;
+ scoped_refptr<PrefObserverStore> store_;
James Cook 2016/11/18 00:50:34 Like we discussed in person, I think a single cent
jonross 2016/11/18 20:31:23 Yeah I agree. I will update this example in a bit
+
// Mappings between application and shelf ids.
std::map<std::string, ShelfID> app_id_to_shelf_id_;
std::map<ShelfID, std::string> shelf_id_to_app_id_;

Powered by Google App Engine
This is Rietveld 408576698