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

Side by Side Diff: extensions/browser/content_verifier.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « extensions/browser/content_hash_reader.cc ('k') | extensions/browser/content_verifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_VERIFIER_H_ 5 #ifndef EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_
6 #define EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_ 6 #define EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_
7 7
8 #include <set>
9 #include <string>
10
8 #include "base/macros.h" 11 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
11 #include "extensions/browser/content_verify_job.h" 14 #include "extensions/browser/content_verify_job.h"
12 15
13 namespace base { 16 namespace base {
14 class FilePath; 17 class FilePath;
15 } 18 }
16 19
17 namespace content { 20 namespace content {
(...skipping 21 matching lines...) Expand all
39 // returned job. 42 // returned job.
40 ContentVerifyJob* CreateJobFor(const std::string& extension_id, 43 ContentVerifyJob* CreateJobFor(const std::string& extension_id,
41 const base::FilePath& extension_root, 44 const base::FilePath& extension_root,
42 const base::FilePath& relative_path); 45 const base::FilePath& relative_path);
43 46
44 // Called (typically by a verification job) to indicate that verification 47 // Called (typically by a verification job) to indicate that verification
45 // failed while reading some file in |extension_id|. 48 // failed while reading some file in |extension_id|.
46 void VerifyFailed(const std::string& extension_id, 49 void VerifyFailed(const std::string& extension_id,
47 ContentVerifyJob::FailureReason reason); 50 ContentVerifyJob::FailureReason reason);
48 51
52 void OnFetchComplete(const std::string& extension_id,
53 bool success,
54 bool was_force_check,
55 const std::set<base::FilePath>& hash_mismatch_paths);
56
49 private: 57 private:
50 DISALLOW_COPY_AND_ASSIGN(ContentVerifier); 58 DISALLOW_COPY_AND_ASSIGN(ContentVerifier);
51 59
52 friend class base::RefCountedThreadSafe<ContentVerifier>; 60 friend class base::RefCountedThreadSafe<ContentVerifier>;
53 virtual ~ContentVerifier(); 61 virtual ~ContentVerifier();
54 62
63 // Returns true if any of the paths in |relative_paths| *should* have their
64 // contents verified. (Some files get transcoded during the install process,
65 // so we don't want to verify their contents because they are expected not
66 // to match).
67 bool ShouldVerifyAnyPaths(const Extension* extension,
68 const std::set<base::FilePath>& relative_paths);
69
55 // Note that it is important for these to appear in increasing "severity" 70 // Note that it is important for these to appear in increasing "severity"
56 // order, because we use this to let command line flags increase, but not 71 // order, because we use this to let command line flags increase, but not
57 // decrease, the mode you're running in compared to the experiment group. 72 // decrease, the mode you're running in compared to the experiment group.
58 enum Mode { 73 enum Mode {
59 // Do not try to fetch content hashes if they are missing, and do not 74 // Do not try to fetch content hashes if they are missing, and do not
60 // enforce them if they are present. 75 // enforce them if they are present.
61 NONE = 0, 76 NONE = 0,
62 77
63 // If content hashes are missing, try to fetch them, but do not enforce. 78 // If content hashes are missing, try to fetch them, but do not enforce.
64 BOOTSTRAP, 79 BOOTSTRAP,
(...skipping 16 matching lines...) Expand all
81 96
82 scoped_ptr<ContentVerifierDelegate> delegate_; 97 scoped_ptr<ContentVerifierDelegate> delegate_;
83 98
84 // For fetching content hash signatures. 99 // For fetching content hash signatures.
85 scoped_ptr<ContentHashFetcher> fetcher_; 100 scoped_ptr<ContentHashFetcher> fetcher_;
86 }; 101 };
87 102
88 } // namespace extensions 103 } // namespace extensions
89 104
90 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_ 105 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_
OLDNEW
« 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