| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_FEATURE_H_ | 5 #ifndef BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_FEATURE_H_ |
| 6 #define BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_FEATURE_H_ | 6 #define BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_FEATURE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "blimp/client/core/settings/settings_observer.h" | 9 #include "blimp/client/core/settings/settings_observer.h" |
| 10 #include "blimp/net/blimp_message_processor.h" | 10 #include "blimp/net/blimp_message_processor.h" |
| 11 | 11 |
| 12 namespace blimp { | 12 namespace blimp { |
| 13 namespace client { | 13 namespace client { |
| 14 | 14 |
| 15 class Settings; | 15 class Settings; |
| 16 | 16 |
| 17 // The feature is used to send global settings to the engine. | 17 // The feature is used to send global settings to the engine. |
| 18 class SettingsFeature : public BlimpMessageProcessor, public SettingsObserver { | 18 class SettingsFeature : public BlimpMessageProcessor, public SettingsObserver { |
| 19 public: | 19 public: |
| 20 // Caller ensures |settings| outlives this object. | 20 // Caller ensures |settings| outlives this object. |
| 21 explicit SettingsFeature(Settings* settings); | 21 explicit SettingsFeature(Settings* settings); |
| 22 ~SettingsFeature() override; | 22 ~SettingsFeature() override; |
| 23 | 23 |
| 24 // Set the BlimpMessageProcessor that will be used to send | 24 // Set the BlimpMessageProcessor that will be used to send |
| 25 // BlimpMessage::SETTINGS messages to the engine. | 25 // BlimpMessage::SETTINGS messages to the engine. |
| 26 void set_outgoing_message_processor( | 26 void set_outgoing_message_processor( |
| 27 std::unique_ptr<BlimpMessageProcessor> processor); | 27 std::unique_ptr<BlimpMessageProcessor> processor); |
| 28 | 28 |
| 29 void SendUserAgentOSVersionInfo(const std::string& client_os_info); | |
| 30 | |
| 31 // BlimpMessageProcessor implementation. | 29 // BlimpMessageProcessor implementation. |
| 32 void ProcessMessage(std::unique_ptr<BlimpMessage> message, | 30 void ProcessMessage(std::unique_ptr<BlimpMessage> message, |
| 33 const net::CompletionCallback& callback) override; | 31 const net::CompletionCallback& callback) override; |
| 34 | 32 |
| 35 // SettingsObserver implementation. | 33 // SettingsObserver implementation. |
| 36 void OnRecordWholeDocumentChanged(bool enable) override; | 34 void OnRecordWholeDocumentChanged(bool enable) override; |
| 37 | 35 |
| 38 // Send the necessary settings to the engine. | 36 // Send the necessary settings to the engine. |
| 39 void PushSettings(); | 37 void PushSettings(); |
| 40 | 38 |
| 41 private: | 39 private: |
| 42 // Used to send BlimpMessage::TAB_CONTROL messages to the engine. | 40 // Used to send BlimpMessage::TAB_CONTROL messages to the engine. |
| 43 std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_; | 41 std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_; |
| 44 | 42 |
| 45 Settings* settings_; | 43 Settings* settings_; |
| 46 | 44 |
| 47 DISALLOW_COPY_AND_ASSIGN(SettingsFeature); | 45 DISALLOW_COPY_AND_ASSIGN(SettingsFeature); |
| 48 }; | 46 }; |
| 49 | 47 |
| 50 } // namespace client | 48 } // namespace client |
| 51 } // namespace blimp | 49 } // namespace blimp |
| 52 | 50 |
| 53 #endif // BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_FEATURE_H_ | 51 #endif // BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_FEATURE_H_ |
| OLD | NEW |