OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_ENUMERATE_MODULES_MODEL_WIN_H_ | 5 #ifndef CHROME_BROWSER_ENUMERATE_MODULES_MODEL_WIN_H_ |
6 #define CHROME_BROWSER_ENUMERATE_MODULES_MODEL_WIN_H_ | 6 #define CHROME_BROWSER_ENUMERATE_MODULES_MODEL_WIN_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 }; | 55 }; |
56 | 56 |
57 // A bitmask with the possible resolutions for bad modules. | 57 // A bitmask with the possible resolutions for bad modules. |
58 enum RecommendedAction { | 58 enum RecommendedAction { |
59 NONE = 0, | 59 NONE = 0, |
60 INVESTIGATING = 1 << 0, | 60 INVESTIGATING = 1 << 0, |
61 UNINSTALL = 1 << 1, | 61 UNINSTALL = 1 << 1, |
62 DISABLE = 1 << 2, | 62 DISABLE = 1 << 2, |
63 UPDATE = 1 << 3, | 63 UPDATE = 1 << 3, |
64 SEE_LINK = 1 << 4, | 64 SEE_LINK = 1 << 4, |
| 65 NOTIFY_USER = 1 << 5, |
| 66 }; |
| 67 |
| 68 // Which Windows OS is affected. |
| 69 enum OperatingSystem { |
| 70 ALL = -1, |
| 71 XP = 1 << 0, |
65 }; | 72 }; |
66 | 73 |
67 // The structure we populate when enumerating modules. | 74 // The structure we populate when enumerating modules. |
68 struct Module { | 75 struct Module { |
69 // The type of module found | 76 // The type of module found |
70 ModuleType type; | 77 ModuleType type; |
71 // The module status (benign/bad/etc). | 78 // The module status (benign/bad/etc). |
72 ModuleStatus status; | 79 ModuleStatus status; |
73 // The module path, not including filename. | 80 // The module path, not including filename. |
74 string16 location; | 81 string16 location; |
(...skipping 19 matching lines...) Expand all Loading... |
94 // A vector typedef of all modules enumerated. | 101 // A vector typedef of all modules enumerated. |
95 typedef std::vector<Module> ModulesVector; | 102 typedef std::vector<Module> ModulesVector; |
96 | 103 |
97 // A structure we populate with the blacklist entries. | 104 // A structure we populate with the blacklist entries. |
98 struct BlacklistEntry { | 105 struct BlacklistEntry { |
99 const char* filename; | 106 const char* filename; |
100 const char* location; | 107 const char* location; |
101 const char* desc_or_signer; | 108 const char* desc_or_signer; |
102 const char* version_from; // Version where conflict started. | 109 const char* version_from; // Version where conflict started. |
103 const char* version_to; // First version that works. | 110 const char* version_to; // First version that works. |
| 111 OperatingSystem os; // Bitmask, representing what OS this entry applies to. |
104 RecommendedAction help_tip; | 112 RecommendedAction help_tip; |
105 }; | 113 }; |
106 | 114 |
107 // A static function that normalizes the module information in the |module| | 115 // A static function that normalizes the module information in the |module| |
108 // struct. Module information needs to be normalized before comparing against | 116 // struct. Module information needs to be normalized before comparing against |
109 // the blacklist. This is because the same module can be described in many | 117 // the blacklist. This is because the same module can be described in many |
110 // different ways, ie. file paths can be presented in long/short name form, | 118 // different ways, ie. file paths can be presented in long/short name form, |
111 // and are not case sensitive on Windows. Also, the version string returned | 119 // and are not case sensitive on Windows. Also, the version string returned |
112 // can include appended text, which we don't want to use during comparison | 120 // can include appended text, which we don't want to use during comparison |
113 // against the blacklist. | 121 // against the blacklist. |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 // | 232 // |
225 // To use this class, grab the singleton pointer and call ScanNow(). | 233 // To use this class, grab the singleton pointer and call ScanNow(). |
226 // Then wait to get notified through MODULE_LIST_ENUMERATED when the list is | 234 // Then wait to get notified through MODULE_LIST_ENUMERATED when the list is |
227 // ready. | 235 // ready. |
228 // | 236 // |
229 // This class can be used on the UI thread as it asynchronously offloads the | 237 // This class can be used on the UI thread as it asynchronously offloads the |
230 // file work over to the FILE thread and reports back to the caller with a | 238 // file work over to the FILE thread and reports back to the caller with a |
231 // notification. | 239 // notification. |
232 class EnumerateModulesModel { | 240 class EnumerateModulesModel { |
233 public: | 241 public: |
| 242 // UMA histogram constants. |
| 243 enum UmaModuleConflictHistogramOptions { |
| 244 ACTION_BUBBLE_SHOWN = 0, |
| 245 ACTION_BUBBLE_LEARN_MORE, |
| 246 ACTION_MENU_LEARN_MORE, |
| 247 ACTION_BOUNDARY, // Must be the last value. |
| 248 }; |
| 249 |
234 static EnumerateModulesModel* GetInstance(); | 250 static EnumerateModulesModel* GetInstance(); |
235 | 251 |
| 252 // Record via UMA what the user selected. |
| 253 static void RecordLearnMoreStat(bool from_menu); |
| 254 |
236 // Returns true if we should show the conflict notification. The conflict | 255 // Returns true if we should show the conflict notification. The conflict |
237 // notification is only shown once during the lifetime of the process. | 256 // notification is only shown once during the lifetime of the process. |
238 bool ShouldShowConflictWarning() const; | 257 bool ShouldShowConflictWarning() const; |
239 | 258 |
240 // Called when the user has acknowledged the conflict notification. | 259 // Called when the user has acknowledged the conflict notification. |
241 void AcknowledgeConflictNotification(); | 260 void AcknowledgeConflictNotification(); |
242 | 261 |
243 // Returns the number of suspected bad modules found in the last scan. | 262 // Returns the number of suspected bad modules found in the last scan. |
244 // Returns 0 if no scan has taken place yet. | 263 // Returns 0 if no scan has taken place yet. |
245 int suspected_bad_modules_detected() const { | 264 int suspected_bad_modules_detected() const { |
246 return suspected_bad_modules_detected_; | 265 return suspected_bad_modules_detected_; |
247 } | 266 } |
248 | 267 |
249 // Returns the number of confirmed bad modules found in the last scan. | 268 // Returns the number of confirmed bad modules found in the last scan. |
250 // Returns 0 if no scan has taken place yet. | 269 // Returns 0 if no scan has taken place yet. |
251 int confirmed_bad_modules_detected() const { | 270 int confirmed_bad_modules_detected() const { |
252 return confirmed_bad_modules_detected_; | 271 return confirmed_bad_modules_detected_; |
253 } | 272 } |
254 | 273 |
| 274 // Returns how many modules to notify the user about. |
| 275 int modules_to_notify_about() const { |
| 276 return modules_to_notify_about_; |
| 277 } |
| 278 |
255 // Set to true when we the scanning process can not rely on certain Chrome | 279 // Set to true when we the scanning process can not rely on certain Chrome |
256 // services to exists. | 280 // services to exists. |
257 void set_limited_mode(bool limited_mode) { | 281 void set_limited_mode(bool limited_mode) { |
258 limited_mode_ = limited_mode; | 282 limited_mode_ = limited_mode; |
259 } | 283 } |
260 | 284 |
| 285 // Checks to see if a scanning task should be started and sets one off, if so. |
| 286 void MaybePostScanningTask(); |
| 287 |
261 // Asynchronously start the scan for the loaded module list, except when in | 288 // Asynchronously start the scan for the loaded module list, except when in |
262 // limited_mode (in which case it blocks). | 289 // limited_mode (in which case it blocks). |
263 void ScanNow(); | 290 void ScanNow(); |
264 | 291 |
265 // Gets the whole module list as a ListValue. | 292 // Gets the whole module list as a ListValue. |
266 base::ListValue* GetModuleList() const; | 293 base::ListValue* GetModuleList() const; |
267 | 294 |
| 295 // Gets the Help Center URL for the first *notable* conflict module that we've |
| 296 // elected to notify the user about. |
| 297 GURL GetFirstNotableConflict(); |
| 298 |
268 private: | 299 private: |
269 friend struct DefaultSingletonTraits<EnumerateModulesModel>; | 300 friend struct DefaultSingletonTraits<EnumerateModulesModel>; |
270 friend class ModuleEnumerator; | 301 friend class ModuleEnumerator; |
271 | 302 |
272 EnumerateModulesModel(); | 303 EnumerateModulesModel(); |
273 virtual ~EnumerateModulesModel(); | 304 virtual ~EnumerateModulesModel(); |
274 | 305 |
275 // Called on the UI thread when the helper class is done scanning. | 306 // Called on the UI thread when the helper class is done scanning. |
276 void DoneScanning(); | 307 void DoneScanning(); |
277 | 308 |
(...skipping 23 matching lines...) Expand all Loading... |
301 // True if we are currently scanning for modules. | 332 // True if we are currently scanning for modules. |
302 bool scanning_; | 333 bool scanning_; |
303 | 334 |
304 // Whether the conflict notification has been acknowledged by the user. | 335 // Whether the conflict notification has been acknowledged by the user. |
305 bool conflict_notification_acknowledged_; | 336 bool conflict_notification_acknowledged_; |
306 | 337 |
307 // The number of confirmed bad modules (not including suspected bad ones) | 338 // The number of confirmed bad modules (not including suspected bad ones) |
308 // found during last scan. | 339 // found during last scan. |
309 int confirmed_bad_modules_detected_; | 340 int confirmed_bad_modules_detected_; |
310 | 341 |
| 342 // The number of bad modules the user needs to be aggressively notified about. |
| 343 int modules_to_notify_about_; |
| 344 |
311 // The number of suspected bad modules (not including confirmed bad ones) | 345 // The number of suspected bad modules (not including confirmed bad ones) |
312 // found during last scan. | 346 // found during last scan. |
313 int suspected_bad_modules_detected_; | 347 int suspected_bad_modules_detected_; |
314 | 348 |
315 DISALLOW_COPY_AND_ASSIGN(EnumerateModulesModel); | 349 DISALLOW_COPY_AND_ASSIGN(EnumerateModulesModel); |
316 }; | 350 }; |
317 | 351 |
318 #endif // CHROME_BROWSER_ENUMERATE_MODULES_MODEL_WIN_H_ | 352 #endif // CHROME_BROWSER_ENUMERATE_MODULES_MODEL_WIN_H_ |
OLD | NEW |