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

Unified Diff: blimp/client/app/linux/blimp_main.cc

Issue 2349073002: Blimp Settings framework on the c++ side (Closed)
Patch Set: move the PrefService logic from blimp_main.cc Created 4 years, 2 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: blimp/client/app/linux/blimp_main.cc
diff --git a/blimp/client/app/linux/blimp_main.cc b/blimp/client/app/linux/blimp_main.cc
index 2f06d931953f8610e13822bcce2b2bd6a73ad227..53155864ccf123ec48c77c711355b7201d7748ce 100644
--- a/blimp/client/app/linux/blimp_main.cc
+++ b/blimp/client/app/linux/blimp_main.cc
@@ -13,9 +13,13 @@
#include "blimp/client/app/linux/blimp_client_context_delegate_linux.h"
#include "blimp/client/app/linux/blimp_display_manager.h"
#include "blimp/client/app/linux/blimp_display_manager_delegate_main.h"
+#include "blimp/client/core/settings/settings_prefs.h"
#include "blimp/client/public/blimp_client_context.h"
#include "blimp/client/public/contents/blimp_navigation_controller.h"
#include "blimp/client/support/compositor/compositor_dependencies_impl.h"
+#include "components/pref_registry/pref_registry_syncable.h"
+#include "components/prefs/pref_service.h"
+#include "components/prefs/pref_service_factory.h"
#include "ui/gfx/x/x11_connection.h"
namespace {
@@ -47,11 +51,24 @@ int main(int argc, const char**argv) {
// destroyed before the delegate.
std::unique_ptr<blimp::client::BlimpClientContextDelegate> context_delegate =
base::MakeUnique<blimp::client::BlimpClientContextDelegateLinux>();
- std::unique_ptr<blimp::client::BlimpClientContext> context =
- base::WrapUnique<blimp::client::BlimpClientContext>(
- blimp::client::BlimpClientContext::Create(
- io_thread.task_runner(), io_thread.task_runner(),
- base::WrapUnique(compositor_dependencies)));
+
+ scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry =
David Trainor- moved to gerrit 2016/10/26 07:00:25 Shouldn't we do the following? blimp::client::Reg
Menglin 2016/10/26 19:28:33 to do ApplyBlimpSwitches, i create a subclass of C
+ new ::user_prefs::PrefRegistrySyncable();
+ pref_registry->RegisterBooleanPref(
+ blimp::client::prefs::kBlimpEnabled, false);
+ pref_registry->RegisterBooleanPref(
+ blimp::client::prefs::kRecordWholeDocument, false);
+
+ // Set up PrefService.
+ PrefServiceFactory pref_service_factory;
+ std::unique_ptr<PrefService> pref_service =
+ pref_service_factory.Create(pref_registry.get());
+
+ auto context = base::WrapUnique<blimp::client::BlimpClientContext>(
+ blimp::client::BlimpClientContext::Create(
+ io_thread.task_runner(), io_thread.task_runner(),
+ base::WrapUnique(compositor_dependencies),
+ pref_service.get()));
context->SetDelegate(context_delegate.get());
context->Connect();

Powered by Google App Engine
This is Rietveld 408576698