OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/extension_pref_store.h" | 10 #include "chrome/browser/extensions/extension_pref_store.h" |
11 #include "chrome/browser/prefs/pref_notifier.h" | 11 #include "chrome/browser/prefs/pref_notifier.h" |
12 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 12 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 13 #include "chrome/common/chrome_notification_types.h" |
13 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
14 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
15 #include "chrome/common/extensions/url_pattern.h" | 16 #include "chrome/common/extensions/url_pattern.h" |
16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
17 #include "content/common/notification_service.h" | 18 #include "content/common/notification_service.h" |
18 | 19 |
19 using base::Time; | 20 using base::Time; |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 } | 1036 } |
1036 | 1037 |
1037 void ExtensionPrefs::SetBrowserActionVisibility(const Extension* extension, | 1038 void ExtensionPrefs::SetBrowserActionVisibility(const Extension* extension, |
1038 bool visible) { | 1039 bool visible) { |
1039 if (GetBrowserActionVisibility(extension) == visible) | 1040 if (GetBrowserActionVisibility(extension) == visible) |
1040 return; | 1041 return; |
1041 | 1042 |
1042 UpdateExtensionPref(extension->id(), kBrowserActionVisible, | 1043 UpdateExtensionPref(extension->id(), kBrowserActionVisible, |
1043 Value::CreateBooleanValue(visible)); | 1044 Value::CreateBooleanValue(visible)); |
1044 NotificationService::current()->Notify( | 1045 NotificationService::current()->Notify( |
1045 NotificationType::EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, | 1046 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, |
1046 Source<ExtensionPrefs>(this), | 1047 Source<ExtensionPrefs>(this), |
1047 Details<const Extension>(extension)); | 1048 Details<const Extension>(extension)); |
1048 } | 1049 } |
1049 | 1050 |
1050 std::string ExtensionPrefs::GetVersionString(const std::string& extension_id) { | 1051 std::string ExtensionPrefs::GetVersionString(const std::string& extension_id) { |
1051 const DictionaryValue* extension = GetExtensionPref(extension_id); | 1052 const DictionaryValue* extension = GetExtensionPref(extension_id); |
1052 if (!extension) | 1053 if (!extension) |
1053 return std::string(); | 1054 return std::string(); |
1054 | 1055 |
1055 std::string version; | 1056 std::string version; |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 } | 1348 } |
1348 return max_value + 1; | 1349 return max_value + 1; |
1349 } | 1350 } |
1350 | 1351 |
1351 void ExtensionPrefs::SetAppLauncherOrder( | 1352 void ExtensionPrefs::SetAppLauncherOrder( |
1352 const std::vector<std::string>& extension_ids) { | 1353 const std::vector<std::string>& extension_ids) { |
1353 for (size_t i = 0; i < extension_ids.size(); ++i) | 1354 for (size_t i = 0; i < extension_ids.size(); ++i) |
1354 SetAppLaunchIndex(extension_ids.at(i), i); | 1355 SetAppLaunchIndex(extension_ids.at(i), i); |
1355 | 1356 |
1356 NotificationService::current()->Notify( | 1357 NotificationService::current()->Notify( |
1357 NotificationType::EXTENSION_LAUNCHER_REORDERED, | 1358 chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, |
1358 Source<ExtensionPrefs>(this), | 1359 Source<ExtensionPrefs>(this), |
1359 NotificationService::NoDetails()); | 1360 NotificationService::NoDetails()); |
1360 } | 1361 } |
1361 | 1362 |
1362 int ExtensionPrefs::GetPageIndex(const std::string& extension_id) { | 1363 int ExtensionPrefs::GetPageIndex(const std::string& extension_id) { |
1363 int value = -1; | 1364 int value = -1; |
1364 ReadExtensionPrefInteger(extension_id, kPrefPageIndex, &value); | 1365 ReadExtensionPrefInteger(extension_id, kPrefPageIndex, &value); |
1365 return value; | 1366 return value; |
1366 } | 1367 } |
1367 | 1368 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1660 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, | 1661 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, |
1661 PrefService::UNSYNCABLE_PREF); | 1662 PrefService::UNSYNCABLE_PREF); |
1662 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, | 1663 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, |
1663 PrefService::UNSYNCABLE_PREF); | 1664 PrefService::UNSYNCABLE_PREF); |
1664 prefs->RegisterListPref(prefs::kExtensionInstallForceList, | 1665 prefs->RegisterListPref(prefs::kExtensionInstallForceList, |
1665 PrefService::UNSYNCABLE_PREF); | 1666 PrefService::UNSYNCABLE_PREF); |
1666 prefs->RegisterStringPref(kWebStoreLogin, | 1667 prefs->RegisterStringPref(kWebStoreLogin, |
1667 std::string() /* default_value */, | 1668 std::string() /* default_value */, |
1668 PrefService::UNSYNCABLE_PREF); | 1669 PrefService::UNSYNCABLE_PREF); |
1669 } | 1670 } |
OLD | NEW |