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

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

Issue 14858037: Move [Get|Set]WebStoreLogin methods from ExtensionPrefs to WebstorePrivateAPI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/extensions/extension_prefs.h" 5 #include "chrome/browser/extensions/extension_prefs.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_notifier.h" 8 #include "base/prefs/pref_notifier.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 const char kPrefIncognitoEnabled[] = "incognito"; 118 const char kPrefIncognitoEnabled[] = "incognito";
119 119
120 // A preference to control whether an extension is allowed to inject script in 120 // A preference to control whether an extension is allowed to inject script in
121 // pages with file URLs. 121 // pages with file URLs.
122 const char kPrefAllowFileAccess[] = "newAllowFileAccess"; 122 const char kPrefAllowFileAccess[] = "newAllowFileAccess";
123 // TODO(jstritar): As part of fixing http://crbug.com/91577, we revoked all 123 // TODO(jstritar): As part of fixing http://crbug.com/91577, we revoked all
124 // extension file access by renaming the pref. We should eventually clean up 124 // extension file access by renaming the pref. We should eventually clean up
125 // the old flag and possibly go back to that name. 125 // the old flag and possibly go back to that name.
126 // const char kPrefAllowFileAccessOld[] = "allowFileAccess"; 126 // const char kPrefAllowFileAccessOld[] = "allowFileAccess";
127 127
128 // A preference set by the web store to indicate login information for
129 // purchased apps.
130 const char kWebStoreLogin[] = "extensions.webstore_login";
131
132 // A preference set by the the NTP to persist the desired launch container type 128 // A preference set by the the NTP to persist the desired launch container type
133 // used for apps. 129 // used for apps.
134 const char kPrefLaunchType[] = "launchType"; 130 const char kPrefLaunchType[] = "launchType";
135 131
136 // A preference specifying if the user dragged the app on the NTP. 132 // A preference specifying if the user dragged the app on the NTP.
137 const char kPrefUserDraggedApp[] = "user_dragged_app_ntp"; 133 const char kPrefUserDraggedApp[] = "user_dragged_app_ntp";
138 134
139 // A preference for storing extra data sent in update checks for an extension. 135 // A preference for storing extra data sent in update checks for an extension.
140 const char kUpdateUrlData[] = "update_url_data"; 136 const char kUpdateUrlData[] = "update_url_data";
141 137
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 continue; 1558 continue;
1563 1559
1564 scoped_ptr<ExtensionInfo> info = GetDelayedInstallInfo(extension_id.key()); 1560 scoped_ptr<ExtensionInfo> info = GetDelayedInstallInfo(extension_id.key());
1565 if (info) 1561 if (info)
1566 extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release())); 1562 extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release()));
1567 } 1563 }
1568 1564
1569 return extensions_info.Pass(); 1565 return extensions_info.Pass();
1570 } 1566 }
1571 1567
1572 bool ExtensionPrefs::GetWebStoreLogin(std::string* result) {
1573 if (prefs_->HasPrefPath(kWebStoreLogin)) {
1574 *result = prefs_->GetString(kWebStoreLogin);
1575 return true;
1576 }
1577 return false;
1578 }
1579
1580 void ExtensionPrefs::SetWebStoreLogin(const std::string& login) {
1581 prefs_->SetString(kWebStoreLogin, login);
1582 }
1583
1584 bool ExtensionPrefs::WasAppDraggedByUser(const std::string& extension_id) { 1568 bool ExtensionPrefs::WasAppDraggedByUser(const std::string& extension_id) {
1585 return ReadPrefAsBooleanAndReturn(extension_id, kPrefUserDraggedApp); 1569 return ReadPrefAsBooleanAndReturn(extension_id, kPrefUserDraggedApp);
1586 } 1570 }
1587 1571
1588 void ExtensionPrefs::SetAppDraggedByUser(const std::string& extension_id) { 1572 void ExtensionPrefs::SetAppDraggedByUser(const std::string& extension_id) {
1589 UpdateExtensionPref(extension_id, kPrefUserDraggedApp, 1573 UpdateExtensionPref(extension_id, kPrefUserDraggedApp,
1590 Value::CreateBooleanValue(true)); 1574 Value::CreateBooleanValue(true));
1591 } 1575 }
1592 1576
1593 void ExtensionPrefs::SetUpdateUrlData(const std::string& extension_id, 1577 void ExtensionPrefs::SetUpdateUrlData(const std::string& extension_id,
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 registry->RegisterListPref(prefs::kExtensionInstallAllowList, 2004 registry->RegisterListPref(prefs::kExtensionInstallAllowList,
2021 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 2005 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
2022 registry->RegisterListPref(prefs::kExtensionInstallDenyList, 2006 registry->RegisterListPref(prefs::kExtensionInstallDenyList,
2023 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 2007 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
2024 registry->RegisterDictionaryPref( 2008 registry->RegisterDictionaryPref(
2025 prefs::kExtensionInstallForceList, 2009 prefs::kExtensionInstallForceList,
2026 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 2010 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
2027 registry->RegisterListPref(prefs::kExtensionAllowedTypes, 2011 registry->RegisterListPref(prefs::kExtensionAllowedTypes,
2028 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 2012 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
2029 registry->RegisterStringPref( 2013 registry->RegisterStringPref(
2030 kWebStoreLogin,
2031 std::string(), // default value
2032 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
2033 registry->RegisterStringPref(
2034 prefs::kExtensionBlacklistUpdateVersion, 2014 prefs::kExtensionBlacklistUpdateVersion,
2035 "0", // default value 2015 "0", // default value
2036 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 2016 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
2037 registry->RegisterBooleanPref( 2017 registry->RegisterBooleanPref(
2038 prefs::kExtensionStorageGarbageCollect, 2018 prefs::kExtensionStorageGarbageCollect,
2039 false, // default value 2019 false, // default value
2040 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 2020 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
2041 registry->RegisterInt64Pref( 2021 registry->RegisterInt64Pref(
2042 prefs::kLastExtensionsUpdateCheck, 2022 prefs::kLastExtensionsUpdateCheck,
2043 0, // default value 2023 0, // default value
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2160 is_enabled = initial_state == Extension::ENABLED; 2140 is_enabled = initial_state == Extension::ENABLED;
2161 } 2141 }
2162 2142
2163 extension_pref_value_map_->RegisterExtension(extension_id, install_time, 2143 extension_pref_value_map_->RegisterExtension(extension_id, install_time,
2164 is_enabled); 2144 is_enabled);
2165 content_settings_store_->RegisterExtension(extension_id, install_time, 2145 content_settings_store_->RegisterExtension(extension_id, install_time,
2166 is_enabled); 2146 is_enabled);
2167 } 2147 }
2168 2148
2169 } // namespace extensions 2149 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698