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

Side by Side Diff: blimp/client/core/settings/settings_feature.h

Issue 2349073002: Blimp Settings framework on the c++ side (Closed)
Patch Set: nits and sync to head Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « blimp/client/core/settings/settings.cc ('k') | blimp/client/core/settings/settings_feature.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/net/blimp_message_processor.h" 10 #include "blimp/net/blimp_message_processor.h"
10 11
11 namespace blimp { 12 namespace blimp {
12 namespace client { 13 namespace client {
13 14
15 class Settings;
16
14 // The feature is used to send global settings to the engine. 17 // The feature is used to send global settings to the engine.
15 class SettingsFeature : public BlimpMessageProcessor { 18 class SettingsFeature : public BlimpMessageProcessor, public SettingsObserver {
16 public: 19 public:
17 SettingsFeature(); 20 // Caller ensures |settings| outlives this object.
21 explicit SettingsFeature(Settings* settings);
18 ~SettingsFeature() override; 22 ~SettingsFeature() override;
19 23
20 // Set the BlimpMessageProcessor that will be used to send 24 // Set the BlimpMessageProcessor that will be used to send
21 // BlimpMessage::SETTINGS messages to the engine. 25 // BlimpMessage::SETTINGS messages to the engine.
22 void set_outgoing_message_processor( 26 void set_outgoing_message_processor(
23 std::unique_ptr<BlimpMessageProcessor> processor); 27 std::unique_ptr<BlimpMessageProcessor> processor);
24 28
25 void SetRecordWholeDocument(bool record_whole_document);
26 void SendUserAgentOSVersionInfo(const std::string& client_os_info); 29 void SendUserAgentOSVersionInfo(const std::string& client_os_info);
27 30
28 // BlimpMessageProcessor implementation. 31 // BlimpMessageProcessor implementation.
29 void ProcessMessage(std::unique_ptr<BlimpMessage> message, 32 void ProcessMessage(std::unique_ptr<BlimpMessage> message,
30 const net::CompletionCallback& callback) override; 33 const net::CompletionCallback& callback) override;
31 34
35 // SettingsObserver implementation.
36 void OnRecordWholeDocumentChanged(bool enable) override;
37
38 // Send the necessary settings to the engine.
39 void PushSettings();
40
32 private: 41 private:
33 // Used to send BlimpMessage::TAB_CONTROL messages to the engine. 42 // Used to send BlimpMessage::TAB_CONTROL messages to the engine.
34 std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_; 43 std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_;
35 44
36 // Used to avoid sending unnecessary messages to engine. 45 Settings* settings_;
37 bool record_whole_document_;
38 46
39 DISALLOW_COPY_AND_ASSIGN(SettingsFeature); 47 DISALLOW_COPY_AND_ASSIGN(SettingsFeature);
40 }; 48 };
41 49
42 } // namespace client 50 } // namespace client
43 } // namespace blimp 51 } // namespace blimp
44 52
45 #endif // BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_FEATURE_H_ 53 #endif // BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_FEATURE_H_
OLDNEW
« no previous file with comments | « blimp/client/core/settings/settings.cc ('k') | blimp/client/core/settings/settings_feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698