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

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

Issue 2474653003: PreferencesManager (Closed)
Patch Set: Ash example 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
« no previous file with comments | « ash/common/shelf/shelf_controller.h ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/shelf/shelf_controller.cc
diff --git a/ash/common/shelf/shelf_controller.cc b/ash/common/shelf/shelf_controller.cc
index 043fec9e7513655c295521b1b328c4b116ffe463..4c5fa7fb3ac049d257bb4c1143733ee9e20a1e90 100644
--- a/ash/common/shelf/shelf_controller.cc
+++ b/ash/common/shelf/shelf_controller.cc
@@ -7,11 +7,15 @@
#include "ash/common/shelf/shelf_item_delegate.h"
#include "ash/common/shelf/shelf_menu_model.h"
#include "ash/common/shelf/wm_shelf.h"
+#include "ash/common/shell_delegate.h"
#include "ash/common/wm_lookup.h"
#include "ash/common/wm_root_window_controller.h"
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window.h"
#include "base/strings/utf_string_conversions.h"
+#include "services/preferences/public/cpp/pref_observer_store.h"
+#include "services/preferences/public/interfaces/preferences.mojom.h"
+#include "services/service_manager/public/cpp/connector.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
@@ -168,6 +172,20 @@ ShelfController::~ShelfController() {}
void ShelfController::BindRequest(mojom::ShelfControllerRequest request) {
bindings_.AddBinding(this, std::move(request));
+
+ // Sample of connecting to the PreferencesManager
+ WmShell* shell = WmShell::Get();
+ service_manager::Connector* connector =
+ shell->delegate()->GetShellConnector();
+ if (!connector)
+ return;
+ prefs::mojom::PreferencesManagerPtr pref_manager_ptr;
+ connector->ConnectToInterface("service:content_browser", &pref_manager_ptr);
+ store_ = new PrefObserverStore(std::move(pref_manager_ptr));
+ std::set<std::string> keys;
+ const std::string key("hey");
+ keys.insert(key);
+ store_->Init(keys);
jonross 2016/11/02 19:57:30 Once this is connected it can be used as a normal
}
void ShelfController::NotifyShelfCreated(WmShelf* shelf) {
« no previous file with comments | « ash/common/shelf/shelf_controller.h ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698