Chromium Code Reviews| 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_WIN_ENUMERATE_MODULES_MODEL_H_ | 5 #ifndef CHROME_BROWSER_WIN_ENUMERATE_MODULES_MODEL_H_ |
| 6 #define CHROME_BROWSER_WIN_ENUMERATE_MODULES_MODEL_H_ | 6 #define CHROME_BROWSER_WIN_ENUMERATE_MODULES_MODEL_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | |
|
grt (UTC plus 2)
2016/07/25 10:57:11
unused?
chrisha
2016/07/26 21:21:17
Done.
| |
| 11 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/singleton.h" | 15 #include "base/memory/singleton.h" |
| 16 #include "base/observer_list.h" | |
| 15 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 16 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
| 17 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 18 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 19 | 21 |
| 20 class EnumerateModulesModel; | 22 class EnumerateModulesModel; |
| 21 | 23 |
| 22 namespace base { | 24 namespace base { |
| 23 class FilePath; | 25 class FilePath; |
| 24 class ListValue; | 26 class ListValue; |
| 25 } | 27 } |
| 26 | 28 |
| 27 // A helper class that implements the enumerate module functionality on the File | 29 // A helper class that implements the enumerate module functionality on the File |
|
grt (UTC plus 2)
2016/07/25 10:57:11
File -> FILE
chrisha
2016/07/26 21:21:18
Done.
| |
| 28 // thread. | 30 // thread. Not to be used directly. |
| 29 class ModuleEnumerator : public base::RefCountedThreadSafe<ModuleEnumerator> { | 31 class ModuleEnumerator : public base::RefCountedThreadSafe<ModuleEnumerator> { |
|
grt (UTC plus 2)
2016/07/25 10:57:11
it looks like this is owned by the model. does it
chrisha
2016/07/26 21:21:17
Can't see any reason why it needs to be.
| |
| 30 public: | 32 public: |
| 31 // What type of module we are dealing with. Loaded modules are modules we | 33 // What type of module we are dealing with. Loaded modules are modules we |
| 32 // detect as loaded in the process at the time of scanning. The others are | 34 // detect as loaded in the process at the time of scanning. The others are |
| 33 // modules of interest and may or may not be loaded in the process at the | 35 // modules of interest and may or may not be loaded in the process at the |
| 34 // time of scan. | 36 // time of scan. |
| 35 enum ModuleType { | 37 enum ModuleType { |
| 36 LOADED_MODULE = 1 << 0, | 38 LOADED_MODULE = 1 << 0, |
| 37 SHELL_EXTENSION = 1 << 1, | 39 SHELL_EXTENSION = 1 << 1, |
| 38 WINSOCK_MODULE_REGISTRATION = 1 << 2, | 40 WINSOCK_MODULE_REGISTRATION = 1 << 2, |
| 39 }; | 41 }; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 // The duplicate count within each category of modules. | 110 // The duplicate count within each category of modules. |
| 109 int duplicate_count; | 111 int duplicate_count; |
| 110 // Whether this module has been normalized (necessary before checking it | 112 // Whether this module has been normalized (necessary before checking it |
| 111 // against blacklist). | 113 // against blacklist). |
| 112 bool normalized; | 114 bool normalized; |
| 113 }; | 115 }; |
| 114 | 116 |
| 115 // A vector typedef of all modules enumerated. | 117 // A vector typedef of all modules enumerated. |
| 116 typedef std::vector<Module> ModulesVector; | 118 typedef std::vector<Module> ModulesVector; |
| 117 | 119 |
| 118 // A structure we populate with the blacklist entries. | |
| 119 struct BlacklistEntry { | |
| 120 const char* filename; | |
| 121 const char* location; | |
| 122 const char* desc_or_signer; | |
| 123 const char* version_from; // Version where conflict started. | |
| 124 const char* version_to; // First version that works. | |
| 125 OperatingSystem os; // Bitmask, representing what OS this entry applies to. | |
| 126 RecommendedAction help_tip; | |
| 127 }; | |
| 128 | |
| 129 // A static function that normalizes the module information in the |module| | 120 // A static function that normalizes the module information in the |module| |
| 130 // struct. Module information needs to be normalized before comparing against | 121 // struct. Module information needs to be normalized before comparing against |
| 131 // the blacklist. This is because the same module can be described in many | 122 // the blacklist. This is because the same module can be described in many |
| 132 // different ways, ie. file paths can be presented in long/short name form, | 123 // different ways, ie. file paths can be presented in long/short name form, |
| 133 // and are not case sensitive on Windows. Also, the version string returned | 124 // and are not case sensitive on Windows. Also, the version string returned |
| 134 // can include appended text, which we don't want to use during comparison | 125 // can include appended text, which we don't want to use during comparison |
| 135 // against the blacklist. | 126 // against the blacklist. |
| 136 static void NormalizeModule(Module* module); | 127 static void NormalizeModule(Module* module); |
| 137 | 128 |
| 138 // A static function that checks whether |module| has been |blacklisted|. | |
| 139 static ModuleStatus Match(const Module& module, | |
| 140 const BlacklistEntry& blacklisted); | |
| 141 | |
| 142 explicit ModuleEnumerator(EnumerateModulesModel* observer); | 129 explicit ModuleEnumerator(EnumerateModulesModel* observer); |
| 143 | 130 |
| 144 // Start scanning the loaded module list (if a scan is not already in | 131 // Start scanning the loaded module list (if a scan is not already in |
| 145 // progress). This function does not block while reading the module list | 132 // progress). This function does not block while reading the module list and |
| 146 // (unless we are in limited_mode, see below), and will notify when done | 133 // will notify when done through the MODULE_LIST_ENUMERATED notification. |
|
grt (UTC plus 2)
2016/07/25 10:57:11
MODULE_LIST_ENUMERATED notification -> observers'
chrisha
2016/07/26 21:21:18
Done.
| |
| 147 // through the MODULE_LIST_ENUMERATED notification. | |
| 148 // The process will also send MODULE_INCOMPATIBILITY_BADGE_CHANGE to let | 134 // The process will also send MODULE_INCOMPATIBILITY_BADGE_CHANGE to let |
|
grt (UTC plus 2)
2016/07/25 10:57:11
OnConflictsAcknowledged
chrisha
2016/07/26 21:21:18
Done.
| |
| 149 // observers know when it is time to update the wrench menu badge. | 135 // observers know when it is time to update the wrench menu badge. This should |
|
grt (UTC plus 2)
2016/07/25 10:57:11
should -> must, unless it's okay to call from any
chrisha
2016/07/26 21:21:18
Changed the wording. DCHECK already there.
| |
| 150 // When in |limited_mode|, this function will not leverage the File thread | 136 // only be called on the UI thread. |
| 151 // to run asynchronously and will therefore block until scanning is done | 137 void ScanNow(ModulesVector* list); |
| 152 // (and will also not send out any notifications). | |
| 153 void ScanNow(ModulesVector* list, bool limited_mode); | |
| 154 | 138 |
| 155 private: | 139 private: |
| 156 FRIEND_TEST_ALL_PREFIXES(EnumerateModulesTest, CollapsePath); | 140 FRIEND_TEST_ALL_PREFIXES(EnumerateModulesTest, CollapsePath); |
| 157 | 141 |
| 158 friend class base::RefCountedThreadSafe<ModuleEnumerator>; | 142 friend class base::RefCountedThreadSafe<ModuleEnumerator>; |
| 159 ~ModuleEnumerator(); | 143 ~ModuleEnumerator(); |
| 160 | 144 |
| 161 // The (currently) hard coded blacklist of known bad modules. | 145 // This function does the actual file scanning work on the FILE thread. It |
| 162 static const BlacklistEntry kModuleBlacklist[]; | 146 // enumerates all loaded modules in the process and other modules of interest, |
| 163 | 147 // such as the registered Winsock LSP modules and stores them in |
| 164 // This function does the actual file scanning work on the FILE thread (or | 148 // |enumerated_modules_|. It then normalizes the module info and matches them |
| 165 // block the main thread when in limited_mode). It enumerates all loaded | 149 // against a blacklist of known bad modules. Finally, it calls ReportBack to |
| 166 // modules in the process and other modules of interest, such as the | 150 // let the observer know we are done. |
| 167 // registered Winsock LSP modules and stores them in |enumerated_modules_|. | |
| 168 // It then normalizes the module info and matches them against a blacklist | |
| 169 // of known bad modules. Finally, it calls ReportBack to let the observer | |
| 170 // know we are done. | |
| 171 void ScanImpl(); | 151 void ScanImpl(); |
| 172 | 152 |
| 173 // Enumerate all modules loaded into the Chrome process. | 153 // Enumerate all modules loaded into the Chrome process. |
| 174 void EnumerateLoadedModules(); | 154 void EnumerateLoadedModules(); |
| 175 | 155 |
| 176 // Enumerate all registered Windows shell extensions. | 156 // Enumerate all registered Windows shell extensions. |
| 177 void EnumerateShellExtensions(); | 157 void EnumerateShellExtensions(); |
| 178 | 158 |
| 179 // Enumerate all registered Winsock LSP modules. | 159 // Enumerate all registered Winsock LSP modules. |
| 180 void EnumerateWinsockModules(); | 160 void EnumerateWinsockModules(); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 198 // we can use for comparison against our blacklist (which uses only env vars). | 178 // we can use for comparison against our blacklist (which uses only env vars). |
| 199 // NOTE: The vector will not contain an exhaustive list of environment | 179 // NOTE: The vector will not contain an exhaustive list of environment |
| 200 // variables, only the ones currently found on the blacklist or ones that are | 180 // variables, only the ones currently found on the blacklist or ones that are |
| 201 // likely to appear there. | 181 // likely to appear there. |
| 202 void PreparePathMappings(); | 182 void PreparePathMappings(); |
| 203 | 183 |
| 204 // For a given |module|, collapse the path from c:\windows to %systemroot%, | 184 // For a given |module|, collapse the path from c:\windows to %systemroot%, |
| 205 // based on the |path_mapping_| vector. | 185 // based on the |path_mapping_| vector. |
| 206 void CollapsePath(Module* module); | 186 void CollapsePath(Module* module); |
| 207 | 187 |
| 208 // Takes each module in the |enumerated_modules_| vector and matches it | |
| 209 // against a fixed blacklist of bad and suspected bad modules. | |
| 210 void MatchAgainstBlacklist(); | |
| 211 | |
| 212 // This function executes on the UI thread when the scanning and matching | 188 // This function executes on the UI thread when the scanning and matching |
| 213 // process is done. It notifies the observer. | 189 // process is done. It notifies the observer. This should only be called on |
|
grt (UTC plus 2)
2016/07/25 10:57:11
should -> must
chrisha
2016/07/26 21:21:17
Done.
| |
| 190 // the UI thread. | |
| 214 void ReportBack(); | 191 void ReportBack(); |
| 215 | 192 |
| 216 // Given a filename, returns the Subject (who signed it) retrieved from | 193 // Given a filename, returns the Subject (who signed it) retrieved from |
| 217 // the digital signature (Authenticode). | 194 // the digital signature (Authenticode). |
| 218 base::string16 GetSubjectNameFromDigitalSignature( | 195 base::string16 GetSubjectNameFromDigitalSignature( |
| 219 const base::FilePath& filename); | 196 const base::FilePath& filename); |
| 220 | 197 |
| 198 // Reports (via UMA) a handful of high-level metrics regarding third party | |
| 199 // modules in this process. Called by ScanImpl after modules have been | |
| 200 // enmerated and processed. | |
| 201 void ReportThirdPartyMetrics(); | |
| 202 | |
| 221 // The typedef for the vector that maps a regular file path to %env_var%. | 203 // The typedef for the vector that maps a regular file path to %env_var%. |
| 222 typedef std::vector< std::pair<base::string16, base::string16> > PathMapping; | 204 typedef std::vector<std::pair<base::string16, base::string16>> PathMapping; |
| 223 | 205 |
| 224 // The vector of paths to %env_var%, used to account for differences in | 206 // The vector of paths to %env_var%, used to account for differences in |
| 225 // where people keep there files, c:\windows vs. d:\windows, etc. | 207 // where people keep there files, c:\windows vs. d:\windows, etc. |
| 226 PathMapping path_mapping_; | 208 PathMapping path_mapping_; |
| 227 | 209 |
| 228 // The vector containing all the enumerated modules (loaded and modules of | 210 // The vector containing all the enumerated modules (loaded and modules of |
| 229 // interest). | 211 // interest). |
| 230 ModulesVector* enumerated_modules_; | 212 ModulesVector* enumerated_modules_; |
| 231 | 213 |
| 232 // The observer, who needs to be notified when we are done. | 214 // The observers, who need to be notified when the scan is complete. |
| 233 EnumerateModulesModel* observer_; | 215 EnumerateModulesModel* observer_; |
| 234 | 216 |
| 235 // See limited_mode below. | |
| 236 bool limited_mode_; | |
| 237 | |
| 238 // The thread that we need to call back on to report that we are done. | |
| 239 content::BrowserThread::ID callback_thread_id_; | |
| 240 | |
| 241 DISALLOW_COPY_AND_ASSIGN(ModuleEnumerator); | 217 DISALLOW_COPY_AND_ASSIGN(ModuleEnumerator); |
| 242 }; | 218 }; |
| 243 | 219 |
| 244 // This is a singleton class that enumerates all modules loaded into Chrome, | 220 // This is a singleton class that enumerates all modules loaded into Chrome, |
|
grt (UTC plus 2)
2016/07/25 10:57:11
if this is the class that consumers of this .h are
chrisha
2016/07/26 21:21:17
+1. Will do in a follow-up CL. Added a comment to
| |
| 245 // both currently loaded modules (called DLLs on Windows) and modules 'of | 221 // both currently loaded modules (called DLLs on Windows) and modules 'of |
| 246 // interest', such as WinSock LSP modules. This class also marks each module | 222 // interest', such as WinSock LSP modules. This class also marks each module |
| 247 // as benign or suspected bad or outright bad, using a supplied blacklist that | 223 // as benign or suspected bad or outright bad, using a supplied blacklist that |
| 248 // is currently hard-coded. | 224 // is currently hard-coded. |
| 249 // | 225 // |
| 250 // To use this class, grab the singleton pointer and call ScanNow(). | 226 // To use this class, grab the singleton pointer and call ScanNow(). |
| 251 // Then wait to get notified through MODULE_LIST_ENUMERATED when the list is | 227 // Then wait to get notified through MODULE_LIST_ENUMERATED when the list is |
| 252 // ready. | 228 // ready. |
| 253 // | 229 // |
| 254 // This class can be used on the UI thread as it asynchronously offloads the | 230 // This class is intended to be used from the UI thread. The bulk of the work is |
|
grt (UTC plus 2)
2016/07/25 10:57:11
after reading the individual method doc comments,
chrisha
2016/07/26 21:21:18
Done.
| |
| 255 // file work over to the FILE thread and reports back to the caller with a | 231 // actually performed on the FILE thread. |
| 256 // notification. | |
| 257 class EnumerateModulesModel { | 232 class EnumerateModulesModel { |
| 258 public: | 233 public: |
| 259 // UMA histogram constants. | 234 // UMA histogram constants. |
| 260 enum UmaModuleConflictHistogramOptions { | 235 enum UmaModuleConflictHistogramOptions { |
| 261 ACTION_BUBBLE_SHOWN = 0, | 236 ACTION_BUBBLE_SHOWN = 0, |
| 262 ACTION_BUBBLE_LEARN_MORE, | 237 ACTION_BUBBLE_LEARN_MORE, |
| 263 ACTION_MENU_LEARN_MORE, | 238 ACTION_MENU_LEARN_MORE, |
| 264 ACTION_BOUNDARY, // Must be the last value. | 239 ACTION_BOUNDARY, // Must be the last value. |
| 265 }; | 240 }; |
| 266 | 241 |
| 242 // Observer class used to receive the list of modules when enumeration is | |
| 243 // finished. | |
| 244 class Observer { | |
| 245 public: | |
| 246 // Invoked when EnumerateModulesModel has completed a scan of modules. | |
| 247 virtual void OnScanCompleted() {} | |
| 248 | |
| 249 // Invoked when a user has acknowledge incompatible modules found in a | |
| 250 // module scan. | |
| 251 virtual void OnConflictsAcknowledged() {} | |
| 252 | |
| 253 protected: | |
| 254 virtual ~Observer() = default; | |
| 255 }; | |
| 256 | |
| 257 EnumerateModulesModel(); | |
| 258 virtual ~EnumerateModulesModel() {} | |
|
grt (UTC plus 2)
2016/07/25 10:57:11
this is a singleton, right? is it designed to be t
chrisha
2016/07/26 21:21:18
Done.
| |
| 259 | |
| 260 // Returns the singleton instance of this class. Can be called on any thread. | |
|
grt (UTC plus 2)
2016/07/25 10:57:11
why called on any thread? the class doc says it's
chrisha
2016/07/26 21:21:18
It only gets used from the UI thread right now. Si
| |
| 267 static EnumerateModulesModel* GetInstance(); | 261 static EnumerateModulesModel* GetInstance(); |
| 268 | 262 |
| 263 // Adds an |observer| to the enumerator. May only be called from the UI thread | |
| 264 // and callbacks will also occur on the UI thread. | |
| 265 void AddObserver(Observer* observer); | |
| 266 | |
| 267 // Removes an |observer| from the enumerator. May only be called from the UI | |
| 268 // thread and callbacks will also occur on the UI thread. | |
| 269 void RemoveObserver(Observer* observer); | |
| 270 | |
| 269 // Returns true if we should show the conflict notification. The conflict | 271 // Returns true if we should show the conflict notification. The conflict |
| 270 // notification is only shown once during the lifetime of the process. | 272 // notification is only shown once during the lifetime of the process. May |
| 273 // only be called from the UI thread. | |
| 271 bool ShouldShowConflictWarning() const; | 274 bool ShouldShowConflictWarning() const; |
| 272 | 275 |
| 273 // Called when the user has acknowledged the conflict notification. | 276 // Called when the user has acknowledged the conflict notification. May only |
| 277 // be called from the UI thread. | |
| 274 void AcknowledgeConflictNotification(); | 278 void AcknowledgeConflictNotification(); |
| 275 | 279 |
| 276 // Returns the number of suspected bad modules found in the last scan. | 280 // Returns the number of suspected bad modules found in the last scan. |
| 277 // Returns 0 if no scan has taken place yet. | 281 // Returns 0 if no scan has taken place yet. May only be called from the UI |
| 278 int suspected_bad_modules_detected() const { | 282 // thread. |
| 279 return suspected_bad_modules_detected_; | 283 int suspected_bad_modules_detected() const; |
| 280 } | |
| 281 | 284 |
| 282 // Returns the number of confirmed bad modules found in the last scan. | 285 // Returns the number of confirmed bad modules found in the last scan. |
| 283 // Returns 0 if no scan has taken place yet. | 286 // Returns 0 if no scan has taken place yet. May only be called from the UI |
| 284 int confirmed_bad_modules_detected() const { | 287 // thread. |
| 285 return confirmed_bad_modules_detected_; | 288 int confirmed_bad_modules_detected() const; |
| 286 } | |
| 287 | 289 |
| 288 // Returns how many modules to notify the user about. | 290 // Returns how many modules to notify the user about. May only be called from |
| 289 int modules_to_notify_about() const { | 291 // the UI thread. |
| 290 return modules_to_notify_about_; | 292 int modules_to_notify_about() const; |
| 291 } | |
| 292 | |
| 293 // Set to true when we the scanning process can not rely on certain Chrome | |
| 294 // services to exists. | |
| 295 void set_limited_mode(bool limited_mode) { | |
| 296 limited_mode_ = limited_mode; | |
| 297 } | |
| 298 | 293 |
| 299 // Checks to see if a scanning task should be started and sets one off, if so. | 294 // Checks to see if a scanning task should be started and sets one off, if so. |
| 295 // Can be called from any thread. | |
| 300 void MaybePostScanningTask(); | 296 void MaybePostScanningTask(); |
| 301 | 297 |
| 302 // Asynchronously start the scan for the loaded module list, except when in | 298 // Asynchronously start the scan for the loaded module list. Can be called |
| 303 // limited_mode (in which case it blocks). | 299 // from any thread. |
| 304 void ScanNow(); | 300 void ScanNow(); |
| 305 | 301 |
| 306 // Gets the whole module list as a ListValue. | 302 // Gets the whole module list as a ListValue. Can be called from any thread. |
| 307 base::ListValue* GetModuleList() const; | 303 // Acquires lock_. |
| 304 base::ListValue* GetModuleList(); | |
| 308 | 305 |
| 309 // Gets the Help Center URL for the first *notable* conflict module that we've | 306 // Returns the site to which the user should be taken when the conflict bubble |
| 310 // elected to notify the user about. | 307 // or app menu item is clicked. For now this is simply chrome://conflicts, |
| 311 GURL GetFirstNotableConflict(); | 308 // which contains detailed information about conflicts. Returns an empty URL |
| 309 // if there are no conficts. May only be called on UI thread. | |
| 310 GURL GetConflictUrl(); | |
| 312 | 311 |
| 313 private: | 312 private: |
| 314 friend struct base::DefaultSingletonTraits<EnumerateModulesModel>; | |
| 315 friend class ModuleEnumerator; | 313 friend class ModuleEnumerator; |
| 316 | 314 |
| 317 EnumerateModulesModel(); | |
| 318 virtual ~EnumerateModulesModel(); | |
| 319 | |
| 320 // Called on the UI thread when the helper class is done scanning. | 315 // Called on the UI thread when the helper class is done scanning. |
| 321 void DoneScanning(); | 316 void DoneScanning(); |
| 322 | 317 |
| 323 // Constructs a Help Center article URL for help with a particular module. | 318 // Used to protect state that can be accessed from both the UI and FILE |
| 324 // The module must have the SEE_LINK attribute for |recommended_action| set, | 319 // threads. |
| 325 // otherwise this returns a blank string. | 320 base::Lock lock_; |
| 326 GURL ConstructHelpCenterUrl(const ModuleEnumerator::Module& module) const; | |
| 327 | 321 |
| 328 // The vector containing all the modules enumerated. Will be normalized and | 322 // The vector containing all the modules enumerated. Will be normalized and |
| 329 // any bad modules will be marked. | 323 // any bad modules will be marked. Modified under lock_, or while scanning_ |
| 324 // is true. Written to on the file thread, read from on UI thread. | |
| 330 ModuleEnumerator::ModulesVector enumerated_modules_; | 325 ModuleEnumerator::ModulesVector enumerated_modules_; |
| 331 | 326 |
| 332 // The object responsible for enumerating the modules on the File thread. | 327 // The object responsible for enumerating the modules on the File thread. |
|
grt (UTC plus 2)
2016/07/25 10:57:11
FILE
chrisha
2016/07/26 21:21:17
Done.
| |
| 328 // Only used from the UI thread. This ends up internally doing its work on the | |
| 329 // FILE thread. | |
| 333 scoped_refptr<ModuleEnumerator> module_enumerator_; | 330 scoped_refptr<ModuleEnumerator> module_enumerator_; |
| 334 | 331 |
| 335 // When this singleton object is constructed we go and fire off this timer to | 332 // When MaybePostScanningTask is called this timer is set to start scanning |
| 336 // start scanning for modules after a certain amount of time has passed. | 333 // modules after a certain amount of time has passed. |
| 337 base::OneShotTimer check_modules_timer_; | 334 base::OneShotTimer check_modules_timer_; |
| 338 | 335 |
| 339 // While normally |false|, this mode can be set to indicate that the scanning | 336 // True if we are currently scanning for modules. Under lock_. While this is |
| 340 // process should not rely on certain services normally available to Chrome, | 337 // true enumerated_modules_ can be actively written to, so is unsafe to read, |
| 341 // such as the resource bundle and the notification system, not to mention | 338 // even if lock_ is held. |
| 342 // having multiple threads. This mode is useful during diagnostics, which | |
| 343 // runs without firing up all necessary Chrome services first. | |
| 344 bool limited_mode_; | |
| 345 | |
| 346 // True if we are currently scanning for modules. | |
| 347 bool scanning_; | 339 bool scanning_; |
| 348 | 340 |
| 349 // Whether the conflict notification has been acknowledged by the user. | 341 // Whether the conflict notification has been acknowledged by the user. Only |
| 342 // modified on the UI thread. | |
| 350 bool conflict_notification_acknowledged_; | 343 bool conflict_notification_acknowledged_; |
| 351 | 344 |
| 352 // The number of confirmed bad modules (not including suspected bad ones) | 345 // The number of confirmed bad modules (not including suspected bad ones) |
| 353 // found during last scan. | 346 // found during last scan. Only modified on the UI thread. |
| 354 int confirmed_bad_modules_detected_; | 347 int confirmed_bad_modules_detected_; |
| 355 | 348 |
| 356 // The number of bad modules the user needs to be aggressively notified about. | 349 // The number of bad modules the user needs to be aggressively notified about. |
| 350 // Only modified on the UI thread. | |
| 357 int modules_to_notify_about_; | 351 int modules_to_notify_about_; |
| 358 | 352 |
| 359 // The number of suspected bad modules (not including confirmed bad ones) | 353 // The number of suspected bad modules (not including confirmed bad ones) |
| 360 // found during last scan. | 354 // found during last scan. Only modified on the UI thread. |
| 361 int suspected_bad_modules_detected_; | 355 int suspected_bad_modules_detected_; |
| 362 | 356 |
| 357 base::ObserverList<Observer> observers_; | |
| 358 | |
| 363 DISALLOW_COPY_AND_ASSIGN(EnumerateModulesModel); | 359 DISALLOW_COPY_AND_ASSIGN(EnumerateModulesModel); |
| 364 }; | 360 }; |
| 365 | 361 |
| 366 #endif // CHROME_BROWSER_WIN_ENUMERATE_MODULES_MODEL_H_ | 362 #endif // CHROME_BROWSER_WIN_ENUMERATE_MODULES_MODEL_H_ |
| OLD | NEW |