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

Unified Diff: extensions/browser/content_verifier.h

Issue 280013003: More implementation details of extension content verification (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged latest trunk 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/content_hash_reader.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 edce70a5ef62a82af39d437ce9865fc85a446111..9096acde6debff651e7f9e6ffd52df270f3d5088 100644
--- a/extensions/browser/content_verifier.h
+++ b/extensions/browser/content_verifier.h
@@ -7,8 +7,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/observer_list_threadsafe.h"
-#include "extensions/browser/content_verifier_filter.h"
+#include "base/memory/scoped_ptr.h"
#include "extensions/browser/content_verify_job.h"
namespace base {
@@ -21,21 +20,18 @@ class BrowserContext;
namespace extensions {
-// Interface for clients of ContentVerifier.
-class ContentVerifierObserver {
- public:
- // Called when the content verifier detects that a read of a file inside
- // an extension did not match its expected hash.
- virtual void ContentVerifyFailed(const std::string& extension_id) = 0;
-};
+class Extension;
+class ContentHashFetcher;
+class ContentVerifierDelegate;
// 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> {
public:
+ // Takes ownership of |delegate|.
ContentVerifier(content::BrowserContext* context,
- const ContentVerifierFilter& filter);
+ ContentVerifierDelegate* delegate);
void Start();
void Shutdown();
@@ -50,20 +46,12 @@ class ContentVerifier : public base::RefCountedThreadSafe<ContentVerifier> {
void VerifyFailed(const std::string& extension_id,
ContentVerifyJob::FailureReason reason);
- // Observers will be called back on the same thread that they call
- // AddObserver on.
- void AddObserver(ContentVerifierObserver* observer);
- void RemoveObserver(ContentVerifierObserver* observer);
-
private:
DISALLOW_COPY_AND_ASSIGN(ContentVerifier);
friend class base::RefCountedThreadSafe<ContentVerifier>;
virtual ~ContentVerifier();
- // Attempts to fetch content hashes for |extension_id|.
- void RequestFetch(const std::string& extension_id);
-
// Note that it is important for these to appear in increasing "severity"
// order, because we use this to let command line flags increase, but not
// decrease, the mode you're running in compared to the experiment group.
@@ -88,14 +76,13 @@ class ContentVerifier : public base::RefCountedThreadSafe<ContentVerifier> {
// The mode we're running in - set once at creation.
const Mode mode_;
- // The filter we use to decide whether to return a ContentVerifyJob.
- ContentVerifierFilter filter_;
-
// The associated BrowserContext.
content::BrowserContext* context_;
- // The set of objects interested in verification failures.
- scoped_refptr<ObserverListThreadSafe<ContentVerifierObserver> > observers_;
+ scoped_ptr<ContentVerifierDelegate> delegate_;
+
+ // For fetching content hash signatures.
+ scoped_ptr<ContentHashFetcher> fetcher_;
};
} // namespace extensions
« no previous file with comments | « extensions/browser/content_hash_reader.cc ('k') | extensions/browser/content_verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698