Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: extensions/browser/content_verifier.h

Issue 407043002: Content Verification: Don't access UI-thread objects on the IO thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added DCHECK Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/content_hash_fetcher.cc ('k') | extensions/browser/content_verifier.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/content_verifier.h
diff --git a/extensions/browser/content_verifier.h b/extensions/browser/content_verifier.h
index 69b6f04436b4019c41aada14236e1707b825ce12..4520c0424b7a8fd1a1e439147345429465d8d576 100644
--- a/extensions/browser/content_verifier.h
+++ b/extensions/browser/content_verifier.h
@@ -11,7 +11,11 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/scoped_observer.h"
+#include "base/version.h"
+#include "extensions/browser/content_verifier_delegate.h"
#include "extensions/browser/content_verify_job.h"
+#include "extensions/browser/extension_registry_observer.h"
namespace base {
class FilePath;
@@ -25,12 +29,13 @@ namespace extensions {
class Extension;
class ContentHashFetcher;
-class ContentVerifierDelegate;
+class ContentVerifierIOData;
// Used for managing overall content verification - both fetching content
// hashes as needed, and supplying job objects to verify file contents as they
// are read.
-class ContentVerifier : public base::RefCountedThreadSafe<ContentVerifier> {
+class ContentVerifier : public base::RefCountedThreadSafe<ContentVerifier>,
+ public ExtensionRegistryObserver {
public:
// Takes ownership of |delegate|.
ContentVerifier(content::BrowserContext* context,
@@ -49,10 +54,13 @@ class ContentVerifier : public base::RefCountedThreadSafe<ContentVerifier> {
void VerifyFailed(const std::string& extension_id,
ContentVerifyJob::FailureReason reason);
- void OnFetchComplete(const std::string& extension_id,
- bool success,
- bool was_force_check,
- const std::set<base::FilePath>& hash_mismatch_paths);
+ // ExtensionRegistryObserver interface
+ virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
+ const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(ContentVerifier);
@@ -60,19 +68,37 @@ class ContentVerifier : public base::RefCountedThreadSafe<ContentVerifier> {
friend class base::RefCountedThreadSafe<ContentVerifier>;
virtual ~ContentVerifier();
+ void OnFetchComplete(const std::string& extension_id,
+ bool success,
+ bool was_force_check,
+ const std::set<base::FilePath>& hash_mismatch_paths);
+
+ void OnFetchCompleteHelper(const std::string& extension_id,
+ bool shouldVerifyAnyPathsResult);
+
// Returns true if any of the paths in |relative_paths| *should* have their
// contents verified. (Some files get transcoded during the install process,
// so we don't want to verify their contents because they are expected not
// to match).
- bool ShouldVerifyAnyPaths(const Extension* extension,
+ bool ShouldVerifyAnyPaths(const std::string& extension_id,
+ const base::FilePath& extension_root,
const std::set<base::FilePath>& relative_paths);
+ // Set to true once we've begun shutting down.
+ bool shutdown_;
+
content::BrowserContext* context_;
scoped_ptr<ContentVerifierDelegate> delegate_;
// For fetching content hash signatures.
scoped_ptr<ContentHashFetcher> fetcher_;
+
+ // For observing the ExtensionRegistry.
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> observer_;
+
+ // Data that should only be used on the IO thread.
+ scoped_refptr<ContentVerifierIOData> io_data_;
};
} // namespace extensions
« no previous file with comments | « extensions/browser/content_hash_fetcher.cc ('k') | extensions/browser/content_verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698