OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 bool previously_disabled = | 1878 bool previously_disabled = |
1879 extension_prefs_->IsExtensionDisabled(extension->id()); | 1879 extension_prefs_->IsExtensionDisabled(extension->id()); |
1880 // Legacy disabled extensions do not have a disable reason. Infer that if | 1880 // Legacy disabled extensions do not have a disable reason. Infer that if |
1881 // there was no permission increase, it was likely disabled by the user. | 1881 // there was no permission increase, it was likely disabled by the user. |
1882 if (previously_disabled && disable_reasons == Extension::DISABLE_NONE && | 1882 if (previously_disabled && disable_reasons == Extension::DISABLE_NONE && |
1883 !extension_prefs_->DidExtensionEscalatePermissions(extension->id())) { | 1883 !extension_prefs_->DidExtensionEscalatePermissions(extension->id())) { |
1884 disable_reasons |= Extension::DISABLE_USER_ACTION; | 1884 disable_reasons |= Extension::DISABLE_USER_ACTION; |
1885 } | 1885 } |
1886 // Extensions that came to us disabled from sync need a similar inference, | 1886 // Extensions that came to us disabled from sync need a similar inference, |
1887 // except based on the new version's permissions. | 1887 // except based on the new version's permissions. |
1888 // TODO(yoz): Since we no longer sync disabled state, simplify this. | |
1889 if (previously_disabled && | 1888 if (previously_disabled && |
1890 disable_reasons == Extension::DISABLE_UNKNOWN_FROM_SYNC) { | 1889 disable_reasons == Extension::DISABLE_UNKNOWN_FROM_SYNC) { |
1891 // Remove the DISABLE_UNKNOWN_FROM_SYNC reason. | 1890 // Remove the DISABLE_UNKNOWN_FROM_SYNC reason. |
1892 extension_prefs_->ClearDisableReasons(extension->id()); | 1891 extension_prefs_->ClearDisableReasons(extension->id()); |
1893 if (!is_privilege_increase) | 1892 if (!is_privilege_increase) |
1894 disable_reasons |= Extension::DISABLE_USER_ACTION; | 1893 disable_reasons |= Extension::DISABLE_USER_ACTION; |
1895 } | 1894 } |
1896 disable_reasons &= ~Extension::DISABLE_UNKNOWN_FROM_SYNC; | 1895 disable_reasons &= ~Extension::DISABLE_UNKNOWN_FROM_SYNC; |
1897 } | 1896 } |
1898 | 1897 |
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2785 } | 2784 } |
2786 | 2785 |
2787 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 2786 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
2788 update_observers_.AddObserver(observer); | 2787 update_observers_.AddObserver(observer); |
2789 } | 2788 } |
2790 | 2789 |
2791 void ExtensionService::RemoveUpdateObserver( | 2790 void ExtensionService::RemoveUpdateObserver( |
2792 extensions::UpdateObserver* observer) { | 2791 extensions::UpdateObserver* observer) { |
2793 update_observers_.RemoveObserver(observer); | 2792 update_observers_.RemoveObserver(observer); |
2794 } | 2793 } |
OLD | NEW |