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

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

Issue 1136543003: Extensions: Store disable reasons in Sync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix memleak in test Created 5 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_PREFS_H_
6 #define EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ 6 #define EXTENSIONS_BROWSER_EXTENSION_PREFS_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // Returns true if the specified external extension was uninstalled by the 166 // Returns true if the specified external extension was uninstalled by the
167 // user. 167 // user.
168 bool IsExternalExtensionUninstalled(const std::string& id) const; 168 bool IsExternalExtensionUninstalled(const std::string& id) const;
169 169
170 // Checks whether |extension_id| is disabled. If there's no state pref for 170 // Checks whether |extension_id| is disabled. If there's no state pref for
171 // the extension, this will return false. Generally you should use 171 // the extension, this will return false. Generally you should use
172 // ExtensionService::IsExtensionEnabled instead. 172 // ExtensionService::IsExtensionEnabled instead.
173 bool IsExtensionDisabled(const std::string& id) const; 173 bool IsExtensionDisabled(const std::string& id) const;
174 174
175 // Get/Set the order that the browser actions appear in the toolbar. 175 // Get/Set the order that the browser actions appear in the toolbar.
176 ExtensionIdList GetToolbarOrder(); 176 ExtensionIdList GetToolbarOrder() const;
177 void SetToolbarOrder(const ExtensionIdList& extension_ids); 177 void SetToolbarOrder(const ExtensionIdList& extension_ids);
178 178
179 // Called when an extension is installed, so that prefs get created. 179 // Called when an extension is installed, so that prefs get created.
180 // If |page_ordinal| is invalid then a page will be found for the App. 180 // If |page_ordinal| is invalid then a page will be found for the App.
181 // |install_flags| are a bitmask of extension::InstallFlags. 181 // |install_flags| are a bitmask of extension::InstallFlags.
182 void OnExtensionInstalled(const Extension* extension, 182 void OnExtensionInstalled(const Extension* extension,
183 Extension::State initial_state, 183 Extension::State initial_state,
184 const syncer::StringOrdinal& page_ordinal, 184 const syncer::StringOrdinal& page_ordinal,
185 int install_flags, 185 int install_flags,
186 const std::string& install_parameter); 186 const std::string& install_parameter);
(...skipping 18 matching lines...) Expand all
205 void SetExtensionState(const std::string& extension_id, Extension::State); 205 void SetExtensionState(const std::string& extension_id, Extension::State);
206 206
207 // Called to change the extension's BlacklistState. Currently only used for 207 // Called to change the extension's BlacklistState. Currently only used for
208 // non-malicious extensions. 208 // non-malicious extensions.
209 // TODO(oleg): replace SetExtensionBlacklisted by this function. 209 // TODO(oleg): replace SetExtensionBlacklisted by this function.
210 void SetExtensionBlacklistState(const std::string& extension_id, 210 void SetExtensionBlacklistState(const std::string& extension_id,
211 BlacklistState state); 211 BlacklistState state);
212 212
213 // Checks whether |extension_id| is marked as greylisted. 213 // Checks whether |extension_id| is marked as greylisted.
214 // TODO(oleg): Replace IsExtensionBlacklisted by this method. 214 // TODO(oleg): Replace IsExtensionBlacklisted by this method.
215 BlacklistState GetExtensionBlacklistState(const std::string& extension_id); 215 BlacklistState GetExtensionBlacklistState(
216 const std::string& extension_id) const;
216 217
217 // Populates |out| with the ids of all installed extensions. 218 // Populates |out| with the ids of all installed extensions.
218 void GetExtensions(ExtensionIdList* out); 219 void GetExtensions(ExtensionIdList* out) const;
219 220
220 // ExtensionScopedPrefs methods: 221 // ExtensionScopedPrefs methods:
221 void UpdateExtensionPref(const std::string& id, 222 void UpdateExtensionPref(const std::string& id,
222 const std::string& key, 223 const std::string& key,
223 base::Value* value) override; 224 base::Value* value) override;
224 225
225 void DeleteExtensionPrefs(const std::string& id) override; 226 void DeleteExtensionPrefs(const std::string& id) override;
226 227
227 bool ReadPrefAsBoolean(const std::string& extension_id, 228 bool ReadPrefAsBoolean(const std::string& extension_id,
228 const std::string& pref_key, 229 const std::string& pref_key,
(...skipping 12 matching lines...) Expand all
241 const base::ListValue** out_value) const override; 242 const base::ListValue** out_value) const override;
242 243
243 bool ReadPrefAsDictionary( 244 bool ReadPrefAsDictionary(
244 const std::string& extension_id, 245 const std::string& extension_id,
245 const std::string& pref_key, 246 const std::string& pref_key,
246 const base::DictionaryValue** out_value) const override; 247 const base::DictionaryValue** out_value) const override;
247 248
248 bool HasPrefForExtension(const std::string& extension_id) const override; 249 bool HasPrefForExtension(const std::string& extension_id) const override;
249 250
250 // Did the extension ask to escalate its permission during an upgrade? 251 // Did the extension ask to escalate its permission during an upgrade?
251 bool DidExtensionEscalatePermissions(const std::string& id); 252 bool DidExtensionEscalatePermissions(const std::string& id) const;
252 253
253 // If |did_escalate| is true, the preferences for |extension| will be set to 254 // If |did_escalate| is true, the preferences for |extension| will be set to
254 // require the install warning when the user tries to enable. 255 // require the install warning when the user tries to enable.
255 void SetDidExtensionEscalatePermissions( 256 void SetDidExtensionEscalatePermissions(
256 const Extension* extension, 257 const Extension* extension,
257 bool did_escalate); 258 bool did_escalate);
258 259
259 // Getters and setters for disabled reason. 260 // Getters and setters for disabled reason.
260 int GetDisableReasons(const std::string& extension_id) const; 261 int GetDisableReasons(const std::string& extension_id) const;
261 bool HasDisableReason(const std::string& extension_id, 262 bool HasDisableReason(const std::string& extension_id,
262 Extension::DisableReason disable_reason) const; 263 Extension::DisableReason disable_reason) const;
263 void AddDisableReason(const std::string& extension_id, 264 void AddDisableReason(const std::string& extension_id,
264 Extension::DisableReason disable_reason); 265 Extension::DisableReason disable_reason);
266 void AddDisableReasons(const std::string& extension_id, int disable_reasons);
265 void RemoveDisableReason(const std::string& extension_id, 267 void RemoveDisableReason(const std::string& extension_id,
266 Extension::DisableReason disable_reason); 268 Extension::DisableReason disable_reason);
267 void ClearDisableReasons(const std::string& extension_id); 269 void ClearDisableReasons(const std::string& extension_id);
268 270
269 // Gets the set of extensions that have been blacklisted in prefs. This will 271 // Gets the set of extensions that have been blacklisted in prefs. This will
270 // return only the blocked extensions, not the "greylist" extensions. 272 // return only the blocked extensions, not the "greylist" extensions.
271 // TODO(oleg): Make method names consistent here, in extension service and in 273 // TODO(oleg): Make method names consistent here, in extension service and in
272 // blacklist. 274 // blacklist.
273 std::set<std::string> GetBlacklistedExtensions(); 275 std::set<std::string> GetBlacklistedExtensions() const;
274 276
275 // Sets whether the extension with |id| is blacklisted. 277 // Sets whether the extension with |id| is blacklisted.
276 void SetExtensionBlacklisted(const std::string& extension_id, 278 void SetExtensionBlacklisted(const std::string& extension_id,
277 bool is_blacklisted); 279 bool is_blacklisted);
278 280
279 // Returns the version string for the currently installed extension, or 281 // Returns the version string for the currently installed extension, or
280 // the empty string if not found. 282 // the empty string if not found.
281 std::string GetVersionString(const std::string& extension_id); 283 std::string GetVersionString(const std::string& extension_id) const;
282 284
283 // Re-writes the extension manifest into the prefs. 285 // Re-writes the extension manifest into the prefs.
284 // Called to change the extension's manifest when it's re-localized. 286 // Called to change the extension's manifest when it's re-localized.
285 void UpdateManifest(const Extension* extension); 287 void UpdateManifest(const Extension* extension);
286 288
287 // Returns base extensions install directory. 289 // Returns base extensions install directory.
288 const base::FilePath& install_directory() const { return install_directory_; } 290 const base::FilePath& install_directory() const { return install_directory_; }
289 291
290 // Returns whether the extension with |id| has its blacklist bit set. 292 // Returns whether the extension with |id| has its blacklist bit set.
291 // 293 //
292 // WARNING: this only checks the extension's entry in prefs, so by definition 294 // WARNING: this only checks the extension's entry in prefs, so by definition
293 // can only check extensions that prefs knows about. There may be other 295 // can only check extensions that prefs knows about. There may be other
294 // sources of blacklist information, such as safebrowsing. You probably want 296 // sources of blacklist information, such as safebrowsing. You probably want
295 // to use Blacklist::GetBlacklistedIDs rather than this method. 297 // to use Blacklist::GetBlacklistedIDs rather than this method.
296 bool IsExtensionBlacklisted(const std::string& id) const; 298 bool IsExtensionBlacklisted(const std::string& id) const;
297 299
298 // Increment the count of how many times we prompted the user to acknowledge 300 // Increment the count of how many times we prompted the user to acknowledge
299 // the given extension, and return the new count. 301 // the given extension, and return the new count.
300 int IncrementAcknowledgePromptCount(const std::string& extension_id); 302 int IncrementAcknowledgePromptCount(const std::string& extension_id);
301 303
302 // Whether the user has acknowledged an external extension. 304 // Whether the user has acknowledged an external extension.
303 bool IsExternalExtensionAcknowledged(const std::string& extension_id); 305 bool IsExternalExtensionAcknowledged(const std::string& extension_id) const;
304 void AcknowledgeExternalExtension(const std::string& extension_id); 306 void AcknowledgeExternalExtension(const std::string& extension_id);
305 307
306 // Whether the user has acknowledged a blacklisted extension. 308 // Whether the user has acknowledged a blacklisted extension.
307 bool IsBlacklistedExtensionAcknowledged(const std::string& extension_id); 309 bool IsBlacklistedExtensionAcknowledged(
310 const std::string& extension_id) const;
308 void AcknowledgeBlacklistedExtension(const std::string& extension_id); 311 void AcknowledgeBlacklistedExtension(const std::string& extension_id);
309 312
310 // Whether the external extension was installed during the first run 313 // Whether the external extension was installed during the first run
311 // of this profile. 314 // of this profile.
312 bool IsExternalInstallFirstRun(const std::string& extension_id); 315 bool IsExternalInstallFirstRun(const std::string& extension_id) const;
313 void SetExternalInstallFirstRun(const std::string& extension_id); 316 void SetExternalInstallFirstRun(const std::string& extension_id);
314 317
315 // Returns true if the extension notification code has already run for the 318 // Returns true if the extension notification code has already run for the
316 // first time for this profile. Currently we use this flag to mean that any 319 // first time for this profile. Currently we use this flag to mean that any
317 // extensions that would trigger notifications should get silently 320 // extensions that would trigger notifications should get silently
318 // acknowledged. This is a fuse. Calling it the first time returns false. 321 // acknowledged. This is a fuse. Calling it the first time returns false.
319 // Subsequent calls return true. It's not possible through an API to ever 322 // Subsequent calls return true. It's not possible through an API to ever
320 // reset it. Don't call it unless you mean it! 323 // reset it. Don't call it unless you mean it!
321 bool SetAlertSystemFirstRun(); 324 bool SetAlertSystemFirstRun();
322 325
323 // Returns the last value set via SetLastPingDay. If there isn't such a 326 // Returns the last value set via SetLastPingDay. If there isn't such a
324 // pref, the returned Time will return true for is_null(). 327 // pref, the returned Time will return true for is_null().
325 base::Time LastPingDay(const std::string& extension_id) const; 328 base::Time LastPingDay(const std::string& extension_id) const;
326 329
327 // The time stored is based on the server's perspective of day start time, not 330 // The time stored is based on the server's perspective of day start time, not
328 // the client's. 331 // the client's.
329 void SetLastPingDay(const std::string& extension_id, const base::Time& time); 332 void SetLastPingDay(const std::string& extension_id, const base::Time& time);
330 333
331 // Similar to the 2 above, but for the extensions blacklist. 334 // Similar to the 2 above, but for the extensions blacklist.
332 base::Time BlacklistLastPingDay() const; 335 base::Time BlacklistLastPingDay() const;
333 void SetBlacklistLastPingDay(const base::Time& time); 336 void SetBlacklistLastPingDay(const base::Time& time);
334 337
335 // Similar to LastPingDay/SetLastPingDay, but for sending "days since active" 338 // Similar to LastPingDay/SetLastPingDay, but for sending "days since active"
336 // ping. 339 // ping.
337 base::Time LastActivePingDay(const std::string& extension_id); 340 base::Time LastActivePingDay(const std::string& extension_id) const;
338 void SetLastActivePingDay(const std::string& extension_id, 341 void SetLastActivePingDay(const std::string& extension_id,
339 const base::Time& time); 342 const base::Time& time);
340 343
341 // A bit we use for determining if we should send the "days since active" 344 // A bit we use for determining if we should send the "days since active"
342 // ping. A value of true means the item has been active (launched) since the 345 // ping. A value of true means the item has been active (launched) since the
343 // last update check. 346 // last update check.
344 bool GetActiveBit(const std::string& extension_id); 347 bool GetActiveBit(const std::string& extension_id) const;
345 void SetActiveBit(const std::string& extension_id, bool active); 348 void SetActiveBit(const std::string& extension_id, bool active);
346 349
347 // Returns the granted permission set for the extension with |extension_id|, 350 // Returns the granted permission set for the extension with |extension_id|,
348 // and NULL if no preferences were found for |extension_id|. 351 // and NULL if no preferences were found for |extension_id|.
349 // This passes ownership of the returned set to the caller. 352 // This passes ownership of the returned set to the caller.
350 PermissionSet* GetGrantedPermissions(const std::string& extension_id); 353 PermissionSet* GetGrantedPermissions(const std::string& extension_id) const;
351 354
352 // Adds |permissions| to the granted permissions set for the extension with 355 // Adds |permissions| to the granted permissions set for the extension with
353 // |extension_id|. The new granted permissions set will be the union of 356 // |extension_id|. The new granted permissions set will be the union of
354 // |permissions| and the already granted permissions. 357 // |permissions| and the already granted permissions.
355 void AddGrantedPermissions(const std::string& extension_id, 358 void AddGrantedPermissions(const std::string& extension_id,
356 const PermissionSet* permissions); 359 const PermissionSet* permissions);
357 360
358 // As above, but subtracts the given |permissions| from the granted set. 361 // As above, but subtracts the given |permissions| from the granted set.
359 void RemoveGrantedPermissions(const std::string& extension_id, 362 void RemoveGrantedPermissions(const std::string& extension_id,
360 const PermissionSet* permissions); 363 const PermissionSet* permissions);
361 364
362 // Gets the active permission set for the specified extension. This may 365 // Gets the active permission set for the specified extension. This may
363 // differ from the permissions in the manifest due to the optional 366 // differ from the permissions in the manifest due to the optional
364 // permissions API. This passes ownership of the set to the caller. 367 // permissions API. This passes ownership of the set to the caller.
365 PermissionSet* GetActivePermissions(const std::string& extension_id); 368 PermissionSet* GetActivePermissions(const std::string& extension_id) const;
366 369
367 // Sets the active |permissions| for the extension with |extension_id|. 370 // Sets the active |permissions| for the extension with |extension_id|.
368 void SetActivePermissions(const std::string& extension_id, 371 void SetActivePermissions(const std::string& extension_id,
369 const PermissionSet* permissions); 372 const PermissionSet* permissions);
370 373
371 // Records whether or not this extension is currently running. 374 // Records whether or not this extension is currently running.
372 void SetExtensionRunning(const std::string& extension_id, bool is_running); 375 void SetExtensionRunning(const std::string& extension_id, bool is_running);
373 376
374 // Returns whether or not this extension is marked as running. This is used to 377 // Returns whether or not this extension is marked as running. This is used to
375 // restart apps across browser restarts. 378 // restart apps across browser restarts.
376 bool IsExtensionRunning(const std::string& extension_id); 379 bool IsExtensionRunning(const std::string& extension_id) const;
377 380
378 // Set/Get whether or not the app is active. Used to force a launch of apps 381 // Set/Get whether or not the app is active. Used to force a launch of apps
379 // that don't handle onRestarted() on a restart. We can only safely do that if 382 // that don't handle onRestarted() on a restart. We can only safely do that if
380 // the app was active when it was last running. 383 // the app was active when it was last running.
381 void SetIsActive(const std::string& extension_id, bool is_active); 384 void SetIsActive(const std::string& extension_id, bool is_active);
382 bool IsActive(const std::string& extension_id); 385 bool IsActive(const std::string& extension_id) const;
383 386
384 // Returns true if the user enabled this extension to be loaded in incognito 387 // Returns true if the user enabled this extension to be loaded in incognito
385 // mode. 388 // mode.
386 // 389 //
387 // IMPORTANT: you probably want to use extensions::util::IsIncognitoEnabled 390 // IMPORTANT: you probably want to use extensions::util::IsIncognitoEnabled
388 // instead of this method. 391 // instead of this method.
389 bool IsIncognitoEnabled(const std::string& extension_id) const; 392 bool IsIncognitoEnabled(const std::string& extension_id) const;
390 void SetIsIncognitoEnabled(const std::string& extension_id, bool enabled); 393 void SetIsIncognitoEnabled(const std::string& extension_id, bool enabled);
391 394
392 // Returns true if the user has chosen to allow this extension to inject 395 // Returns true if the user has chosen to allow this extension to inject
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 scoped_ptr<ExtensionsInfo> GetAllDelayedInstallInfo() const; 446 scoped_ptr<ExtensionsInfo> GetAllDelayedInstallInfo() const;
444 447
445 // Returns true if the extension is an ephemeral app. 448 // Returns true if the extension is an ephemeral app.
446 bool IsEphemeralApp(const std::string& extension_id) const; 449 bool IsEphemeralApp(const std::string& extension_id) const;
447 450
448 // Promotes an ephemeral app to a regular installed app. 451 // Promotes an ephemeral app to a regular installed app.
449 void OnEphemeralAppPromoted(const std::string& extension_id); 452 void OnEphemeralAppPromoted(const std::string& extension_id);
450 453
451 // Returns true if the user repositioned the app on the app launcher via drag 454 // Returns true if the user repositioned the app on the app launcher via drag
452 // and drop. 455 // and drop.
453 bool WasAppDraggedByUser(const std::string& extension_id); 456 bool WasAppDraggedByUser(const std::string& extension_id) const;
454 457
455 // Sets a flag indicating that the user repositioned the app on the app 458 // Sets a flag indicating that the user repositioned the app on the app
456 // launcher by drag and dropping it. 459 // launcher by drag and dropping it.
457 void SetAppDraggedByUser(const std::string& extension_id); 460 void SetAppDraggedByUser(const std::string& extension_id);
458 461
459 // Returns true if there is an extension which controls the preference value 462 // Returns true if there is an extension which controls the preference value
460 // for |pref_key| *and* it is specific to incognito mode. 463 // for |pref_key| *and* it is specific to incognito mode.
461 bool HasIncognitoPrefValue(const std::string& pref_key); 464 bool HasIncognitoPrefValue(const std::string& pref_key) const;
462 465
463 // Returns the creation flags mask for the extension. 466 // Returns the creation flags mask for the extension.
464 int GetCreationFlags(const std::string& extension_id) const; 467 int GetCreationFlags(const std::string& extension_id) const;
465 468
466 // Returns the creation flags mask for a delayed install extension. 469 // Returns the creation flags mask for a delayed install extension.
467 int GetDelayedInstallCreationFlags(const std::string& extension_id) const; 470 int GetDelayedInstallCreationFlags(const std::string& extension_id) const;
468 471
469 // Returns true if the extension was installed from the Chrome Web Store. 472 // Returns true if the extension was installed from the Chrome Web Store.
470 bool IsFromWebStore(const std::string& extension_id) const; 473 bool IsFromWebStore(const std::string& extension_id) const;
471 474
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 // The underlying PrefService. 506 // The underlying PrefService.
504 PrefService* pref_service() const { return prefs_; } 507 PrefService* pref_service() const { return prefs_; }
505 508
506 // The underlying AppSorting. 509 // The underlying AppSorting.
507 AppSorting* app_sorting() const { return app_sorting_.get(); } 510 AppSorting* app_sorting() const { return app_sorting_.get(); }
508 511
509 // Schedules garbage collection of an extension's on-disk data on the next 512 // Schedules garbage collection of an extension's on-disk data on the next
510 // start of this ExtensionService. Applies only to extensions with isolated 513 // start of this ExtensionService. Applies only to extensions with isolated
511 // storage. 514 // storage.
512 void SetNeedsStorageGarbageCollection(bool value); 515 void SetNeedsStorageGarbageCollection(bool value);
513 bool NeedsStorageGarbageCollection(); 516 bool NeedsStorageGarbageCollection() const;
514 517
515 // Used by AppWindowGeometryCache to persist its cache. These methods 518 // Used by AppWindowGeometryCache to persist its cache. These methods
516 // should not be called directly. 519 // should not be called directly.
517 const base::DictionaryValue* GetGeometryCache( 520 const base::DictionaryValue* GetGeometryCache(
518 const std::string& extension_id) const; 521 const std::string& extension_id) const;
519 void SetGeometryCache(const std::string& extension_id, 522 void SetGeometryCache(const std::string& extension_id,
520 scoped_ptr<base::DictionaryValue> cache); 523 scoped_ptr<base::DictionaryValue> cache);
521 524
522 // Used for verification of installed extension ids. For the Set method, pass 525 // Used for verification of installed extension ids. For the Set method, pass
523 // null to remove the preference. 526 // null to remove the preference.
524 const base::DictionaryValue* GetInstallSignature(); 527 const base::DictionaryValue* GetInstallSignature() const;
525 void SetInstallSignature(const base::DictionaryValue* signature); 528 void SetInstallSignature(const base::DictionaryValue* signature);
526 529
527 // The installation parameter associated with the extension. 530 // The installation parameter associated with the extension.
528 std::string GetInstallParam(const std::string& extension_id) const; 531 std::string GetInstallParam(const std::string& extension_id) const;
529 void SetInstallParam(const std::string& extension_id, 532 void SetInstallParam(const std::string& extension_id,
530 const std::string& install_parameter); 533 const std::string& install_parameter);
531 534
532 // The total number of times we've disabled an extension due to corrupted 535 // The total number of times we've disabled an extension due to corrupted
533 // contents. 536 // contents.
534 int GetCorruptedDisableCount(); 537 int GetCorruptedDisableCount() const;
535 void IncrementCorruptedDisableCount(); 538 void IncrementCorruptedDisableCount();
536 539
537 private: 540 private:
538 friend class ExtensionPrefsBlacklistedExtensions; // Unit test. 541 friend class ExtensionPrefsBlacklistedExtensions; // Unit test.
539 friend class ExtensionPrefsComponentExtension; // Unit test. 542 friend class ExtensionPrefsComponentExtension; // Unit test.
540 friend class ExtensionPrefsUninstallExtension; // Unit test. 543 friend class ExtensionPrefsUninstallExtension; // Unit test.
541 544
542 enum DisableReasonChange { 545 enum DisableReasonChange {
543 DISABLE_REASON_ADD, 546 DISABLE_REASON_ADD,
544 DISABLE_REASON_REMOVE, 547 DISABLE_REASON_REMOVE,
(...skipping 22 matching lines...) Expand all
567 // |extension| dictionary. 570 // |extension| dictionary.
568 scoped_ptr<ExtensionInfo> GetInstalledInfoHelper( 571 scoped_ptr<ExtensionInfo> GetInstalledInfoHelper(
569 const std::string& extension_id, 572 const std::string& extension_id,
570 const base::DictionaryValue* extension) const; 573 const base::DictionaryValue* extension) const;
571 574
572 // Interprets the list pref, |pref_key| in |extension_id|'s preferences, as a 575 // Interprets the list pref, |pref_key| in |extension_id|'s preferences, as a
573 // URLPatternSet. The |valid_schemes| specify how to parse the URLPatterns. 576 // URLPatternSet. The |valid_schemes| specify how to parse the URLPatterns.
574 bool ReadPrefAsURLPatternSet(const std::string& extension_id, 577 bool ReadPrefAsURLPatternSet(const std::string& extension_id,
575 const std::string& pref_key, 578 const std::string& pref_key,
576 URLPatternSet* result, 579 URLPatternSet* result,
577 int valid_schemes); 580 int valid_schemes) const;
578 581
579 // Converts |new_value| to a list of strings and sets the |pref_key| pref 582 // Converts |new_value| to a list of strings and sets the |pref_key| pref
580 // belonging to |extension_id|. 583 // belonging to |extension_id|.
581 void SetExtensionPrefURLPatternSet(const std::string& extension_id, 584 void SetExtensionPrefURLPatternSet(const std::string& extension_id,
582 const std::string& pref_key, 585 const std::string& pref_key,
583 const URLPatternSet& new_value); 586 const URLPatternSet& new_value);
584 587
585 // Read the boolean preference entry and return true if the preference exists 588 // Read the boolean preference entry and return true if the preference exists
586 // and the preference's value is true; false otherwise. 589 // and the preference's value is true; false otherwise.
587 bool ReadPrefAsBooleanAndReturn(const std::string& extension_id, 590 bool ReadPrefAsBooleanAndReturn(const std::string& extension_id,
588 const std::string& key) const; 591 const std::string& key) const;
589 592
590 // Interprets |pref_key| in |extension_id|'s preferences as an 593 // Interprets |pref_key| in |extension_id|'s preferences as an
591 // PermissionSet, and passes ownership of the set to the caller. 594 // PermissionSet, and passes ownership of the set to the caller.
592 PermissionSet* ReadPrefAsPermissionSet(const std::string& extension_id, 595 PermissionSet* ReadPrefAsPermissionSet(const std::string& extension_id,
593 const std::string& pref_key); 596 const std::string& pref_key) const;
594 597
595 // Converts the |new_value| to its value and sets the |pref_key| pref 598 // Converts the |new_value| to its value and sets the |pref_key| pref
596 // belonging to |extension_id|. 599 // belonging to |extension_id|.
597 void SetExtensionPrefPermissionSet(const std::string& extension_id, 600 void SetExtensionPrefPermissionSet(const std::string& extension_id,
598 const std::string& pref_key, 601 const std::string& pref_key,
599 const PermissionSet* new_value); 602 const PermissionSet* new_value);
600 603
601 // Returns an immutable dictionary for extension |id|'s prefs, or NULL if it 604 // Returns an immutable dictionary for extension |id|'s prefs, or NULL if it
602 // doesn't exist. 605 // doesn't exist.
603 const base::DictionaryValue* GetExtensionPref(const std::string& id) const; 606 const base::DictionaryValue* GetExtensionPref(const std::string& id) const;
(...skipping 24 matching lines...) Expand all
628 // it matches |check_state|. 631 // it matches |check_state|.
629 bool DoesExtensionHaveState(const std::string& id, 632 bool DoesExtensionHaveState(const std::string& id,
630 Extension::State check_state) const; 633 Extension::State check_state) const;
631 634
632 // Reads the list of strings for |pref| from user prefs into 635 // Reads the list of strings for |pref| from user prefs into
633 // |id_container_out|. Returns false if the pref wasn't found in the user 636 // |id_container_out|. Returns false if the pref wasn't found in the user
634 // pref store. 637 // pref store.
635 template <class ExtensionIdContainer> 638 template <class ExtensionIdContainer>
636 bool GetUserExtensionPrefIntoContainer( 639 bool GetUserExtensionPrefIntoContainer(
637 const char* pref, 640 const char* pref,
638 ExtensionIdContainer* id_container_out); 641 ExtensionIdContainer* id_container_out) const;
639 642
640 // Writes the list of strings contained in |strings| to |pref| in prefs. 643 // Writes the list of strings contained in |strings| to |pref| in prefs.
641 template <class ExtensionIdContainer> 644 template <class ExtensionIdContainer>
642 void SetExtensionPrefFromContainer(const char* pref, 645 void SetExtensionPrefFromContainer(const char* pref,
643 const ExtensionIdContainer& strings); 646 const ExtensionIdContainer& strings);
644 647
645 // Helper function to populate |extension_dict| with the values needed 648 // Helper function to populate |extension_dict| with the values needed
646 // by a newly installed extension. Work is broken up between this 649 // by a newly installed extension. Work is broken up between this
647 // function and FinishExtensionInfoPrefs() to accomodate delayed 650 // function and FinishExtensionInfoPrefs() to accommodate delayed
648 // installations. 651 // installations.
649 // 652 //
650 // |install_flags| are a bitmask of extension::InstallFlags. 653 // |install_flags| are a bitmask of extension::InstallFlags.
651 void PopulateExtensionInfoPrefs(const Extension* extension, 654 void PopulateExtensionInfoPrefs(const Extension* extension,
652 const base::Time install_time, 655 const base::Time install_time,
653 Extension::State initial_state, 656 Extension::State initial_state,
654 int install_flags, 657 int install_flags,
655 const std::string& install_parameter, 658 const std::string& install_parameter,
656 base::DictionaryValue* extension_dict); 659 base::DictionaryValue* extension_dict) const;
657 660
658 void InitExtensionControlledPrefs(ExtensionPrefValueMap* value_map); 661 void InitExtensionControlledPrefs(ExtensionPrefValueMap* value_map);
659 662
660 // Helper function to complete initialization of the values in 663 // Helper function to complete initialization of the values in
661 // |extension_dict| for an extension install. Also see 664 // |extension_dict| for an extension install. Also see
662 // PopulateExtensionInfoPrefs(). 665 // PopulateExtensionInfoPrefs().
663 void FinishExtensionInfoPrefs( 666 void FinishExtensionInfoPrefs(
664 const std::string& extension_id, 667 const std::string& extension_id,
665 const base::Time install_time, 668 const base::Time install_time,
666 bool needs_sort_ordinal, 669 bool needs_sort_ordinal,
(...skipping 19 matching lines...) Expand all
686 bool extensions_disabled_; 689 bool extensions_disabled_;
687 690
688 ObserverList<ExtensionPrefsObserver> observer_list_; 691 ObserverList<ExtensionPrefsObserver> observer_list_;
689 692
690 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); 693 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs);
691 }; 694 };
692 695
693 } // namespace extensions 696 } // namespace extensions
694 697
695 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ 698 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698