Index: extensions/renderer/extension_consumer.h |
diff --git a/extensions/renderer/extension_consumer.h b/extensions/renderer/extension_consumer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bedf8aa493bea5b5efad2ca4d8301d007526a2dd |
--- /dev/null |
+++ b/extensions/renderer/extension_consumer.h |
@@ -0,0 +1,40 @@ |
+// Copyright 2015 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_RENDERER_EXTENSION_CONSUMER_H_ |
+#define EXTENSIONS_RENDERER_EXTENSION_CONSUMER_H_ |
+ |
+#include "base/memory/ref_counted.h" |
+#include "extensions/common/extension.h" |
+#include "extensions/common/host_id.h" |
+ |
+namespace extensions { |
+ |
+// A wrapper class which holds an extension and implements the Host interface. |
+class ExtensionConsumer : public Host { |
+ public: |
+ ExtensionConsumer(const scoped_refptr<const Extension>& extension, |
+ const HostID& host_id); |
Devlin
2015/02/09 17:40:24
Why do we need to pass in a host id? Can't an Ext
Xi Han
2015/02/09 23:28:11
That makes sense. Updated.
|
+ ~ExtensionConsumer() override; |
+ |
+ // Host: |
+ const std::string& GetContentSecurityPolicy() const override; |
+ const GURL& url() const override; |
+ const std::string name() const override; |
+ PermissionsData::AccessType CanExecuteOnFrame( |
+ const GURL& document_url, |
+ const GURL& top_frame_url, |
+ int tab_id, |
+ bool is_declarative) const override; |
+ const Extension* extension() const { return extension_.get(); } |
+ |
+ private: |
+ scoped_refptr<const Extension> extension_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ExtensionConsumer); |
+}; |
+ |
+} // namespace extesions |
+ |
+#endif // EXTENSIONS_RENDERER_EXTENSION_CONSUMER_H_ |