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

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

Issue 1419823011: app_sorting() calls should go via ExtensionSystem intsead of prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing nits. Created 5 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
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 #include "extensions/browser/extension_prefs.h" 5 #include "extensions/browser/extension_prefs.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 return child.value(); 370 return child.value();
371 371
372 base::FilePath::StringType retval = child.value().substr( 372 base::FilePath::StringType retval = child.value().substr(
373 parent.value().length()); 373 parent.value().length());
374 if (base::FilePath::IsSeparator(retval[0])) 374 if (base::FilePath::IsSeparator(retval[0]))
375 return retval.substr(1); 375 return retval.substr(1);
376 else 376 else
377 return retval; 377 return retval;
378 } 378 }
379 379
380 AppSorting* ExtensionPrefs::app_sorting() const {
Dan Beam 2015/11/12 22:37:21 this should be positioned under ExtensionsPrefs co
benwells 2015/11/12 23:33:48 Unfortunately the file appears to be generally out
Dan Beam 2015/11/17 00:28:48 then revert moving it to begin with
Deepak 2015/11/17 05:00:45 Done.
381 return ExtensionSystem::Get(browser_context_)->app_sorting();
382 }
383
380 void ExtensionPrefs::MakePathsRelative() { 384 void ExtensionPrefs::MakePathsRelative() {
381 const base::DictionaryValue* dict = 385 const base::DictionaryValue* dict =
382 prefs_->GetDictionary(pref_names::kExtensions); 386 prefs_->GetDictionary(pref_names::kExtensions);
383 if (!dict || dict->empty()) 387 if (!dict || dict->empty())
384 return; 388 return;
385 389
386 // Collect all extensions ids with absolute paths in |absolute_keys|. 390 // Collect all extensions ids with absolute paths in |absolute_keys|.
387 std::set<std::string> absolute_keys; 391 std::set<std::string> absolute_keys;
388 for (base::DictionaryValue::Iterator i(*dict); !i.IsAtEnd(); i.Advance()) { 392 for (base::DictionaryValue::Iterator i(*dict); !i.IsAtEnd(); i.Advance()) {
389 const base::DictionaryValue* extension_dict = NULL; 393 const base::DictionaryValue* extension_dict = NULL;
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 for (std::vector<ExtensionPrefsObserver*>::const_iterator iter = 1875 for (std::vector<ExtensionPrefsObserver*>::const_iterator iter =
1872 early_observers.begin(); 1876 early_observers.begin();
1873 iter != early_observers.end(); 1877 iter != early_observers.end();
1874 ++iter) { 1878 ++iter) {
1875 AddObserver(*iter); 1879 AddObserver(*iter);
1876 } 1880 }
1877 1881
1878 InitPrefStore(); 1882 InitPrefStore();
1879 } 1883 }
1880 1884
1881 AppSorting* ExtensionPrefs::app_sorting() const {
1882 return ExtensionSystem::Get(browser_context_)->app_sorting();
1883 }
1884
1885 void ExtensionPrefs::SetNeedsStorageGarbageCollection(bool value) { 1885 void ExtensionPrefs::SetNeedsStorageGarbageCollection(bool value) {
1886 prefs_->SetBoolean(pref_names::kStorageGarbageCollect, value); 1886 prefs_->SetBoolean(pref_names::kStorageGarbageCollect, value);
1887 } 1887 }
1888 1888
1889 bool ExtensionPrefs::NeedsStorageGarbageCollection() const { 1889 bool ExtensionPrefs::NeedsStorageGarbageCollection() const {
1890 return prefs_->GetBoolean(pref_names::kStorageGarbageCollect); 1890 return prefs_->GetBoolean(pref_names::kStorageGarbageCollect);
1891 } 1891 }
1892 1892
1893 // static 1893 // static
1894 void ExtensionPrefs::RegisterProfilePrefs( 1894 void ExtensionPrefs::RegisterProfilePrefs(
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2107 extension_pref_value_map_->RegisterExtension( 2107 extension_pref_value_map_->RegisterExtension(
2108 extension_id, install_time, is_enabled, is_incognito_enabled); 2108 extension_id, install_time, is_enabled, is_incognito_enabled);
2109 2109
2110 FOR_EACH_OBSERVER( 2110 FOR_EACH_OBSERVER(
2111 ExtensionPrefsObserver, 2111 ExtensionPrefsObserver,
2112 observer_list_, 2112 observer_list_,
2113 OnExtensionRegistered(extension_id, install_time, is_enabled)); 2113 OnExtensionRegistered(extension_id, install_time, is_enabled));
2114 } 2114 }
2115 2115
2116 } // namespace extensions 2116 } // namespace extensions
OLDNEW
« extensions/browser/extension_prefs.h ('K') | « extensions/browser/extension_prefs.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698