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: More beautification and addressing comments Created July 29, 2013, 12:13 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/PluginSelftest.h ('k') | src/plugin/PluginSettings.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
62 61
63 DWORD m_dwMainProcessId;
64 DWORD m_dwMainThreadId;
65 DWORD m_dwMainUiThreadId;
66 DWORD m_dwWorkingThreadId; 62 DWORD m_dwWorkingThreadId;
67 63
68 CString m_tabNumber;
69
70 CPluginSettings::TProperties m_properties;
71
72 bool m_isDirty;
73
74 CString m_settingsVersion;
75 std::auto_ptr<CPluginIniFileW> m_settingsFile;
76
77
78 static CComAutoCriticalSection s_criticalSectionLocal; 64 static CComAutoCriticalSection s_criticalSectionLocal;
79 #ifdef SUPPORT_WHITELIST
80 static CComAutoCriticalSection s_criticalSectionDomainHistory;
81 #endif
82
83 bool m_isPluginSelftestEnabled;
84 65
85 void Clear(); 66 void Clear();
86 67
87 // Private constructor used by the singleton pattern 68 // Private constructor used by the singleton pattern
88 CPluginSettings(); 69 CPluginSettings();
89 public: 70 public:
90 71
91 ~CPluginSettings(); 72 ~CPluginSettings();
92 73
93 static CPluginSettings* s_instance; 74 static CPluginSettings* s_instance;
94 75
95 static bool s_isLightOnly;
96 static bool HasInstance(); 76 static bool HasInstance();
97 static CPluginSettings* GetInstance(); 77 static CPluginSettings* GetInstance();
98 78
99 bool Read(bool bDebug=true);
100 bool Write(bool bDebug=true);
101
102 static CString GetDataPath(const CString& filename=L""); 79 static CString GetDataPath(const CString& filename=L"");
103 80
104 static CString GetTempPath(const CString& filename=L"");
105 static CString GetTempFile(const CString& prefix, const CString& extension=L"" );
106
107 bool Has(const CString& key) const;
108 void Remove(const CString& key);
109
110 CString GetPluginId();
111
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; 81 bool IsPluginEnabled() const;
122 82
123 bool IsPluginSelftestEnabled();
124
125 bool FilterlistExpired(CString filterlist) const;
126 bool SetFilterRefreshDate(CString filterlist, time_t refreshtime);
127
128 std::map<CString, CString> GetFilterLanguageTitleList() const; 83 std::map<CString, CString> GetFilterLanguageTitleList() const;
129 84
130 void SetMainProcessId();
131 void SetMainProcessId(DWORD id);
132 bool IsMainProcess(DWORD dwProcessId=0) const;
133
134 void SetMainUiThreadId();
135 void SetMainUiThreadId(DWORD id);
136 bool IsMainUiThread(DWORD dwThread=0) const;
137
138 void SetMainThreadId();
139 void SetMainThreadId(DWORD id);
140 bool IsMainThread(DWORD dwThread=0) const;
141
142 void SetWorkingThreadId(); 85 void SetWorkingThreadId();
143 void SetWorkingThreadId(DWORD id); 86 void SetWorkingThreadId(DWORD id);
144 bool IsWorkingThread(DWORD dwThread=0) const; 87 bool IsWorkingThread(DWORD dwThread=0) const;
145 88
146 void SetFirstRun(); 89 void SetFirstRun();
147 bool IsFirstRun() const; 90 bool IsFirstRun() const;
148 91
149 void SetFirstRunUpdate();
150 bool IsFirstRunUpdate() const;
151
152 bool IsFirstRunAny() const;
153
154 static CString GetSystemLanguage(); 92 static CString GetSystemLanguage();
155 DWORD m_WindowsBuildNumber; 93 DWORD m_WindowsBuildNumber;
156 94
157 private: 95 private:
158 96
159 bool m_isDirtyTab;
160 bool m_isPluginEnabledTab; 97 bool m_isPluginEnabledTab;
161 98
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: 99 public:
173 100
174 void EraseTab();
175
176 CString GetTabNumber() const;
177
178 bool IncrementTabCount();
179 bool DecrementTabCount();
180
181 void TogglePluginEnabled(); 101 void TogglePluginEnabled();
182 void SetPluginDisabled(); 102 void SetPluginDisabled();
183 void SetPluginEnabled(); 103 void SetPluginEnabled();
184 bool GetPluginEnabled() const; 104 bool GetPluginEnabled() const;
185 105
186 void AddError(const CString& error, const CString& errorCode); 106 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 107
199 // Settings whitelist 108 // Settings whitelist
200 #ifdef SUPPORT_WHITELIST 109 #ifdef SUPPORT_WHITELIST
201 110
202 private: 111 private:
203 std::vector<std::wstring> m_whitelistedDomains; 112 std::vector<std::wstring> m_whitelistedDomains;
204 113
205 void ClearWhitelist(); 114 void ClearWhitelist();
206 bool ReadWhitelist(bool bDebug=true); 115 bool ReadWhitelist(bool bDebug=true);
207 116
208 public: 117 public:
209 void AddWhiteListedDomain(const CString& domain); 118 void AddWhiteListedDomain(const CString& domain);
210 void RemoveWhiteListedDomain(const CString& domain); 119 void RemoveWhiteListedDomain(const CString& domain);
211 int GetWhiteListedDomainCount() const; 120 int GetWhiteListedDomainCount() const;
212 std::vector<std::wstring> GetWhiteListedDomainList(); 121 std::vector<std::wstring> GetWhiteListedDomainList();
213 #endif //SUPPORT_WHITELIST 122 #endif //SUPPORT_WHITELIST
214 123
215 bool RefreshWhitelist(); 124 bool RefreshWhitelist();
216 DWORD GetWindowsBuildNumber(); 125 DWORD GetWindowsBuildNumber();
217 126
218 void SetSubscription(const std::wstring& url); 127 void SetSubscription(const std::wstring& url);
219 void SetDefaultSubscription(); 128 void SetDefaultSubscription();
220 CString GetSubscription(); 129 CString GetSubscription();
221 void RefreshFilterlist();
222 130
131 bool GetStatusBarAsked();
132 void SetStatusBarAsked();
223 std::vector<SubscriptionDescription> m_subscriptions; 133 std::vector<SubscriptionDescription> m_subscriptions;
224 }; 134 };
225 135
226 136
227 #endif // _PLUGIN_SETTINGS_H_ 137 #endif // _PLUGIN_SETTINGS_H_
OLDNEW
« no previous file with comments | « src/plugin/PluginSelftest.h ('k') | src/plugin/PluginSettings.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld