Chromium Code Reviews| Index: blimp/client/core/settings/settings_feature.cc |
| diff --git a/blimp/client/core/settings/settings_feature.cc b/blimp/client/core/settings/settings_feature.cc |
| index d2e9d1d8b3045c2325b4a98d352ad835002315a9..886e4d4bd9619fbd8c86dbd598558296b2aa8060 100644 |
| --- a/blimp/client/core/settings/settings_feature.cc |
| +++ b/blimp/client/core/settings/settings_feature.cc |
| @@ -4,6 +4,7 @@ |
| #include "blimp/client/core/settings/settings_feature.h" |
| +#include "blimp/client/core/settings/settings.h" |
| #include "blimp/common/create_blimp_message.h" |
| #include "blimp/common/proto/blimp_message.pb.h" |
| #include "blimp/common/proto/settings.pb.h" |
| @@ -12,24 +13,28 @@ |
| namespace blimp { |
| namespace client { |
| -SettingsFeature::SettingsFeature() : record_whole_document_(false) {} |
| +SettingsFeature::SettingsFeature(Settings* settings) |
| + : settings_(settings) { |
| + if (settings_) { |
|
David Trainor- moved to gerrit
2016/10/05 23:46:21
Remove {} if single line after if. Same below.
Menglin
2016/10/06 22:36:38
don't need the observer setup since SettingsFeatur
|
| + settings_->AddObserver(this); |
| + } |
| +} |
| -SettingsFeature::~SettingsFeature() {} |
| +SettingsFeature::~SettingsFeature() { |
| + if (settings_) { |
| + settings_->RemoveObserver(this); |
| + } |
| +} |
| void SettingsFeature::set_outgoing_message_processor( |
| std::unique_ptr<BlimpMessageProcessor> processor) { |
| outgoing_message_processor_ = std::move(processor); |
| } |
| -void SettingsFeature::SetRecordWholeDocument(bool record_whole_document) { |
| - if (record_whole_document_ == record_whole_document) |
| - return; |
| - |
| - record_whole_document_ = record_whole_document; |
| - |
| +void SettingsFeature::OnRecordWholeDocumentChanged(bool enable) { |
|
David Trainor- moved to gerrit
2016/10/05 23:46:21
We shouldn't need this. IIUC we only expect this
Menglin
2016/10/06 22:36:38
OK. I'm removing this method, in the mean time, Se
|
| EngineSettingsMessage* engine_settings; |
| std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&engine_settings); |
| - engine_settings->set_record_whole_document(record_whole_document_); |
| + engine_settings->set_record_whole_document(enable); |
| outgoing_message_processor_->ProcessMessage(std::move(message), |
| net::CompletionCallback()); |
| } |
| @@ -49,5 +54,16 @@ void SettingsFeature::ProcessMessage(std::unique_ptr<BlimpMessage> message, |
| callback.Run(net::OK); |
| } |
| +void SettingsFeature::PushSettings() { |
| + // TODO(mlliu): set the user agent on the proto as well after moving |
| + // blimp/client/app/user_agent.* to this directory (http://crbug.com/652032). |
| + EngineSettingsMessage* engine_settings; |
| + std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&engine_settings); |
| + engine_settings->set_record_whole_document( |
| + settings_->record_whole_document()); |
| + outgoing_message_processor_->ProcessMessage(std::move(message), |
| + net::CompletionCallback()); |
| +} |
| + |
| } // namespace client |
| } // namespace blimp |