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

Unified Diff: extensions/browser/content_verify_job.h

Issue 329303007: Fix several problems with the content verification code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: responded to review comments Created 6 years, 6 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_verifier_delegate.h ('k') | extensions/browser/content_verify_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/content_verify_job.h
diff --git a/extensions/browser/content_verify_job.h b/extensions/browser/content_verify_job.h
index 11660f3b3af81d1ead060dac09d4fdc2caed273c..bad728d7a5527f47f1c5fec80614f70a21db052f 100644
--- a/extensions/browser/content_verify_job.h
+++ b/extensions/browser/content_verify_job.h
@@ -34,8 +34,12 @@ class ContentVerifyJob : public base::RefCountedThreadSafe<ContentVerifyJob> {
// No failure.
NONE,
- // Failed because there were no expected hashes.
- NO_HASHES,
+ // Failed because there were no expected hashes at all (eg they haven't
+ // been fetched yet).
+ MISSING_ALL_HASHES,
+
+ // Failed because this file wasn't found in the list of expected hashes.
+ NO_HASHES_FOR_FILE,
// Some of the content read did not match the expected hash.
HASH_MISMATCH
@@ -81,9 +85,10 @@ class ContentVerifyJob : public base::RefCountedThreadSafe<ContentVerifyJob> {
friend class base::RefCountedThreadSafe<ContentVerifyJob>;
// Called each time we're done adding bytes for the current block, and are
- // ready to finish the hash operation for those bytes and make sure it matches
- // what was expected for that block.
- void FinishBlock();
+ // ready to finish the hash operation for those bytes and make sure it
+ // matches what was expected for that block. Returns true if everything is
+ // still ok so far, or false if a mismatch was detected.
+ bool FinishBlock();
// Dispatches the failure callback with the given reason.
void DispatchFailureCallback(FailureReason reason);
@@ -118,6 +123,9 @@ class ContentVerifyJob : public base::RefCountedThreadSafe<ContentVerifyJob> {
// Called once if verification fails.
FailureCallback failure_callback_;
+ // Set to true if we detected a mismatch and called the failure callback.
+ bool failed_;
+
// For ensuring methods on called on the right thread.
base::ThreadChecker thread_checker_;
};
« no previous file with comments | « extensions/browser/content_verifier_delegate.h ('k') | extensions/browser/content_verify_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698