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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef EXTENSIONS_BROWSER_RUNTIME_DATA_H_
6 #define EXTENSIONS_BROWSER_RUNTIME_DATA_H_
7
8 #include <map>
9 #include <string>
10
11 namespace extensions {
12
13 class Extension;
14
15 // Contains per-extension data that can change during the life of the process,
16 // but does not persist across restarts. Shared between incognito and regular
17 // browser contexts. Lives on the UI thread.
18 class RuntimeData {
19 public:
20 RuntimeData();
21 ~RuntimeData();
22
23 // Erase runtime data for |extension|.
24 void Erase(const Extension* extension);
not at google - send to devlin 2014/01/18 01:09:04 see comment in extension service. RuntimeData shou
25
26 // Erase runtime data for all extensions.
27 void ClearAll();
28
29 // Whether the persistent background page, if any, is ready. We don't load
30 // other components until then. If there is no background page, or if it is
31 // non-persistent (lazy), we consider it to be ready.
32 bool IsBackgroundPageReady(const Extension* extension) const;
33 void SetBackgroundPageReady(const Extension* extension, bool value);
34
35 // Getter and setter for the flag that specifies whether the extension is
36 // being upgraded.
37 bool IsBeingUpgraded(const Extension* extension) const;
38 void SetBeingUpgraded(const Extension* extension, bool value);
39
40 // Getter and setter for the flag that specifies if the extension has used
41 // the webrequest API.
42 // TODO(mpcomplete): remove. http://crbug.com/100411
43 bool HasUsedWebRequest(const Extension* extension) const;
44 void SetHasUsedWebRequest(const Extension* extension, bool value);
45
46 private:
47 // Per-extension data.
48 struct ExtensionData {
49 ExtensionData();
50 ~ExtensionData();
51
52 // True if the background page is ready.
53 bool background_page_ready;
54
55 // True while the extension is being upgraded.
56 bool being_upgraded;
57
58 // True if the extension has used the webRequest API.
59 bool has_used_webrequest;
60 };
61
62 // Map from extension ID to ExtensionData.
63 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.
64 ExtensionDataMap extension_data_;
65 };
66
67 } // namespace extensions
68
69 #endif // EXTENSIONS_BROWSER_RUNTIME_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698