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

Side by Side Diff: chrome/browser/extensions/install_verifier.h

Issue 464463003: Adding logging of offstore extensions state to user metrics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_INSTALL_VERIFIER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_
6 #define CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 // Initializes this object for use, including reading preferences and 51 // Initializes this object for use, including reading preferences and
52 // validating the stored signature. 52 // validating the stored signature.
53 void Init(); 53 void Init();
54 54
55 // Returns the timestamp of our InstallSignature, if we have one. 55 // Returns the timestamp of our InstallSignature, if we have one.
56 base::Time SignatureTimestamp(); 56 base::Time SignatureTimestamp();
57 57
58 // Returns true if |id| is either verified or our stored signature explicitly 58 // Returns true if |id| is either verified or our stored signature explicitly
59 // tells us that it was invalid when we asked the server about it. 59 // tells us that it was invalid when we asked the server about it.
60 bool IsKnownId(const std::string& id); 60 bool IsKnownId(const std::string& id) const;
61
62 // Returns whether the given |id| is included in our verified signature.
63 bool IsVerified(const std::string& id) const;
Devlin 2014/08/13 18:18:30 Why does this need to be public?
jwd 2014/08/13 19:34:36 Done.
64
65 // Returns whether the given |id| is considered invalid by our verified
66 // signature.
67 bool IsInvalid(const std::string& id) const;
61 68
62 // Attempts to verify a single extension and add it to the verified list. 69 // Attempts to verify a single extension and add it to the verified list.
63 void VerifyExtension(const std::string& extension_id); 70 void VerifyExtension(const std::string& extension_id);
64 71
65 // Attempts to verify all extensions. 72 // Attempts to verify all extensions.
66 void VerifyAllExtensions(); 73 void VerifyAllExtensions();
67 74
68 // Call this to add a set of ids that will immediately be considered allowed, 75 // Call this to add a set of ids that will immediately be considered allowed,
69 // and kick off an aysnchronous request to Add. 76 // and kick off an aysnchronous request to Add.
70 void AddProvisional(const ExtensionIdSet& ids); 77 void AddProvisional(const ExtensionIdSet& ids);
71 78
72 // Removes an id or set of ids from the verified list. 79 // Removes an id or set of ids from the verified list.
73 void Remove(const std::string& id); 80 void Remove(const std::string& id);
74 void RemoveMany(const ExtensionIdSet& ids); 81 void RemoveMany(const ExtensionIdSet& ids);
75 82
83 // Returns whether an extension id is allowed by policy.
84 bool AllowedByEnterprisePolicy(const std::string& id) const;
85
86 // Determines if an extension claims to be from the webstore.
87 static bool FromStore(const Extension& extension);
Devlin 2014/08/13 18:18:30 put static methods near the top of the class.
jwd 2014/08/13 19:34:36 Done.
88
76 // ManagementPolicy::Provider interface. 89 // ManagementPolicy::Provider interface.
77 virtual std::string GetDebugPolicyProviderName() const OVERRIDE; 90 virtual std::string GetDebugPolicyProviderName() const OVERRIDE;
78 virtual bool MustRemainDisabled(const Extension* extension, 91 virtual bool MustRemainDisabled(const Extension* extension,
79 Extension::DisableReason* reason, 92 Extension::DisableReason* reason,
80 base::string16* error) const OVERRIDE; 93 base::string16* error) const OVERRIDE;
81 94
82 private: 95 private:
83 // We keep a list of operations to the current set of extensions. 96 // We keep a list of operations to the current set of extensions.
84 enum OperationType { 97 enum OperationType {
85 ADD_SINGLE, // Adding a single extension to be verified. 98 ADD_SINGLE, // Adding a single extension to be verified.
(...skipping 25 matching lines...) Expand all
111 // Try adding a new set of |ids| to the list of verified ids. 124 // Try adding a new set of |ids| to the list of verified ids.
112 void AddMany(const ExtensionIdSet& ids, OperationType type); 125 void AddMany(const ExtensionIdSet& ids, OperationType type);
113 126
114 // Record the result of the verification for the histograms, and notify the 127 // Record the result of the verification for the histograms, and notify the
115 // ExtensionPrefs if we verified all extensions. 128 // ExtensionPrefs if we verified all extensions.
116 void OnVerificationComplete(bool success, OperationType type); 129 void OnVerificationComplete(bool success, OperationType type);
117 130
118 // Removes any no-longer-installed ids, requesting a new signature if needed. 131 // Removes any no-longer-installed ids, requesting a new signature if needed.
119 void GarbageCollect(); 132 void GarbageCollect();
120 133
121 // Returns whether an extension id is allowed by policy.
122 bool AllowedByEnterprisePolicy(const std::string& id) const;
123
124 // Returns whether the given |id| is included in our verified signature.
125 bool IsVerified(const std::string& id) const;
126
127 // Returns true if the extension with |id| was installed later than the 134 // Returns true if the extension with |id| was installed later than the
128 // timestamp of our signature. 135 // timestamp of our signature.
129 bool WasInstalledAfterSignature(const std::string& id) const; 136 bool WasInstalledAfterSignature(const std::string& id) const;
130 137
131 // Begins the process of fetching a new signature, based on applying the 138 // Begins the process of fetching a new signature, based on applying the
132 // operation at the head of the queue to the current set of ids in 139 // operation at the head of the queue to the current set of ids in
133 // |signature_| (if any) and then sending a request to sign that. 140 // |signature_| (if any) and then sending a request to sign that.
134 void BeginFetch(); 141 void BeginFetch();
135 142
136 // Saves the current value of |signature_| to the prefs; 143 // Saves the current value of |signature_| to the prefs;
(...skipping 25 matching lines...) Expand all
162 ExtensionIdSet provisional_; 169 ExtensionIdSet provisional_;
163 170
164 base::WeakPtrFactory<InstallVerifier> weak_factory_; 171 base::WeakPtrFactory<InstallVerifier> weak_factory_;
165 172
166 DISALLOW_COPY_AND_ASSIGN(InstallVerifier); 173 DISALLOW_COPY_AND_ASSIGN(InstallVerifier);
167 }; 174 };
168 175
169 } // namespace extensions 176 } // namespace extensions
170 177
171 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_ 178 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/install_verifier.cc » ('j') | chrome/browser/metrics/extensions_metrics_provider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698