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

Unified Diff: extensions/browser/runtime_data.h

Issue 131743021: app_shell: Extract extension runtime data from ExtensionService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup, unit test (runtime_data) Created 6 years, 11 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
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_

Powered by Google App Engine
This is Rietveld 408576698