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

Side by Side Diff: extensions/browser/info_map.h

Issue 63933003: Moved ExtensionInfoMap and ExtensionsQuotaService to extensions/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 7 years, 1 month 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
« no previous file with comments | « extensions/browser/DEPS ('k') | extensions/browser/info_map.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 EXTENSIONS_BROWSER_INFO_MAP_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INFO_MAP_H_ 6 #define EXTENSIONS_BROWSER_INFO_MAP_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "chrome/browser/extensions/extensions_quota_service.h"
15 #include "chrome/browser/extensions/process_map.h" 14 #include "chrome/browser/extensions/process_map.h"
16 #include "chrome/common/extensions/extension_set.h" 15 #include "chrome/common/extensions/extension_set.h"
16 #include "extensions/browser/quota_service.h"
17 17
18 namespace extensions { 18 namespace extensions {
19 class Extension; 19 class Extension;
20 }
21 20
22 // Contains extension data that needs to be accessed on the IO thread. It can 21 // Contains extension data that needs to be accessed on the IO thread. It can
23 // be created/destroyed on any thread, but all other methods must be called on 22 // be created/destroyed on any thread, but all other methods must be called on
24 // the IO thread. 23 // the IO thread.
25 class ExtensionInfoMap : public base::RefCountedThreadSafe<ExtensionInfoMap> { 24 class InfoMap : public base::RefCountedThreadSafe<InfoMap> {
26 public: 25 public:
27 ExtensionInfoMap(); 26 InfoMap();
28 27
29 const ExtensionSet& extensions() const { return extensions_; } 28 const ExtensionSet& extensions() const { return extensions_; }
30 const ExtensionSet& disabled_extensions() const { 29 const ExtensionSet& disabled_extensions() const {
31 return disabled_extensions_; 30 return disabled_extensions_;
32 } 31 }
33 32
34 const extensions::ProcessMap& process_map() const; 33 const extensions::ProcessMap& process_map() const;
35 34
36 // Callback for when new extensions are loaded. 35 // Callback for when new extensions are loaded.
37 void AddExtension(const extensions::Extension* extension, 36 void AddExtension(const extensions::Extension* extension,
(...skipping 29 matching lines...) Expand all
67 // Returns the subset of extensions which has the same |origin| in 66 // Returns the subset of extensions which has the same |origin| in
68 // |process_id| with the specified |permission|. 67 // |process_id| with the specified |permission|.
69 void GetExtensionsWithAPIPermissionForSecurityOrigin( 68 void GetExtensionsWithAPIPermissionForSecurityOrigin(
70 const GURL& origin, 69 const GURL& origin,
71 int process_id, 70 int process_id,
72 extensions::APIPermission::ID permission, 71 extensions::APIPermission::ID permission,
73 ExtensionSet* extensions) const; 72 ExtensionSet* extensions) const;
74 73
75 // Returns true if there is exists an extension with the same origin as 74 // Returns true if there is exists an extension with the same origin as
76 // |origin| in |process_id| with |permission|. 75 // |origin| in |process_id| with |permission|.
77 bool SecurityOriginHasAPIPermission( 76 bool SecurityOriginHasAPIPermission(const GURL& origin,
78 const GURL& origin, int process_id, 77 int process_id,
79 extensions::APIPermission::ID permission) const; 78 extensions::APIPermission::ID permission)
79 const;
80 80
81 ExtensionsQuotaService* GetQuotaService(); 81 QuotaService* GetQuotaService();
82 82
83 // Keep track of the signin process, so we can restrict extension access to 83 // Keep track of the signin process, so we can restrict extension access to
84 // it. 84 // it.
85 void SetSigninProcess(int process_id); 85 void SetSigninProcess(int process_id);
86 bool IsSigninProcess(int process_id) const; 86 bool IsSigninProcess(int process_id) const;
87 87
88 private: 88 private:
89 friend class base::RefCountedThreadSafe<ExtensionInfoMap>; 89 friend class base::RefCountedThreadSafe<InfoMap>;
90 90
91 // Extra dynamic data related to an extension. 91 // Extra dynamic data related to an extension.
92 struct ExtraData; 92 struct ExtraData;
93 // Map of extension_id to ExtraData. 93 // Map of extension_id to ExtraData.
94 typedef std::map<std::string, ExtraData> ExtraDataMap; 94 typedef std::map<std::string, ExtraData> ExtraDataMap;
95 95
96 ~ExtensionInfoMap(); 96 ~InfoMap();
97 97
98 ExtensionSet extensions_; 98 ExtensionSet extensions_;
99 ExtensionSet disabled_extensions_; 99 ExtensionSet disabled_extensions_;
100 100
101 // Extra data associated with enabled extensions. 101 // Extra data associated with enabled extensions.
102 ExtraDataMap extra_data_; 102 ExtraDataMap extra_data_;
103 103
104 // Used by dispatchers to limit API quota for individual extensions. 104 // Used by dispatchers to limit API quota for individual extensions.
105 // The ExtensionQutoaService is not thread safe. We need to create and destroy 105 // The QutoaService is not thread safe. We need to create and destroy it on
Yoyo Zhou 2013/11/08 21:48:52 typo: Quota
106 // it on the IO thread. 106 // the IO thread.
107 scoped_ptr<ExtensionsQuotaService> quota_service_; 107 scoped_ptr<QuotaService> quota_service_;
108 108
109 // Assignment of extensions to processes. 109 // Assignment of extensions to processes.
110 extensions::ProcessMap process_map_; 110 extensions::ProcessMap process_map_;
111 111
112 int signin_process_id_; 112 int signin_process_id_;
113 }; 113 };
114 114
115 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFO_MAP_H_ 115 } // namespace extensions
116
117 #endif // EXTENSIONS_BROWSER_INFO_MAP_H_
OLDNEW
« no previous file with comments | « extensions/browser/DEPS ('k') | extensions/browser/info_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698