| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_INFO_MAP_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INFO_MAP_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INFO_MAP_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INFO_MAP_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
| 15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension_extent.h" |
| 16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 | 17 |
| 18 class Extension; |
| 19 |
| 18 // Contains extension data that needs to be accessed on the IO thread. It can | 20 // Contains extension data that needs to be accessed on the IO thread. It can |
| 19 // be created/destroyed on any thread, but all other methods must be called on | 21 // be created/destroyed on any thread, but all other methods must be called on |
| 20 // the IO thread. | 22 // the IO thread. |
| 21 // | 23 // |
| 22 // TODO(mpcomplete): consider simplifying this class to return the StaticData | 24 // TODO(mpcomplete): consider simplifying this class to return the StaticData |
| 23 // object itself, since most methods are simple property accessors. | 25 // object itself, since most methods are simple property accessors. |
| 24 class ExtensionInfoMap : public base::RefCountedThreadSafe<ExtensionInfoMap> { | 26 class ExtensionInfoMap : public base::RefCountedThreadSafe<ExtensionInfoMap> { |
| 25 public: | 27 public: |
| 26 ExtensionInfoMap(); | 28 ExtensionInfoMap(); |
| 27 ~ExtensionInfoMap(); | 29 ~ExtensionInfoMap(); |
| 28 | 30 |
| 29 // Callback for when new extensions are loaded. | 31 // Callback for when new extensions are loaded. |
| 30 void AddExtension(const Extension::StaticData* data); | 32 void AddExtension(const Extension* extension); |
| 31 | 33 |
| 32 // Callback for when an extension is unloaded. | 34 // Callback for when an extension is unloaded. |
| 33 void RemoveExtension(const std::string& id); | 35 void RemoveExtension(const std::string& id); |
| 34 | 36 |
| 35 // Gets the name for the specified extension. | 37 // Gets the name for the specified extension. |
| 36 std::string GetNameForExtension(const std::string& id) const; | 38 std::string GetNameForExtension(const std::string& id) const; |
| 37 | 39 |
| 38 // Gets the path to the directory for the specified extension. | 40 // Gets the path to the directory for the specified extension. |
| 39 FilePath GetPathForExtension(const std::string& id) const; | 41 FilePath GetPathForExtension(const std::string& id) const; |
| 40 | 42 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 56 | 58 |
| 57 // Determine whether a URL has access to the specified extension permission. | 59 // Determine whether a URL has access to the specified extension permission. |
| 58 bool CheckURLAccessToExtensionPermission(const GURL& url, | 60 bool CheckURLAccessToExtensionPermission(const GURL& url, |
| 59 const char* permission_name) const; | 61 const char* permission_name) const; |
| 60 | 62 |
| 61 // Returns true if the specified URL references the icon for an extension. | 63 // Returns true if the specified URL references the icon for an extension. |
| 62 bool URLIsForExtensionIcon(const GURL& url) const; | 64 bool URLIsForExtensionIcon(const GURL& url) const; |
| 63 | 65 |
| 64 private: | 66 private: |
| 65 // Map of extension info by extension id. | 67 // Map of extension info by extension id. |
| 66 typedef std::map<std::string, scoped_refptr<const Extension::StaticData> > | 68 typedef std::map<std::string, scoped_refptr<const Extension> > Map; |
| 67 Map; | |
| 68 | 69 |
| 69 Map extension_info_; | 70 Map extension_info_; |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFO_MAP_H_ | 73 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFO_MAP_H_ |
| OLD | NEW |