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

Unified Diff: extensions/browser/content_hash_fetcher.h

Issue 288273004: A bunch of remaining parts of extension content verification (Reland) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix browser test Created 6 years, 7 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/computed_hashes.cc ('k') | extensions/browser/content_hash_fetcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/content_hash_fetcher.h
diff --git a/extensions/browser/content_hash_fetcher.h b/extensions/browser/content_hash_fetcher.h
index 60d746f4b29b6f8ddd9597f8d03c2ef040b0d694..d437d8f10949a9098777f663015d65db11d9d35a 100644
--- a/extensions/browser/content_hash_fetcher.h
+++ b/extensions/browser/content_hash_fetcher.h
@@ -5,6 +5,7 @@
#ifndef EXTENSIONS_BROWSER_CONTENT_HASH_FETCHER_H_
#define EXTENSIONS_BROWSER_CONTENT_HASH_FETCHER_H_
+#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "extensions/browser/content_verifier_delegate.h"
#include "extensions/browser/extension_registry_observer.h"
@@ -17,6 +18,7 @@ class BrowserContext;
namespace extensions {
class ExtensionRegistry;
+class ContentHashFetcherJob;
// This class is responsible for getting signed expected hashes for use in
// extension content verification. As extensions are loaded it will fetch and
@@ -48,12 +50,25 @@ class ContentHashFetcher : public ExtensionRegistryObserver {
UnloadedExtensionInfo::Reason reason) OVERRIDE;
private:
+ // Callback for when a job getting content hashes has completed.
+ void JobFinished(ContentHashFetcherJob* job);
+
content::BrowserContext* context_;
ContentVerifierDelegate* delegate_;
+ // We keep around pointers to in-progress jobs, both so we can avoid
+ // scheduling duplicate work if fetching is already in progress, and so that
+ // we can cancel in-progress work at shutdown time.
+ typedef std::pair<ExtensionId, std::string> IdAndVersion;
+ typedef std::map<IdAndVersion, scoped_refptr<ContentHashFetcherJob> > JobMap;
+ JobMap jobs_;
+
// For observing the ExtensionRegistry.
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> observer_;
+ // Used for binding callbacks passed to jobs.
+ base::WeakPtrFactory<ContentHashFetcher> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(ContentHashFetcher);
};
« no previous file with comments | « extensions/browser/computed_hashes.cc ('k') | extensions/browser/content_hash_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698