OLD | NEW |
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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/prefs/pref_notifier.h" | 10 #include "base/prefs/pref_notifier.h" |
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1685 } | 1685 } |
1686 | 1686 |
1687 bool ExtensionPrefs::DoNotSync(const std::string& extension_id) const { | 1687 bool ExtensionPrefs::DoNotSync(const std::string& extension_id) const { |
1688 bool do_not_sync; | 1688 bool do_not_sync; |
1689 if (!ReadPrefAsBoolean(extension_id, kPrefDoNotSync, &do_not_sync)) | 1689 if (!ReadPrefAsBoolean(extension_id, kPrefDoNotSync, &do_not_sync)) |
1690 return false; | 1690 return false; |
1691 | 1691 |
1692 return do_not_sync; | 1692 return do_not_sync; |
1693 } | 1693 } |
1694 | 1694 |
| 1695 int ExtensionPrefs::GetInstallFlags(const std::string& extension_id) const { |
| 1696 // TODO(kalman,treib): This is hacky. We should probably just store the |
| 1697 // mask of install flags as an int, instead of separate bools for each. |
| 1698 int flags = 0; |
| 1699 if (IsExtensionBlacklisted(extension_id)) |
| 1700 flags |= kInstallFlagIsBlacklistedForMalware; |
| 1701 if (IsEphemeralApp(extension_id)) |
| 1702 flags |= kInstallFlagIsEphemeral; |
| 1703 if (DoNotSync(extension_id)) |
| 1704 flags |= kInstallFlagDoNotSync; |
| 1705 return flags; |
| 1706 } |
| 1707 |
1695 base::Time ExtensionPrefs::GetLastLaunchTime( | 1708 base::Time ExtensionPrefs::GetLastLaunchTime( |
1696 const std::string& extension_id) const { | 1709 const std::string& extension_id) const { |
1697 const base::DictionaryValue* extension = GetExtensionPref(extension_id); | 1710 const base::DictionaryValue* extension = GetExtensionPref(extension_id); |
1698 if (!extension) | 1711 if (!extension) |
1699 return base::Time(); | 1712 return base::Time(); |
1700 | 1713 |
1701 std::string launch_time_str; | 1714 std::string launch_time_str; |
1702 if (!extension->GetString(kPrefLastLaunchTime, &launch_time_str)) | 1715 if (!extension->GetString(kPrefLastLaunchTime, &launch_time_str)) |
1703 return base::Time(); | 1716 return base::Time(); |
1704 int64 launch_time_i64 = 0; | 1717 int64 launch_time_i64 = 0; |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2185 extension_pref_value_map_->RegisterExtension( | 2198 extension_pref_value_map_->RegisterExtension( |
2186 extension_id, install_time, is_enabled, is_incognito_enabled); | 2199 extension_id, install_time, is_enabled, is_incognito_enabled); |
2187 | 2200 |
2188 FOR_EACH_OBSERVER( | 2201 FOR_EACH_OBSERVER( |
2189 ExtensionPrefsObserver, | 2202 ExtensionPrefsObserver, |
2190 observer_list_, | 2203 observer_list_, |
2191 OnExtensionRegistered(extension_id, install_time, is_enabled)); | 2204 OnExtensionRegistered(extension_id, install_time, is_enabled)); |
2192 } | 2205 } |
2193 | 2206 |
2194 } // namespace extensions | 2207 } // namespace extensions |
OLD | NEW |