Chromium Code Reviews| Index: extensions/browser/runtime_data.h |
| diff --git a/extensions/browser/runtime_data.h b/extensions/browser/runtime_data.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7798458297dc46d1d90dfaf492ceaccd5dfd8177 |
| --- /dev/null |
| +++ b/extensions/browser/runtime_data.h |
| @@ -0,0 +1,69 @@ |
| +// 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_RUNTIME_DATA_H_ |
| +#define EXTENSIONS_BROWSER_RUNTIME_DATA_H_ |
| + |
| +#include <map> |
| +#include <string> |
| + |
| +namespace extensions { |
| + |
| +class Extension; |
| + |
| +// Contains per-extension data that can change during the life of the process, |
| +// but does not persist across restarts. Shared between incognito and regular |
| +// browser contexts. Lives on the UI thread. |
| +class RuntimeData { |
| + public: |
| + RuntimeData(); |
| + ~RuntimeData(); |
| + |
| + // Erase runtime data for |extension|. |
| + void Erase(const Extension* extension); |
|
not at google - send to devlin
2014/01/18 01:09:04
see comment in extension service. RuntimeData shou
|
| + |
| + // Erase runtime data for all extensions. |
| + void ClearAll(); |
| + |
| + // Whether the persistent background page, if any, is ready. We don't load |
| + // other components until then. If there is no background page, or if it is |
| + // non-persistent (lazy), we consider it to be ready. |
| + bool IsBackgroundPageReady(const Extension* extension) const; |
| + void SetBackgroundPageReady(const Extension* extension, bool value); |
| + |
| + // Getter and setter for the flag that specifies whether the extension is |
| + // being upgraded. |
| + bool IsBeingUpgraded(const Extension* extension) const; |
| + void SetBeingUpgraded(const Extension* extension, bool value); |
| + |
| + // Getter and setter for the flag that specifies if the extension has used |
| + // the webrequest API. |
| + // TODO(mpcomplete): remove. http://crbug.com/100411 |
| + bool HasUsedWebRequest(const Extension* extension) const; |
| + void SetHasUsedWebRequest(const Extension* extension, bool value); |
| + |
| + private: |
| + // Per-extension data. |
| + struct ExtensionData { |
| + ExtensionData(); |
| + ~ExtensionData(); |
| + |
| + // True if the background page is ready. |
| + bool background_page_ready; |
| + |
| + // True while the extension is being upgraded. |
| + bool being_upgraded; |
| + |
| + // True if the extension has used the webRequest API. |
| + bool has_used_webrequest; |
| + }; |
| + |
| + // Map from extension ID to ExtensionData. |
| + typedef std::map<std::string, ExtensionData> ExtensionDataMap; |
|
not at google - send to devlin
2014/01/18 01:09:04
As it currently is a struct is a bit overkill for
James Cook
2014/01/18 02:01:18
Changed to a bitmask.
|
| + ExtensionDataMap extension_data_; |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // EXTENSIONS_BROWSER_RUNTIME_DATA_H_ |