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

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

Issue 1254363004: Move ownership of AppSorting from ExtensionPrefs to ExtensionSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 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
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // Creates an ExtensionPrefs object. 127 // Creates an ExtensionPrefs object.
128 // Does not take ownership of |prefs| or |extension_pref_value_map|. 128 // Does not take ownership of |prefs| or |extension_pref_value_map|.
129 // If |extensions_disabled| is true, extension controlled preferences and 129 // If |extensions_disabled| is true, extension controlled preferences and
130 // content settings do not become effective. ExtensionPrefsObservers should be 130 // content settings do not become effective. ExtensionPrefsObservers should be
131 // included in |early_observers| if they need to observe events which occur 131 // included in |early_observers| if they need to observe events which occur
132 // during initialization of the ExtensionPrefs object. 132 // during initialization of the ExtensionPrefs object.
133 static ExtensionPrefs* Create( 133 static ExtensionPrefs* Create(
134 PrefService* prefs, 134 PrefService* prefs,
135 const base::FilePath& root_dir, 135 const base::FilePath& root_dir,
136 ExtensionPrefValueMap* extension_pref_value_map, 136 ExtensionPrefValueMap* extension_pref_value_map,
137 scoped_ptr<AppSorting> app_sorting,
138 bool extensions_disabled, 137 bool extensions_disabled,
139 const std::vector<ExtensionPrefsObserver*>& early_observers); 138 const std::vector<ExtensionPrefsObserver*>& early_observers);
140 139
141 // A version of Create which allows injection of a custom base::Time provider. 140 // A version of Create which allows injection of a custom base::Time provider.
142 // Use this as needed for testing. 141 // Use this as needed for testing.
143 static ExtensionPrefs* Create( 142 static ExtensionPrefs* Create(
144 PrefService* prefs, 143 PrefService* prefs,
145 const base::FilePath& root_dir, 144 const base::FilePath& root_dir,
146 ExtensionPrefValueMap* extension_pref_value_map, 145 ExtensionPrefValueMap* extension_pref_value_map,
147 scoped_ptr<AppSorting> app_sorting,
148 bool extensions_disabled, 146 bool extensions_disabled,
149 const std::vector<ExtensionPrefsObserver*>& early_observers, 147 const std::vector<ExtensionPrefsObserver*>& early_observers,
150 scoped_ptr<TimeProvider> time_provider); 148 scoped_ptr<TimeProvider> time_provider);
151 149
152 ~ExtensionPrefs() override; 150 ~ExtensionPrefs() override;
153 151
154 // Convenience function to get the ExtensionPrefs for a BrowserContext. 152 // Convenience function to get the ExtensionPrefs for a BrowserContext.
155 static ExtensionPrefs* Get(content::BrowserContext* context); 153 static ExtensionPrefs* Get(content::BrowserContext* context);
156 154
157 // Returns all installed extensions from extension preferences provided by 155 // Returns all installed extensions from extension preferences provided by
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 void ClearLastLaunchTimes(); 492 void ClearLastLaunchTimes();
495 493
496 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 494 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
497 495
498 bool extensions_disabled() const { return extensions_disabled_; } 496 bool extensions_disabled() const { return extensions_disabled_; }
499 497
500 // The underlying PrefService. 498 // The underlying PrefService.
501 PrefService* pref_service() const { return prefs_; } 499 PrefService* pref_service() const { return prefs_; }
502 500
503 // The underlying AppSorting. 501 // The underlying AppSorting.
504 AppSorting* app_sorting() const { return app_sorting_.get(); } 502 void set_app_sorting(AppSorting* app_sorting) { app_sorting_ = app_sorting; }
503 AppSorting* app_sorting() const { return app_sorting_; }
Marc Treib 2015/07/29 09:53:32 This accessor should be removed, and all callers c
not at google - send to devlin 2015/07/29 18:22:03 SGTM.
505 504
506 // Schedules garbage collection of an extension's on-disk data on the next 505 // Schedules garbage collection of an extension's on-disk data on the next
507 // start of this ExtensionService. Applies only to extensions with isolated 506 // start of this ExtensionService. Applies only to extensions with isolated
508 // storage. 507 // storage.
509 void SetNeedsStorageGarbageCollection(bool value); 508 void SetNeedsStorageGarbageCollection(bool value);
510 bool NeedsStorageGarbageCollection() const; 509 bool NeedsStorageGarbageCollection() const;
511 510
512 // Used by AppWindowGeometryCache to persist its cache. These methods 511 // Used by AppWindowGeometryCache to persist its cache. These methods
513 // should not be called directly. 512 // should not be called directly.
514 const base::DictionaryValue* GetGeometryCache( 513 const base::DictionaryValue* GetGeometryCache(
(...skipping 30 matching lines...) Expand all
545 enum DisableReasonChange { 544 enum DisableReasonChange {
546 DISABLE_REASON_ADD, 545 DISABLE_REASON_ADD,
547 DISABLE_REASON_REMOVE, 546 DISABLE_REASON_REMOVE,
548 DISABLE_REASON_CLEAR 547 DISABLE_REASON_CLEAR
549 }; 548 };
550 549
551 // See the Create methods. 550 // See the Create methods.
552 ExtensionPrefs(PrefService* prefs, 551 ExtensionPrefs(PrefService* prefs,
553 const base::FilePath& root_dir, 552 const base::FilePath& root_dir,
554 ExtensionPrefValueMap* extension_pref_value_map, 553 ExtensionPrefValueMap* extension_pref_value_map,
555 scoped_ptr<AppSorting> app_sorting,
556 scoped_ptr<TimeProvider> time_provider, 554 scoped_ptr<TimeProvider> time_provider,
557 bool extensions_disabled, 555 bool extensions_disabled,
558 const std::vector<ExtensionPrefsObserver*>& early_observers); 556 const std::vector<ExtensionPrefsObserver*>& early_observers);
559 557
560 // Converts absolute paths in the pref to paths relative to the 558 // Converts absolute paths in the pref to paths relative to the
561 // install_directory_. 559 // install_directory_.
562 void MakePathsRelative(); 560 void MakePathsRelative();
563 561
564 // Converts internal relative paths to be absolute. Used for export to 562 // Converts internal relative paths to be absolute. Used for export to
565 // consumers who expect full paths. 563 // consumers who expect full paths.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 PrefService* prefs_; 673 PrefService* prefs_;
676 674
677 // Base extensions install directory. 675 // Base extensions install directory.
678 base::FilePath install_directory_; 676 base::FilePath install_directory_;
679 677
680 // Weak pointer, owned by BrowserContext. 678 // Weak pointer, owned by BrowserContext.
681 ExtensionPrefValueMap* extension_pref_value_map_; 679 ExtensionPrefValueMap* extension_pref_value_map_;
682 680
683 // Contains all the logic for handling the order for various extension 681 // Contains all the logic for handling the order for various extension
684 // properties. 682 // properties.
685 scoped_ptr<AppSorting> app_sorting_; 683 AppSorting* app_sorting_;
686 684
687 scoped_ptr<TimeProvider> time_provider_; 685 scoped_ptr<TimeProvider> time_provider_;
688 686
689 bool extensions_disabled_; 687 bool extensions_disabled_;
690 688
691 base::ObserverList<ExtensionPrefsObserver> observer_list_; 689 base::ObserverList<ExtensionPrefsObserver> observer_list_;
692 690
693 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); 691 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs);
694 }; 692 };
695 693
696 } // namespace extensions 694 } // namespace extensions
697 695
698 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ 696 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698