Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginSettings.h

Issue 11013110: Cleanup (Closed)
Patch Set: Created July 5, 2013, 3:28 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /** 1 /**
2 * This class contains all client functionality of the IE plugin 2 * This class contains all client functionality of the IE plugin
3 * 3 *
4 * Exception errors are tested by calls to ExceptionsTest from: Main ... 4 * Exception errors are tested by calls to ExceptionsTest from: Main ...
5 */ 5 */
6 6
7 #ifndef _PLUGIN_SETTINGS_H_ 7 #ifndef _PLUGIN_SETTINGS_H_
8 #define _PLUGIN_SETTINGS_H_ 8 #define _PLUGIN_SETTINGS_H_
9 9
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 class CPluginSettings 51 class CPluginSettings
52 { 52 {
53 53
54 public: 54 public:
55 55
56 typedef std::map<CString, CString> TProperties; 56 typedef std::map<CString, CString> TProperties;
57 57
58 private: 58 private:
59 59
60 bool m_isFirstRun; 60 bool m_isFirstRun;
61 bool m_isFirstRunUpdate; 61 bool m_isFirstRunUpdate;
Wladimir Palant 2013/07/05 09:26:45 I think that these two properties and the correspo
62 62
63 DWORD m_dwMainProcessId; 63 DWORD m_dwMainProcessId;
64 DWORD m_dwMainThreadId; 64 DWORD m_dwMainThreadId;
65 DWORD m_dwMainUiThreadId; 65 DWORD m_dwMainUiThreadId;
66 DWORD m_dwWorkingThreadId; 66 DWORD m_dwWorkingThreadId;
67 67
68 CString m_tabNumber; 68 CString m_tabNumber;
69 69
70 CPluginSettings::TProperties m_properties;
71
72 bool m_isDirty; 70 bool m_isDirty;
Wladimir Palant 2013/07/05 09:26:45 You can remove that property, all code using it ha
73 71
74 CString m_settingsVersion; 72 CString m_settingsVersion;
Wladimir Palant 2013/07/05 09:26:45 That property is unused.
75 std::auto_ptr<CPluginIniFileW> m_settingsFile;
76
77 73
78 static CComAutoCriticalSection s_criticalSectionLocal; 74 static CComAutoCriticalSection s_criticalSectionLocal;
79 #ifdef SUPPORT_WHITELIST 75 #ifdef SUPPORT_WHITELIST
80 static CComAutoCriticalSection s_criticalSectionDomainHistory; 76 static CComAutoCriticalSection s_criticalSectionDomainHistory;
Wladimir Palant 2013/07/05 09:26:45 This property is unused.
81 #endif 77 #endif
82 78
83 bool m_isPluginSelftestEnabled;
84
85 void Clear(); 79 void Clear();
86 80
87 // Private constructor used by the singleton pattern 81 // Private constructor used by the singleton pattern
88 CPluginSettings(); 82 CPluginSettings();
89 public: 83 public:
90 84
91 ~CPluginSettings(); 85 ~CPluginSettings();
92 86
93 static CPluginSettings* s_instance; 87 static CPluginSettings* s_instance;
94 88
95 static bool s_isLightOnly; 89 static bool s_isLightOnly;
Wladimir Palant 2013/07/05 09:26:45 This property seems unused.
96 static bool HasInstance(); 90 static bool HasInstance();
97 static CPluginSettings* GetInstance(); 91 static CPluginSettings* GetInstance();
98 92
99 bool Read(bool bDebug=true);
100 bool Write(bool bDebug=true);
101
102 static CString GetDataPath(const CString& filename=L""); 93 static CString GetDataPath(const CString& filename=L"");
103 94
104 static CString GetTempPath(const CString& filename=L""); 95 static CString GetTempPath(const CString& filename=L"");
105 static CString GetTempFile(const CString& prefix, const CString& extension=L"" ); 96 static CString GetTempFile(const CString& prefix, const CString& extension=L"" );
Wladimir Palant 2013/07/05 09:26:45 These two methods seem unused.
106 97
107 bool Has(const CString& key) const;
108 void Remove(const CString& key);
109
110 CString GetPluginId(); 98 CString GetPluginId();
Wladimir Palant 2013/07/05 09:26:45 This method isn't even implemented.
111 99
112 CString GetString(const CString& key, const CString& defaultValue=L"") const;
113 void SetString(const CString& key, const CString& value);
114
115 int GetValue(const CString& key, int defaultValue=0) const;
116 void SetValue(const CString& key, int value);
117
118 bool GetBool(const CString& key, bool defaultValue) const;
119 void SetBool(const CString& key, bool value);
120
121 bool IsPluginEnabled() const; 100 bool IsPluginEnabled() const;
122 101
123 bool IsPluginSelftestEnabled(); 102 bool IsPluginSelftestEnabled();
Wladimir Palant 2013/07/05 09:26:45 This method isn't even implemented.
124 103
125 bool FilterlistExpired(CString filterlist) const; 104 bool FilterlistExpired(CString filterlist) const;
126 bool SetFilterRefreshDate(CString filterlist, time_t refreshtime); 105 bool SetFilterRefreshDate(CString filterlist, time_t refreshtime);
Wladimir Palant 2013/07/05 09:26:45 These two methods aren't even implemented.
127 106
128 std::map<CString, CString> GetFilterLanguageTitleList() const; 107 std::map<CString, CString> GetFilterLanguageTitleList() const;
129 108
130 void SetMainProcessId(); 109 void SetMainProcessId();
131 void SetMainProcessId(DWORD id); 110 void SetMainProcessId(DWORD id);
132 bool IsMainProcess(DWORD dwProcessId=0) const; 111 bool IsMainProcess(DWORD dwProcessId=0) const;
133 112
134 void SetMainUiThreadId(); 113 void SetMainUiThreadId();
135 void SetMainUiThreadId(DWORD id); 114 void SetMainUiThreadId(DWORD id);
136 bool IsMainUiThread(DWORD dwThread=0) const; 115 bool IsMainUiThread(DWORD dwThread=0) const;
(...skipping 12 matching lines...) Expand all
149 void SetFirstRunUpdate(); 128 void SetFirstRunUpdate();
150 bool IsFirstRunUpdate() const; 129 bool IsFirstRunUpdate() const;
151 130
152 bool IsFirstRunAny() const; 131 bool IsFirstRunAny() const;
153 132
154 static CString GetSystemLanguage(); 133 static CString GetSystemLanguage();
155 DWORD m_WindowsBuildNumber; 134 DWORD m_WindowsBuildNumber;
156 135
157 private: 136 private:
158 137
159 bool m_isDirtyTab;
160 bool m_isPluginEnabledTab; 138 bool m_isPluginEnabledTab;
161 139
162 CPluginSettings::TProperties m_propertiesTab;
163 CPluginSettings::TProperties m_errorsTab;
164
165 std::auto_ptr<CPluginIniFileW> m_settingsFileTab;
166
167 void ClearTab();
168
169 bool ReadTab(bool bDebug=true);
170 bool WriteTab(bool bDebug=true);
171
172 public: 140 public:
173 141
174 void EraseTab();
175
176 CString GetTabNumber() const; 142 CString GetTabNumber() const;
177 143
178 bool IncrementTabCount(); 144 bool IncrementTabCount();
179 bool DecrementTabCount(); 145 bool DecrementTabCount();
180 146
181 void TogglePluginEnabled(); 147 void TogglePluginEnabled();
182 void SetPluginDisabled(); 148 void SetPluginDisabled();
183 void SetPluginEnabled(); 149 void SetPluginEnabled();
184 bool GetPluginEnabled() const; 150 bool GetPluginEnabled() const;
185 151
186 void AddError(const CString& error, const CString& errorCode); 152 void AddError(const CString& error, const CString& errorCode);
187 CString GetErrorList() const;
188 void RemoveErrors();
189
190 bool GetForceConfigurationUpdateOnStart() const;
191 void ForceConfigurationUpdateOnStart(bool isUpdating=true);
192 void RemoveForceConfigurationUpdateOnStart();
193
194 void RefreshTab();
195
196 int GetTabVersion(const CString& key) const;
197 void IncrementTabVersion(const CString& key);
198 153
199 // Settings whitelist 154 // Settings whitelist
200 #ifdef SUPPORT_WHITELIST 155 #ifdef SUPPORT_WHITELIST
201 156
202 private: 157 private:
203 std::vector<std::wstring> m_whitelistedDomains; 158 std::vector<std::wstring> m_whitelistedDomains;
204 159
205 void ClearWhitelist(); 160 void ClearWhitelist();
206 bool ReadWhitelist(bool bDebug=true); 161 bool ReadWhitelist(bool bDebug=true);
207 162
208 public: 163 public:
209 void AddWhiteListedDomain(const CString& domain); 164 void AddWhiteListedDomain(const CString& domain);
210 void RemoveWhiteListedDomain(const CString& domain); 165 void RemoveWhiteListedDomain(const CString& domain);
211 int GetWhiteListedDomainCount() const; 166 int GetWhiteListedDomainCount() const;
212 std::vector<std::wstring> GetWhiteListedDomainList(); 167 std::vector<std::wstring> GetWhiteListedDomainList();
213 #endif //SUPPORT_WHITELIST 168 #endif //SUPPORT_WHITELIST
214 169
215 bool RefreshWhitelist(); 170 bool RefreshWhitelist();
216 DWORD GetWindowsBuildNumber(); 171 DWORD GetWindowsBuildNumber();
217 172
218 void SetSubscription(const std::wstring& url); 173 void SetSubscription(const std::wstring& url);
219 void SetDefaultSubscription(); 174 void SetDefaultSubscription();
220 CString GetSubscription(); 175 CString GetSubscription();
221 void RefreshFilterlist(); 176 void RefreshFilterlist();
222 177
178 bool GetStatusBarAsked();
179 void SetStatusBarAsked(bool asked);
223 std::vector<SubscriptionDescription> m_subscriptions; 180 std::vector<SubscriptionDescription> m_subscriptions;
224 }; 181 };
225 182
226 183
227 #endif // _PLUGIN_SETTINGS_H_ 184 #endif // _PLUGIN_SETTINGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld