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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/extension_constants.cc ('k') | extensions/browser/content_hash_fetcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/content_hash_fetcher.h
diff --git a/extensions/browser/content_hash_fetcher.h b/extensions/browser/content_hash_fetcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..60d746f4b29b6f8ddd9597f8d03c2ef040b0d694
--- /dev/null
+++ b/extensions/browser/content_hash_fetcher.h
@@ -0,0 +1,62 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_CONTENT_HASH_FETCHER_H_
+#define EXTENSIONS_BROWSER_CONTENT_HASH_FETCHER_H_
+
+#include "base/scoped_observer.h"
+#include "extensions/browser/content_verifier_delegate.h"
+#include "extensions/browser/extension_registry_observer.h"
+#include "extensions/common/extension.h"
+
+namespace content {
+class BrowserContext;
+}
+
+namespace extensions {
+
+class ExtensionRegistry;
+
+// This class is responsible for getting signed expected hashes for use in
+// extension content verification. As extensions are loaded it will fetch and
+// parse/validate/cache this data as needed, including calculating expected
+// hashes for each block of each file within an extension. (These unsigned leaf
+// node block level hashes will always be checked at time of use use to make
+// sure they match the signed treehash root hash).
+class ContentHashFetcher : public ExtensionRegistryObserver {
+ public:
+ // The consumer of this class needs to ensure that context and delegate
+ // outlive this object.
+ ContentHashFetcher(content::BrowserContext* context,
+ ContentVerifierDelegate* delegate);
+ virtual ~ContentHashFetcher();
+
+ // Begins the process of trying to fetch any needed verified contents, and
+ // listening for extension load/unload.
+ void Start();
+
+ // Explicitly ask to fetch hashes for |extension|.
+ void DoFetch(const Extension* extension);
+
+ // ExtensionRegistryObserver interface
+ virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
+ const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) OVERRIDE;
+
+ private:
+ content::BrowserContext* context_;
+ ContentVerifierDelegate* delegate_;
+
+ // For observing the ExtensionRegistry.
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentHashFetcher);
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_CONTENT_HASH_FETCHER_H_
« 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