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 refactoring. Removing main thread, tab counting. Implementing SetPref and GetPref. Addressing … Created July 9, 2013, 12:59 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
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 bool m_isDirty;
71
72 CString m_settingsVersion; 64 CString m_settingsVersion;
Wladimir Palant 2013/07/11 12:53:10 Still unused.
73 65
74 static CComAutoCriticalSection s_criticalSectionLocal; 66 static CComAutoCriticalSection s_criticalSectionLocal;
75 #ifdef SUPPORT_WHITELIST
76 static CComAutoCriticalSection s_criticalSectionDomainHistory;
77 #endif
78 67
79 void Clear(); 68 void Clear();
80 69
81 // Private constructor used by the singleton pattern 70 // Private constructor used by the singleton pattern
82 CPluginSettings(); 71 CPluginSettings();
83 public: 72 public:
84 73
85 ~CPluginSettings(); 74 ~CPluginSettings();
86 75
87 static CPluginSettings* s_instance; 76 static CPluginSettings* s_instance;
88 77
89 static bool s_isLightOnly; 78 static bool s_isLightOnly;
Wladimir Palant 2013/07/11 12:53:10 Still unused.
90 static bool HasInstance(); 79 static bool HasInstance();
91 static CPluginSettings* GetInstance(); 80 static CPluginSettings* GetInstance();
92 81
93 static CString GetDataPath(const CString& filename=L""); 82 static CString GetDataPath(const CString& filename=L"");
94 83
95 static CString GetTempPath(const CString& filename=L"");
96 static CString GetTempFile(const CString& prefix, const CString& extension=L"" );
97
98 CString GetPluginId();
99
100 bool IsPluginEnabled() const; 84 bool IsPluginEnabled() const;
101 85
102 bool IsPluginSelftestEnabled();
103
104 bool FilterlistExpired(CString filterlist) const;
105 bool SetFilterRefreshDate(CString filterlist, time_t refreshtime);
106
107 std::map<CString, CString> GetFilterLanguageTitleList() const; 86 std::map<CString, CString> GetFilterLanguageTitleList() const;
108 87
109 void SetMainProcessId();
110 void SetMainProcessId(DWORD id);
111 bool IsMainProcess(DWORD dwProcessId=0) const;
112
113 void SetMainUiThreadId();
114 void SetMainUiThreadId(DWORD id);
115 bool IsMainUiThread(DWORD dwThread=0) const;
116
117 void SetMainThreadId();
118 void SetMainThreadId(DWORD id);
119 bool IsMainThread(DWORD dwThread=0) const;
120
121 void SetWorkingThreadId(); 88 void SetWorkingThreadId();
122 void SetWorkingThreadId(DWORD id); 89 void SetWorkingThreadId(DWORD id);
123 bool IsWorkingThread(DWORD dwThread=0) const; 90 bool IsWorkingThread(DWORD dwThread=0) const;
124 91
125 void SetFirstRun(); 92 void SetFirstRun();
126 bool IsFirstRun() const; 93 bool IsFirstRun() const;
127 94
128 void SetFirstRunUpdate();
129 bool IsFirstRunUpdate() const;
130
131 bool IsFirstRunAny() const;
132
133 static CString GetSystemLanguage(); 95 static CString GetSystemLanguage();
134 DWORD m_WindowsBuildNumber; 96 DWORD m_WindowsBuildNumber;
135 97
136 private: 98 private:
137 99
138 bool m_isPluginEnabledTab; 100 bool m_isPluginEnabledTab;
139 101
140 public: 102 public:
141 103
142 CString GetTabNumber() const;
143
144 bool IncrementTabCount();
145 bool DecrementTabCount();
146
147 void TogglePluginEnabled(); 104 void TogglePluginEnabled();
148 void SetPluginDisabled(); 105 void SetPluginDisabled();
149 void SetPluginEnabled(); 106 void SetPluginEnabled();
150 bool GetPluginEnabled() const; 107 bool GetPluginEnabled() const;
151 108
152 void AddError(const CString& error, const CString& errorCode); 109 void AddError(const CString& error, const CString& errorCode);
153 110
154 // Settings whitelist 111 // Settings whitelist
155 #ifdef SUPPORT_WHITELIST 112 #ifdef SUPPORT_WHITELIST
156 113
157 private: 114 private:
158 std::vector<std::wstring> m_whitelistedDomains; 115 std::vector<std::wstring> m_whitelistedDomains;
159 116
160 void ClearWhitelist(); 117 void ClearWhitelist();
161 bool ReadWhitelist(bool bDebug=true); 118 bool ReadWhitelist(bool bDebug=true);
162 119
163 public: 120 public:
164 void AddWhiteListedDomain(const CString& domain); 121 void AddWhiteListedDomain(const CString& domain);
165 void RemoveWhiteListedDomain(const CString& domain); 122 void RemoveWhiteListedDomain(const CString& domain);
166 int GetWhiteListedDomainCount() const; 123 int GetWhiteListedDomainCount() const;
167 std::vector<std::wstring> GetWhiteListedDomainList(); 124 std::vector<std::wstring> GetWhiteListedDomainList();
168 #endif //SUPPORT_WHITELIST 125 #endif //SUPPORT_WHITELIST
169 126
170 bool RefreshWhitelist(); 127 bool RefreshWhitelist();
171 DWORD GetWindowsBuildNumber(); 128 DWORD GetWindowsBuildNumber();
172 129
173 void SetSubscription(const std::wstring& url); 130 void SetSubscription(const std::wstring& url);
174 void SetDefaultSubscription(); 131 void SetDefaultSubscription();
175 CString GetSubscription(); 132 CString GetSubscription();
176 void RefreshFilterlist();
177 133
178 bool GetStatusBarAsked(); 134 bool GetStatusBarAsked();
179 void SetStatusBarAsked(bool asked); 135 void SetStatusBarAsked();
180 std::vector<SubscriptionDescription> m_subscriptions; 136 std::vector<SubscriptionDescription> m_subscriptions;
181 }; 137 };
182 138
183 139
184 #endif // _PLUGIN_SETTINGS_H_ 140 #endif // _PLUGIN_SETTINGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld