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

Unified Diff: blimp/client/core/context/blimp_client_context_impl.cc

Issue 2349073002: Blimp Settings framework on the c++ side (Closed)
Patch Set: nits and sync to head 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/core/context/blimp_client_context_impl.cc
diff --git a/blimp/client/core/context/blimp_client_context_impl.cc b/blimp/client/core/context/blimp_client_context_impl.cc
index 6ddeee424b7edaa4e389100278c6b0ed69cce4b8..81769e53483afa6bf70bf0211f742a2be050e0bc 100644
--- a/blimp/client/core/context/blimp_client_context_impl.cc
+++ b/blimp/client/core/context/blimp_client_context_impl.cc
@@ -23,10 +23,12 @@
#include "blimp/client/core/geolocation/geolocation_feature.h"
#include "blimp/client/core/render_widget/render_widget_feature.h"
#include "blimp/client/core/session/cross_thread_network_event_observer.h"
+#include "blimp/client/core/settings/settings.h"
#include "blimp/client/core/settings/settings_feature.h"
#include "blimp/client/core/switches/blimp_client_switches.h"
#include "blimp/client/public/blimp_client_context_delegate.h"
#include "blimp/client/public/compositor/compositor_dependencies.h"
+#include "components/prefs/pref_service.h"
#include "device/geolocation/geolocation_delegate.h"
#include "device/geolocation/location_arbitrator.h"
#include "ui/gfx/native_widget_types.h"
@@ -57,28 +59,49 @@ void DropConnectionOnIOThread(ClientNetworkComponents* net_components) {
BlimpClientContext* BlimpClientContext::Create(
scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner,
- std::unique_ptr<CompositorDependencies> compositor_dependencies) {
+ std::unique_ptr<CompositorDependencies> compositor_dependencies,
+ PrefService* local_state) {
#if defined(OS_ANDROID)
- return new BlimpClientContextImplAndroid(io_thread_task_runner,
- file_thread_task_runner,
- std::move(compositor_dependencies));
+ return new BlimpClientContextImplAndroid(
+ io_thread_task_runner, file_thread_task_runner,
+ std::move(compositor_dependencies), local_state);
#else
- return new BlimpClientContextImpl(io_thread_task_runner,
- file_thread_task_runner,
- std::move(compositor_dependencies));
+ return new BlimpClientContextImpl(
+ io_thread_task_runner, file_thread_task_runner,
+ std::move(compositor_dependencies), local_state);
#endif // defined(OS_ANDROID)
}
+// This function is declared in //blimp/client/public/blimp_client_context.h
+// and either this function or the one in
+// //blimp/client/core/dummy_blimp_client_context.cc should be linked in to
+// any binary using BlimpClientContext::RegisterPrefs.
+// static
+void BlimpClientContext::RegisterPrefs(PrefRegistrySimple* registry) {
+ Settings::RegisterPrefs(registry);
+}
+
+// This function is declared in //blimp/client/public/blimp_client_context.h
+// and either this function or the one in
+// //blimp/client/core/dummy_blimp_client_context.cc should be linked in to
+// any binary using BlimpClientContext::ApplyBlimpSwitches.
+// static
+void BlimpClientContext::ApplyBlimpSwitches(CommandLinePrefStore* store) {
+ Settings::ApplyBlimpSwitches(store);
+}
+
BlimpClientContextImpl::BlimpClientContextImpl(
scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner,
- std::unique_ptr<CompositorDependencies> compositor_dependencies)
+ std::unique_ptr<CompositorDependencies> compositor_dependencies,
+ PrefService* local_state)
: BlimpClientContext(),
io_thread_task_runner_(io_thread_task_runner),
file_thread_task_runner_(file_thread_task_runner),
blimp_compositor_dependencies_(
base::MakeUnique<BlimpCompositorDependencies>(
std::move(compositor_dependencies))),
+ settings_(base::MakeUnique<Settings>(local_state)),
blob_channel_feature_(new BlobChannelFeature(this)),
geolocation_feature_(base::MakeUnique<GeolocationFeature>(
base::MakeUnique<device::LocationArbitrator>(
@@ -86,7 +109,7 @@ BlimpClientContextImpl::BlimpClientContextImpl(
ime_feature_(new ImeFeature),
navigation_feature_(new NavigationFeature),
render_widget_feature_(new RenderWidgetFeature),
- settings_feature_(new SettingsFeature),
+ settings_feature_(base::MakeUnique<SettingsFeature>(settings_.get())),
tab_control_feature_(new TabControlFeature),
blimp_contents_manager_(
new BlimpContentsManager(blimp_compositor_dependencies_.get(),
@@ -106,7 +129,7 @@ BlimpClientContextImpl::BlimpClientContextImpl(
io_thread_task_runner_, net_components_->GetBrowserConnectionHandler());
RegisterFeatures();
- InitializeSettings();
+ settings_feature_->PushSettings();
connection_status_.AddObserver(this);
@@ -225,12 +248,6 @@ void BlimpClientContextImpl::RegisterFeatures() {
tab_control_feature_.get()));
}
-void BlimpClientContextImpl::InitializeSettings() {
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDownloadWholeDocument))
- settings_feature_->SetRecordWholeDocument(true);
-}
-
void BlimpClientContextImpl::DropConnection() {
io_thread_task_runner_->PostTask(
FROM_HERE, base::Bind(&DropConnectionOnIOThread, net_components_.get()));
« no previous file with comments | « blimp/client/core/context/blimp_client_context_impl.h ('k') | blimp/client/core/context/blimp_client_context_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698