Index: blimp/engine/feature/engine_settings_feature.h |
diff --git a/blimp/engine/feature/engine_settings_feature.h b/blimp/engine/feature/engine_settings_feature.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6dec59ab1093af0492e34b8a1a198c4d65670c3b |
--- /dev/null |
+++ b/blimp/engine/feature/engine_settings_feature.h |
@@ -0,0 +1,64 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
haibinlu
2016/03/21 18:25:22
2016
Khushal
2016/03/22 04:11:43
Done.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef BLIMP_ENGINE_FEATURE_ENGINE_SETTINGS_FEATURE_H_ |
+#define BLIMP_ENGINE_FEATURE_ENGINE_SETTINGS_FEATURE_H_ |
+ |
+#include "base/macros.h" |
+#include "base/observer_list.h" |
+#include "blimp/net/blimp_message_processor.h" |
+#include "content/public/browser/render_view_host.h" |
+ |
+namespace blimp { |
+class EngineSettingsMessage; |
+ |
+// The feature is used to send and receive global settings from the client. |
+class EngineSettingsFeature : public BlimpMessageProcessor { |
+ public: |
+ // An observer interested in knowing when the engine settings have changed. |
+ class Observer { |
+ public: |
+ // Called when the WebPreferences set from the client have changed. |
haibinlu
2016/03/21 18:25:22
can you list a few web preferences in the method d
Khushal
2016/03/22 04:11:43
Done.
|
+ virtual void OnWebPreferencesChanged() {} |
+ }; |
+ |
+ EngineSettingsFeature(); |
+ ~EngineSettingsFeature() override; |
+ |
+ // Set the BlimpMessageProcessor that will be used to send |
+ // BlimpMessage::SETTINGS messages to the client. |
+ void set_outgoing_message_processor( |
haibinlu
2016/03/21 18:25:22
remove? since Engine does not send settings to Cli
Khushal
2016/03/22 04:11:43
Done.
|
+ scoped_ptr<BlimpMessageProcessor> processor); |
+ |
+ void AddObserver(Observer* observer); |
+ void RemoveObserver(Observer* observer); |
+ |
+ // Called to update the WebPreferences for the RenderViewHost. |
haibinlu
2016/03/21 18:25:23
this method goes to SettingsManager if we go with
Khushal
2016/03/22 04:11:43
Done.
|
+ void UpdateWebkitPreferences( |
+ content::RenderViewHost* render_view_host); |
+ |
+ private: |
+ // BlimpMessageProcessor implementation. |
+ void ProcessMessage(scoped_ptr<BlimpMessage> message, |
+ const net::CompletionCallback& callback) override; |
+ |
+ void ProcessWebPreferences(const EngineSettingsMessage& settings); |
+ |
+ // Used to send BlimpMessage::TAB_CONTROL messages to the engine. |
haibinlu
2016/03/21 18:25:23
Settings message
|
+ scoped_ptr<BlimpMessageProcessor> outgoing_message_processor_; |
+ |
+ // Used to cache settings received from the engine to avoid unnecessarily |
+ // notifying the observers. |
+ |
+ // -------WebPreferences------- |
+ bool record_whole_document_; |
+ |
+ base::ObserverList<Observer> observer_list_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(EngineSettingsFeature); |
+}; |
+ |
+} // namespace blimp |
+ |
+#endif // BLIMP_ENGINE_FEATURE_ENGINE_SETTINGS_FEATURE_H_ |