OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 18 matching lines...) Expand all Loading... | |
29 const ExtensionSet& extensions() const { return extensions_; } | 29 const ExtensionSet& extensions() const { return extensions_; } |
30 const ExtensionSet& disabled_extensions() const { | 30 const ExtensionSet& disabled_extensions() const { |
31 return disabled_extensions_; | 31 return disabled_extensions_; |
32 } | 32 } |
33 | 33 |
34 const extensions::ProcessMap& process_map() const; | 34 const extensions::ProcessMap& process_map() const; |
35 | 35 |
36 // Callback for when new extensions are loaded. | 36 // Callback for when new extensions are loaded. |
37 void AddExtension(const extensions::Extension* extension, | 37 void AddExtension(const extensions::Extension* extension, |
38 base::Time install_time, | 38 base::Time install_time, |
39 bool incognito_enabled); | 39 bool incognito_enabled, |
40 bool notifications_disabled); | |
40 | 41 |
41 // Callback for when an extension is unloaded. | 42 // Callback for when an extension is unloaded. |
42 void RemoveExtension(const std::string& extension_id, | 43 void RemoveExtension(const std::string& extension_id, |
43 const extensions::UnloadedExtensionInfo::Reason reason); | 44 const extensions::UnloadedExtensionInfo::Reason reason); |
44 | 45 |
45 // Returns the time the extension was installed, or base::Time() if not found. | 46 // Returns the time the extension was installed, or base::Time() if not found. |
46 base::Time GetInstallTime(const std::string& extension_id) const; | 47 base::Time GetInstallTime(const std::string& extension_id) const; |
47 | 48 |
48 // Returns true if the user has allowed this extension to run in incognito | 49 // Returns true if the user has allowed this extension to run in incognito |
49 // mode. | 50 // mode. |
(...skipping 28 matching lines...) Expand all Loading... | |
78 const GURL& origin, int process_id, | 79 const GURL& origin, int process_id, |
79 extensions::APIPermission::ID permission) const; | 80 extensions::APIPermission::ID permission) const; |
80 | 81 |
81 ExtensionsQuotaService* GetQuotaService(); | 82 ExtensionsQuotaService* GetQuotaService(); |
82 | 83 |
83 // Keep track of the signin process, so we can restrict extension access to | 84 // Keep track of the signin process, so we can restrict extension access to |
84 // it. | 85 // it. |
85 void SetSigninProcess(int process_id); | 86 void SetSigninProcess(int process_id); |
86 bool IsSigninProcess(int process_id) const; | 87 bool IsSigninProcess(int process_id) const; |
87 | 88 |
89 // Notifications can be enabled/disabled in real time by the user. | |
90 void SetNotificationsDisabled(const std::string& extension_id, | |
91 bool notifications_disabled); | |
92 bool GetNotificationsDisabledForExtension(const std::string& extension_id) | |
Matt Perry
2013/11/06 00:57:18
nit: bool functions should read like a question: "
dewittj
2013/11/06 19:20:36
Done.
| |
93 const; | |
94 | |
88 private: | 95 private: |
89 friend class base::RefCountedThreadSafe<ExtensionInfoMap>; | 96 friend class base::RefCountedThreadSafe<ExtensionInfoMap>; |
90 | 97 |
91 // Extra dynamic data related to an extension. | 98 // Extra dynamic data related to an extension. |
92 struct ExtraData; | 99 struct ExtraData; |
93 // Map of extension_id to ExtraData. | 100 // Map of extension_id to ExtraData. |
94 typedef std::map<std::string, ExtraData> ExtraDataMap; | 101 typedef std::map<std::string, ExtraData> ExtraDataMap; |
95 | 102 |
96 ~ExtensionInfoMap(); | 103 ~ExtensionInfoMap(); |
97 | 104 |
98 ExtensionSet extensions_; | 105 ExtensionSet extensions_; |
99 ExtensionSet disabled_extensions_; | 106 ExtensionSet disabled_extensions_; |
100 | 107 |
101 // Extra data associated with enabled extensions. | 108 // Extra data associated with enabled extensions. |
102 ExtraDataMap extra_data_; | 109 ExtraDataMap extra_data_; |
103 | 110 |
104 // Used by dispatchers to limit API quota for individual extensions. | 111 // Used by dispatchers to limit API quota for individual extensions. |
105 // The ExtensionQutoaService is not thread safe. We need to create and destroy | 112 // The ExtensionQutoaService is not thread safe. We need to create and destroy |
106 // it on the IO thread. | 113 // it on the IO thread. |
107 scoped_ptr<ExtensionsQuotaService> quota_service_; | 114 scoped_ptr<ExtensionsQuotaService> quota_service_; |
108 | 115 |
109 // Assignment of extensions to processes. | 116 // Assignment of extensions to processes. |
110 extensions::ProcessMap process_map_; | 117 extensions::ProcessMap process_map_; |
111 | 118 |
112 int signin_process_id_; | 119 int signin_process_id_; |
113 }; | 120 }; |
114 | 121 |
115 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFO_MAP_H_ | 122 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFO_MAP_H_ |
OLD | NEW |