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

Side by Side 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: ready 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 EXTENSIONS_BROWSER_CONTENT_VERIFY_JOB_H_ 5 #ifndef EXTENSIONS_BROWSER_CONTENT_VERIFY_JOB_H_
6 #define EXTENSIONS_BROWSER_CONTENT_VERIFY_JOB_H_ 6 #define EXTENSIONS_BROWSER_CONTENT_VERIFY_JOB_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 16 matching lines...) Expand all
27 // Objects of this class are responsible for verifying that the actual content 27 // Objects of this class are responsible for verifying that the actual content
28 // read from an extension file matches an expected set of hashes. This class 28 // read from an extension file matches an expected set of hashes. This class
29 // can be created on any thread but the rest of the methods should be called 29 // can be created on any thread but the rest of the methods should be called
30 // from only one thread. 30 // from only one thread.
31 class ContentVerifyJob : public base::RefCountedThreadSafe<ContentVerifyJob> { 31 class ContentVerifyJob : public base::RefCountedThreadSafe<ContentVerifyJob> {
32 public: 32 public:
33 enum FailureReason { 33 enum FailureReason {
34 // No failure. 34 // No failure.
35 NONE, 35 NONE,
36 36
37 // Failed because there were no expected hashes. 37 // Failed because there were no expected hashes at all (eg they haven't
38 NO_HASHES, 38 // been fetched yet).
39 MISSING_ALL_HASHES,
40
41 // Failed because this file wasn't found in the list of expected hashes.
42 NO_HASHES_FOR_FILE,
39 43
40 // Some of the content read did not match the expected hash. 44 // Some of the content read did not match the expected hash.
41 HASH_MISMATCH 45 HASH_MISMATCH
42 }; 46 };
43 typedef base::Callback<void(FailureReason)> FailureCallback; 47 typedef base::Callback<void(FailureReason)> FailureCallback;
44 48
45 // The |failure_callback| will be called at most once if there was a failure. 49 // The |failure_callback| will be called at most once if there was a failure.
46 ContentVerifyJob(ContentHashReader* hash_reader, 50 ContentVerifyJob(ContentHashReader* hash_reader,
47 const FailureCallback& failure_callback); 51 const FailureCallback& failure_callback);
48 52
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // Called once if verification fails. 122 // Called once if verification fails.
119 FailureCallback failure_callback_; 123 FailureCallback failure_callback_;
120 124
121 // For ensuring methods on called on the right thread. 125 // For ensuring methods on called on the right thread.
122 base::ThreadChecker thread_checker_; 126 base::ThreadChecker thread_checker_;
123 }; 127 };
124 128
125 } // namespace extensions 129 } // namespace extensions
126 130
127 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFY_JOB_H_ 131 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFY_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698