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

Side by Side Diff: extensions/browser/content_hash_fetcher.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef EXTENSIONS_BROWSER_CONTENT_HASH_FETCHER_H_
6 #define EXTENSIONS_BROWSER_CONTENT_HASH_FETCHER_H_
7
8 #include "base/scoped_observer.h"
9 #include "extensions/browser/content_verifier_delegate.h"
10 #include "extensions/browser/extension_registry_observer.h"
11 #include "extensions/common/extension.h"
12
13 namespace content {
14 class BrowserContext;
15 }
16
17 namespace extensions {
18
19 class ExtensionRegistry;
20
21 // This class is responsible for getting signed expected hashes for use in
22 // extension content verification. As extensions are loaded it will fetch and
23 // parse/validate/cache this data as needed, including calculating expected
24 // hashes for each block of each file within an extension. (These unsigned leaf
25 // node block level hashes will always be checked at time of use use to make
26 // sure they match the signed treehash root hash).
27 class ContentHashFetcher : public ExtensionRegistryObserver {
28 public:
29 // The consumer of this class needs to ensure that context and delegate
30 // outlive this object.
31 ContentHashFetcher(content::BrowserContext* context,
32 ContentVerifierDelegate* delegate);
33 virtual ~ContentHashFetcher();
34
35 // Begins the process of trying to fetch any needed verified contents, and
36 // listening for extension load/unload.
37 void Start();
38
39 // Explicitly ask to fetch hashes for |extension|.
40 void DoFetch(const Extension* extension);
41
42 // ExtensionRegistryObserver interface
43 virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
44 const Extension* extension) OVERRIDE;
45 virtual void OnExtensionUnloaded(
46 content::BrowserContext* browser_context,
47 const Extension* extension,
48 UnloadedExtensionInfo::Reason reason) OVERRIDE;
49
50 private:
51 content::BrowserContext* context_;
52 ContentVerifierDelegate* delegate_;
53
54 // For observing the ExtensionRegistry.
55 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> observer_;
56
57 DISALLOW_COPY_AND_ASSIGN(ContentHashFetcher);
58 };
59
60 } // namespace extensions
61
62 #endif // EXTENSIONS_BROWSER_CONTENT_HASH_FETCHER_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_constants.cc ('k') | extensions/browser/content_hash_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698