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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
6#define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
7
8#include <set>
9#include <string>
10#include <vector>
11
12#include "base/memory/linked_ptr.h"
13#include "base/memory/scoped_ptr.h"
14#include "base/time/time.h"
15#include "base/values.h"
16#include "chrome/browser/extensions/blacklist.h"
17#include "chrome/browser/extensions/extension_scoped_prefs.h"
18#include "chrome/browser/prefs/scoped_user_pref_update.h"
19#include "chrome/common/extensions/extension.h"
20#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
21#include "extensions/common/url_pattern_set.h"
22#include "sync/api/string_ordinal.h"
23
24class ExtensionPrefValueMap;
25class ExtensionSorting;
26class PrefService;
27class Profile;
28
29namespace user_prefs {
30class PrefRegistrySyncable;
31}
32
33namespace extensions {
34class ContentSettingsStore;
35class ExtensionPrefsUninstallExtension;
36class URLPatternSet;
37
38// Class for managing global and per-extension preferences.
39//
40// This class distinguishes the following kinds of preferences:
41// - global preferences:
42//       internal state for the extension system in general, not associated
43//       with an individual extension, such as lastUpdateTime.
44// - per-extension preferences:
45//       meta-preferences describing properties of the extension like
46//       installation time, whether the extension is enabled, etc.
47// - extension controlled preferences:
48//       browser preferences that an extension controls. For example, an
49//       extension could use the proxy API to specify the browser's proxy
50//       preference. Extension-controlled preferences are stored in
51//       PrefValueStore::extension_prefs(), which this class populates and
52//       maintains as the underlying extensions change.
53class ExtensionPrefs : public ExtensionScopedPrefs,
54                       public BrowserContextKeyedService {
55 public:
56  // Key name for a preference that keeps track of per-extension settings. This
57  // is a dictionary object read from the Preferences file, keyed off of
58  // extension ids.
59  static const char kExtensionsPref[];
60
61  // Key for what version chrome was last time the extension prefs were loaded.
62  static const char kExtensionsLastChromeVersion[];
63
64  typedef std::vector<linked_ptr<ExtensionInfo> > ExtensionsInfo;
65
66  // Vector containing identifiers for preferences.
67  typedef std::set<std::string> PrefKeySet;
68
69  // This enum is used for the launch type the user wants to use for an
70  // application.
71  // Do not remove items or re-order this enum as it is used in preferences
72  // and histograms.
73  enum LaunchType {
74    LAUNCH_PINNED,
75    LAUNCH_REGULAR,
76    LAUNCH_FULLSCREEN,
77    LAUNCH_WINDOW,
78
79    // Launch an app in the in the way a click on the NTP would,
80    // if no user pref were set.  Update this constant to change
81    // the default for the NTP and chrome.management.launchApp().
82    LAUNCH_DEFAULT = LAUNCH_REGULAR
83  };
84
85  // This enum is used to store the reason an extension's install has been
86  // delayed.  Do not remove items or re-order this enum as it is used in
87  // preferences.
88  enum DelayReason {
89    DELAY_REASON_NONE = 0,
90    DELAY_REASON_GC = 1,
91    DELAY_REASON_WAIT_FOR_IDLE = 2,
92    DELAY_REASON_WAIT_FOR_IMPORTS = 3,
93  };
94
95
96  // Creates base::Time classes. The default implementation is just to return
97  // the current time, but tests can inject alternative implementations.
98  class TimeProvider {
99   public:
100    TimeProvider();
101
102    virtual ~TimeProvider();
103
104    // By default, returns the current time (base::Time::Now()).
105    virtual base::Time GetCurrentTime() const;
106
107   private:
108    DISALLOW_COPY_AND_ASSIGN(TimeProvider);
109  };
110
111  // A wrapper around a ScopedUserPrefUpdate, which allows us to access the
112  // entry of a particular key for an extension. Use this if you need a mutable
113  // record of a dictionary or list in the current settings. Otherwise, prefer
114  // ReadPrefAsT() and UpdateExtensionPref() methods.
115  template <typename T, base::Value::Type type_enum_value>
116  class ScopedUpdate {
117   public:
118    ScopedUpdate(ExtensionPrefs* prefs,
119                 const std::string& extension_id,
120                 const std::string& key);
121    virtual ~ScopedUpdate();
122
123    // Returns a mutable value for the key (ownership remains with the prefs),
124    // if one exists. Otherwise, returns NULL.
125    virtual T* Get();
126
127    // Creates and returns a mutable value for the key (the prefs own the new
128    // value), if one does not already exist. Otherwise, returns the current
129    // value.
130    virtual T* Create();
131
132   private:
133    DISALLOW_COPY_AND_ASSIGN(ScopedUpdate);
134
135    DictionaryPrefUpdate update_;
136    const std::string extension_id_;
137    const std::string key_;
138  };
139  typedef ScopedUpdate<base::DictionaryValue, base::Value::TYPE_DICTIONARY>
140      ScopedDictionaryUpdate;
141  typedef ScopedUpdate<base::ListValue, base::Value::TYPE_LIST>
142      ScopedListUpdate;
143
144  // Creates and initializes an ExtensionPrefs object.
145  // Does not take ownership of |prefs| and |extension_pref_value_map|.
146  // If |extensions_disabled| is true, extension controlled preferences and
147  // content settings do not become effective.
148  static ExtensionPrefs* Create(
149      PrefService* prefs,
150      const base::FilePath& root_dir,
151      ExtensionPrefValueMap* extension_pref_value_map,
152      bool extensions_disabled);
153
154  // A version of Create which allows injection of a custom base::Time provider.
155  // Use this as needed for testing.
156  static ExtensionPrefs* Create(
157      PrefService* prefs,
158      const base::FilePath& root_dir,
159      ExtensionPrefValueMap* extension_pref_value_map,
160      bool extensions_disabled,
161      scoped_ptr<TimeProvider> time_provider);
162
163  virtual ~ExtensionPrefs();
164
165  // Convenience function to get the ExtensionPrefs for a Profile.
166  static ExtensionPrefs* Get(Profile* profile);
167
168  // Returns all installed extensions from extension preferences provided by
169  // |pref_service|. This is exposed for ProtectedPrefsWatcher because it needs
170  // access to the extension ID list before the ExtensionService is initialized.
171  static ExtensionIdList GetExtensionsFrom(const PrefService* pref_service);
172
173  // Returns true if the specified external extension was uninstalled by the
174  // user.
175  bool IsExternalExtensionUninstalled(const std::string& id) const;
176
177  // Checks whether |extension_id| is disabled. If there's no state pref for
178  // the extension, this will return false. Generally you should use
179  // ExtensionService::IsExtensionEnabled instead.
180  bool IsExtensionDisabled(const std::string& id) const;
181
182  // Get/Set the order that the browser actions appear in the toolbar.
183  ExtensionIdList GetToolbarOrder();
184  void SetToolbarOrder(const ExtensionIdList& extension_ids);
185
186  // Called when an extension is installed, so that prefs get created.
187  // If |page_ordinal| is an invalid ordinal, then a page will be found
188  // for the App.
189  void OnExtensionInstalled(const Extension* extension,
190                            Extension::State initial_state,
191                            Blacklist::BlacklistState blacklist_state,
192                            const syncer::StringOrdinal& page_ordinal);
193
194  // Called when an extension is uninstalled, so that prefs get cleaned up.
195  void OnExtensionUninstalled(const std::string& extension_id,
196                              const Manifest::Location& location,
197                              bool external_uninstall);
198
199  // Called to change the extension's state when it is enabled/disabled.
200  void SetExtensionState(const std::string& extension_id, Extension::State);
201
202  // Populates |out| with the ids of all installed extensions.
203  void GetExtensions(ExtensionIdList* out);
204
205  // ExtensionScopedPrefs methods:
206  virtual void UpdateExtensionPref(const std::string& id,
207                                   const std::string& key,
208                                   base::Value* value) OVERRIDE;
209
210  virtual void DeleteExtensionPrefs(const std::string& id) OVERRIDE;
211
212  virtual bool ReadPrefAsBoolean(const std::string& extension_id,
213                                 const std::string& pref_key,
214                                 bool* out_value) const OVERRIDE;
215
216  virtual bool ReadPrefAsInteger(const std::string& extension_id,
217                                 const std::string& pref_key,
218                                 int* out_value) const OVERRIDE;
219
220  virtual bool ReadPrefAsString(const std::string& extension_id,
221                                const std::string& pref_key,
222                                std::string* out_value) const OVERRIDE;
223
224  virtual bool ReadPrefAsList(const std::string& extension_id,
225                              const std::string& pref_key,
226                              const base::ListValue** out_value) const OVERRIDE;
227
228  virtual bool ReadPrefAsDictionary(
229      const std::string& extension_id,
230      const std::string& pref_key,
231      const base::DictionaryValue** out_value) const OVERRIDE;
232
233  virtual bool HasPrefForExtension(const std::string& extension_id) const
234      OVERRIDE;
235
236  // Did the extension ask to escalate its permission during an upgrade?
237  bool DidExtensionEscalatePermissions(const std::string& id);
238
239  // If |did_escalate| is true, the preferences for |extension| will be set to
240  // require the install warning when the user tries to enable.
241  void SetDidExtensionEscalatePermissions(
242      const Extension* extension,
243      bool did_escalate);
244
245  // Getter and setters for disabled reason.
246  int GetDisableReasons(const std::string& extension_id);
247  void AddDisableReason(const std::string& extension_id,
248                        Extension::DisableReason disable_reason);
249  void RemoveDisableReason(const std::string& extension_id,
250                           Extension::DisableReason disable_reason);
251  void ClearDisableReasons(const std::string& extension_id);
252
253  // Gets the set of extensions that have been blacklisted in prefs.
254  std::set<std::string> GetBlacklistedExtensions();
255
256  // Sets whether the extension with |id| is blacklisted.
257  void SetExtensionBlacklisted(const std::string& extension_id,
258                               bool is_blacklisted);
259
260  // Returns the version string for the currently installed extension, or
261  // the empty string if not found.
262  std::string GetVersionString(const std::string& extension_id);
263
264  // Re-writes the extension manifest into the prefs.
265  // Called to change the extension's manifest when it's re-localized.
266  void UpdateManifest(const Extension* extension);
267
268  // Returns extension path based on extension ID, or empty FilePath on error.
269  base::FilePath GetExtensionPath(const std::string& extension_id);
270
271  // Returns base extensions install directory.
272  const base::FilePath& install_directory() const { return install_directory_; }
273
274  // Returns whether the extension with |id| has its blacklist bit set.
275  //
276  // WARNING: this only checks the extension's entry in prefs, so by definition
277  // can only check extensions that prefs knows about. There may be other
278  // sources of blacklist information, such as safebrowsing. You probably want
279  // to use Blacklist::GetBlacklistedIDs rather than this method.
280  bool IsExtensionBlacklisted(const std::string& id) const;
281
282  // Increment the count of how many times we prompted the user to acknowledge
283  // the given extension, and return the new count.
284  int IncrementAcknowledgePromptCount(const std::string& extension_id);
285
286  // Whether the user has acknowledged an external extension.
287  bool IsExternalExtensionAcknowledged(const std::string& extension_id);
288  void AcknowledgeExternalExtension(const std::string& extension_id);
289
290  // Whether the user has acknowledged a blacklisted extension.
291  bool IsBlacklistedExtensionAcknowledged(const std::string& extension_id);
292  void AcknowledgeBlacklistedExtension(const std::string& extension_id);
293
294  // Whether the external extension was installed during the first run
295  // of this profile.
296  bool IsExternalInstallFirstRun(const std::string& extension_id);
297  void SetExternalInstallFirstRun(const std::string& extension_id);
298
299  // Returns true if the extension notification code has already run for the
300  // first time for this profile. Currently we use this flag to mean that any
301  // extensions that would trigger notifications should get silently
302  // acknowledged. This is a fuse. Calling it the first time returns false.
303  // Subsequent calls return true. It's not possible through an API to ever
304  // reset it. Don't call it unless you mean it!
305  bool SetAlertSystemFirstRun();
306
307  // Checks if extensions are blacklisted by default, by policy.
308  // The ManagementPolicy::Provider methods also take this into account, and
309  // should be used instead when the extension ID is known.
310  bool ExtensionsBlacklistedByDefault() const;
311
312  // Returns the last value set via SetLastPingDay. If there isn't such a
313  // pref, the returned Time will return true for is_null().
314  base::Time LastPingDay(const std::string& extension_id) const;
315
316  // The time stored is based on the server's perspective of day start time, not
317  // the client's.
318  void SetLastPingDay(const std::string& extension_id, const base::Time& time);
319
320  // Similar to the 2 above, but for the extensions blacklist.
321  base::Time BlacklistLastPingDay() const;
322  void SetBlacklistLastPingDay(const base::Time& time);
323
324  // Similar to LastPingDay/SetLastPingDay, but for sending "days since active"
325  // ping.
326  base::Time LastActivePingDay(const std::string& extension_id);
327  void SetLastActivePingDay(const std::string& extension_id,
328                            const base::Time& time);
329
330  // A bit we use for determining if we should send the "days since active"
331  // ping. A value of true means the item has been active (launched) since the
332  // last update check.
333  bool GetActiveBit(const std::string& extension_id);
334  void SetActiveBit(const std::string& extension_id, bool active);
335
336  // Returns the granted permission set for the extension with |extension_id|,
337  // and NULL if no preferences were found for |extension_id|.
338  // This passes ownership of the returned set to the caller.
339  PermissionSet* GetGrantedPermissions(const std::string& extension_id);
340
341  // Adds |permissions| to the granted permissions set for the extension with
342  // |extension_id|. The new granted permissions set will be the union of
343  // |permissions| and the already granted permissions.
344  void AddGrantedPermissions(const std::string& extension_id,
345                             const PermissionSet* permissions);
346
347  // As above, but subtracts the given |permissions| from the granted set.
348  void RemoveGrantedPermissions(const std::string& extension_id,
349                                const PermissionSet* permissions);
350
351  // Gets the active permission set for the specified extension. This may
352  // differ from the permissions in the manifest due to the optional
353  // permissions API. This passes ownership of the set to the caller.
354  PermissionSet* GetActivePermissions(const std::string& extension_id);
355
356  // Sets the active |permissions| for the extension with |extension_id|.
357  void SetActivePermissions(const std::string& extension_id,
358                            const PermissionSet* permissions);
359
360  // Records whether or not this extension is currently running.
361  void SetExtensionRunning(const std::string& extension_id, bool is_running);
362
363  // Returns whether or not this extension is marked as running. This is used to
364  // restart apps across browser restarts.
365  bool IsExtensionRunning(const std::string& extension_id);
366
367  // Set/Get whether or not the app is active. Used to force a launch of apps
368  // that don't handle onRestarted() on a restart. We can only safely do that if
369  // the app was active when it was last running.
370  void SetIsActive(const std::string& extension_id, bool is_active);
371  bool IsActive(const std::string& extension_id);
372
373  // Returns true if the user enabled this extension to be loaded in incognito
374  // mode.
375  //
376  // IMPORTANT: you probably want to use ExtensionService::IsIncognitoEnabled
377  // instead of this method.
378  bool IsIncognitoEnabled(const std::string& extension_id);
379  void SetIsIncognitoEnabled(const std::string& extension_id, bool enabled);
380
381  // Returns true if the user has chosen to allow this extension to inject
382  // scripts into pages with file URLs.
383  bool AllowFileAccess(const std::string& extension_id);
384  void SetAllowFileAccess(const std::string& extension_id, bool allow);
385  bool HasAllowFileAccessSetting(const std::string& extension_id) const;
386
387  // Get the launch type preference.  If no preference is set, return
388  // |default_pref_value|.
389  LaunchType GetLaunchType(const Extension* extension,
390                           LaunchType default_pref_value);
391
392  void SetLaunchType(const std::string& extension_id, LaunchType launch_type);
393
394  // Find the right launch container based on the launch type.
395  // If |extension|'s prefs do not have a launch type set, then
396  // use |default_pref_value|.
397  extension_misc::LaunchContainer GetLaunchContainer(
398      const Extension* extension,
399      LaunchType default_pref_value);
400
401  // Saves ExtensionInfo for each installed extension with the path to the
402  // version directory and the location. Blacklisted extensions won't be saved
403  // and neither will external extensions the user has explicitly uninstalled.
404  // Caller takes ownership of returned structure.
405  scoped_ptr<ExtensionsInfo> GetInstalledExtensionsInfo() const;
406
407  // Returns the ExtensionInfo from the prefs for the given extension. If the
408  // extension is not present, NULL is returned.
409  scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo(
410      const std::string& extension_id) const;
411
412  // We've downloaded an updated .crx file for the extension, but are waiting
413  // to install it.
414  void SetDelayedInstallInfo(const Extension* extension,
415                             Extension::State initial_state,
416                             Blacklist::BlacklistState blacklist_state,
417                             DelayReason delay_reason,
418                             const syncer::StringOrdinal& page_ordinal);
419
420  // Removes any delayed install information we have for the given
421  // |extension_id|. Returns true if there was info to remove; false otherwise.
422  bool RemoveDelayedInstallInfo(const std::string& extension_id);
423
424  // Update the prefs to finish the update for an extension.
425  bool FinishDelayedInstallInfo(const std::string& extension_id);
426
427  // Returns the ExtensionInfo from the prefs for delayed install information
428  // for |extension_id|, if we have any. Otherwise returns NULL.
429  scoped_ptr<ExtensionInfo> GetDelayedInstallInfo(
430      const std::string& extension_id) const;
431
432  DelayReason GetDelayedInstallReason(const std::string& extension_id) const;
433
434  // Returns information about all the extensions that have delayed install
435  // information.
436  scoped_ptr<ExtensionsInfo> GetAllDelayedInstallInfo() const;
437
438  // Returns true if the user repositioned the app on the app launcher via drag
439  // and drop.
440  bool WasAppDraggedByUser(const std::string& extension_id);
441
442  // Sets a flag indicating that the user repositioned the app on the app
443  // launcher by drag and dropping it.
444  void SetAppDraggedByUser(const std::string& extension_id);
445
446  // Returns true if there is an extension which controls the preference value
447  //  for |pref_key| *and* it is specific to incognito mode.
448  bool HasIncognitoPrefValue(const std::string& pref_key);
449
450  // Returns the creation flags mask for the extension.
451  int GetCreationFlags(const std::string& extension_id) const;
452
453  // Returns the creation flags mask for a delayed install extension.
454  int GetDelayedInstallCreationFlags(const std::string& extension_id) const;
455
456  // Returns true if the extension was installed from the Chrome Web Store.
457  bool IsFromWebStore(const std::string& extension_id) const;
458
459  // Returns true if the extension was installed from an App generated from a
460  // bookmark.
461  bool IsFromBookmark(const std::string& extension_id) const;
462
463  // Returns true if the extension was installed as a default app.
464  bool WasInstalledByDefault(const std::string& extension_id) const;
465
466  // Helper method to acquire the installation time of an extension.
467  // Returns base::Time() if the installation time could not be parsed or
468  // found.
469  base::Time GetInstallTime(const std::string& extension_id) const;
470
471  static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
472
473  bool extensions_disabled() { return extensions_disabled_; }
474
475  ContentSettingsStore* content_settings_store() {
476    return content_settings_store_.get();
477  }
478
479  // The underlying PrefService.
480  PrefService* pref_service() const { return prefs_; }
481
482  // The underlying ExtensionSorting.
483  ExtensionSorting* extension_sorting() const {
484    return extension_sorting_.get();
485  }
486
487  // Describes the URLs that are able to install extensions. See
488  // prefs::kExtensionAllowedInstallSites for more information.
489  URLPatternSet GetAllowedInstallSites();
490
491  // Schedules garbage collection of an extension's on-disk data on the next
492  // start of this ExtensionService. Applies only to extensions with isolated
493  // storage.
494  void SetNeedsStorageGarbageCollection(bool value);
495  bool NeedsStorageGarbageCollection();
496
497  // Used by ShellWindowGeometryCache to persist its cache. These methods
498  // should not be called directly.
499  const base::DictionaryValue* GetGeometryCache(
500        const std::string& extension_id) const;
501  void SetGeometryCache(const std::string& extension_id,
502                        scoped_ptr<base::DictionaryValue> cache);
503
504 private:
505  friend class ExtensionPrefsBlacklistedExtensions;  // Unit test.
506  friend class ExtensionPrefsUninstallExtension;     // Unit test.
507
508  // See the Create methods.
509  ExtensionPrefs(PrefService* prefs,
510                 const base::FilePath& root_dir,
511                 ExtensionPrefValueMap* extension_pref_value_map,
512                 scoped_ptr<TimeProvider> time_provider,
513                 bool extensions_disabled);
514
515  // Converts absolute paths in the pref to paths relative to the
516  // install_directory_.
517  void MakePathsRelative();
518
519  // Converts internal relative paths to be absolute. Used for export to
520  // consumers who expect full paths.
521  void MakePathsAbsolute(base::DictionaryValue* dict);
522
523  // Helper function used by GetInstalledExtensionInfo() and
524  // GetDelayedInstallInfo() to construct an ExtensionInfo from the provided
525  // |extension| dictionary.
526  scoped_ptr<ExtensionInfo> GetInstalledInfoHelper(
527      const std::string& extension_id,
528      const base::DictionaryValue* extension) const;
529
530  // Interprets the list pref, |pref_key| in |extension_id|'s preferences, as a
531  // URLPatternSet. The |valid_schemes| specify how to parse the URLPatterns.
532  bool ReadPrefAsURLPatternSet(const std::string& extension_id,
533                               const std::string& pref_key,
534                               URLPatternSet* result,
535                               int valid_schemes);
536
537  // Converts |new_value| to a list of strings and sets the |pref_key| pref
538  // belonging to |extension_id|.
539  void SetExtensionPrefURLPatternSet(const std::string& extension_id,
540                                     const std::string& pref_key,
541                                     const URLPatternSet& new_value);
542
543  // Read the boolean preference entry and return true if the preference exists
544  // and the preference's value is true; false otherwise.
545  bool ReadPrefAsBooleanAndReturn(const std::string& extension_id,
546                                  const std::string& key) const;
547
548  // Interprets |pref_key| in |extension_id|'s preferences as an
549  // PermissionSet, and passes ownership of the set to the caller.
550  PermissionSet* ReadPrefAsPermissionSet(const std::string& extension_id,
551                                         const std::string& pref_key);
552
553  // Converts the |new_value| to its value and sets the |pref_key| pref
554  // belonging to |extension_id|.
555  void SetExtensionPrefPermissionSet(const std::string& extension_id,
556                                     const std::string& pref_key,
557                                     const PermissionSet* new_value);
558
559  // Returns an immutable dictionary for extension |id|'s prefs, or NULL if it
560  // doesn't exist.
561  const base::DictionaryValue* GetExtensionPref(const std::string& id) const;
562
563  // Fix missing preference entries in the extensions that are were introduced
564  // in a later Chrome version.
565  void FixMissingPrefs(const ExtensionIdList& extension_ids);
566
567  // Installs the persistent extension preferences into |prefs_|'s extension
568  // pref store. Does nothing if extensions_disabled_ is true.
569  void InitPrefStore();
570
571  // Migrates the permissions data in the pref store.
572  void MigratePermissions(const ExtensionIdList& extension_ids);
573
574  // Migrates the disable reasons from a single enum to a bit mask.
575  void MigrateDisableReasons(const ExtensionIdList& extension_ids);
576
577  // Checks whether there is a state pref for the extension and if so, whether
578  // it matches |check_state|.
579  bool DoesExtensionHaveState(const std::string& id,
580                              Extension::State check_state) const;
581
582  // Helper function to Get/Set array of strings from/to prefs.
583  ExtensionIdList GetExtensionPrefAsVector(const char* pref);
584  void SetExtensionPrefFromVector(const char* pref,
585                                  const ExtensionIdList& extension_ids);
586
587  // Helper function to populate |extension_dict| with the values needed
588  // by a newly installed extension. Work is broken up between this
589  // function and FinishExtensionInfoPrefs() to accomodate delayed
590  // installations.
591  void PopulateExtensionInfoPrefs(const Extension* extension,
592                                  const base::Time install_time,
593                                  Extension::State initial_state,
594                                  Blacklist::BlacklistState blacklist_state,
595                                  base::DictionaryValue* extension_dict);
596
597  // Helper function to complete initialization of the values in
598  // |extension_dict| for an extension install. Also see
599  // PopulateExtensionInfoPrefs().
600  void FinishExtensionInfoPrefs(
601      const std::string& extension_id,
602      const base::Time install_time,
603      bool needs_sort_ordinal,
604      const syncer::StringOrdinal& suggested_page_ordinal,
605      base::DictionaryValue* extension_dict);
606
607  // The pref service specific to this set of extension prefs. Owned by profile.
608  PrefService* prefs_;
609
610  // Base extensions install directory.
611  base::FilePath install_directory_;
612
613  // Weak pointer, owned by Profile.
614  ExtensionPrefValueMap* extension_pref_value_map_;
615
616  // Contains all the logic for handling the order for various extension
617  // properties.
618  scoped_ptr<ExtensionSorting> extension_sorting_;
619
620  scoped_refptr<ContentSettingsStore> content_settings_store_;
621
622  scoped_ptr<TimeProvider> time_provider_;
623
624  bool extensions_disabled_;
625
626  DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs);
627};
628
629}  // namespace extensions
630
631#endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
632