| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 if (!extension_dict->HasKey(pref_names::kPrefIncognitoContentSettings)) { | 1919 if (!extension_dict->HasKey(pref_names::kPrefIncognitoContentSettings)) { |
| 1920 extension_dict->Set(pref_names::kPrefIncognitoContentSettings, | 1920 extension_dict->Set(pref_names::kPrefIncognitoContentSettings, |
| 1921 base::MakeUnique<base::ListValue>()); | 1921 base::MakeUnique<base::ListValue>()); |
| 1922 } | 1922 } |
| 1923 | 1923 |
| 1924 // If this point has been reached, any pending installs should be considered | 1924 // If this point has been reached, any pending installs should be considered |
| 1925 // out of date. | 1925 // out of date. |
| 1926 extension_dict->Remove(kDelayedInstallInfo, NULL); | 1926 extension_dict->Remove(kDelayedInstallInfo, NULL); |
| 1927 | 1927 |
| 1928 // Clear state that may be registered from a previous install. | 1928 // Clear state that may be registered from a previous install. |
| 1929 extension_dict->Remove(EventRouter::kRegisteredEvents, NULL); | 1929 extension_dict->Remove(EventRouter::kRegisteredLazyEvents, nullptr); |
| 1930 extension_dict->Remove(EventRouter::kRegisteredServiceWorkerEvents, nullptr); |
| 1930 | 1931 |
| 1931 // FYI, all code below here races on sudden shutdown because |extension_dict|, | 1932 // FYI, all code below here races on sudden shutdown because |extension_dict|, |
| 1932 // |app_sorting|, |extension_pref_value_map_|, and (potentially) observers | 1933 // |app_sorting|, |extension_pref_value_map_|, and (potentially) observers |
| 1933 // are updated non-transactionally. This is probably not fixable without | 1934 // are updated non-transactionally. This is probably not fixable without |
| 1934 // nested transactional updates to pref dictionaries. | 1935 // nested transactional updates to pref dictionaries. |
| 1935 if (needs_sort_ordinal) | 1936 if (needs_sort_ordinal) |
| 1936 app_sorting()->EnsureValidOrdinals(extension_id, suggested_page_ordinal); | 1937 app_sorting()->EnsureValidOrdinals(extension_id, suggested_page_ordinal); |
| 1937 | 1938 |
| 1938 bool is_enabled = false; | 1939 bool is_enabled = false; |
| 1939 int initial_state; | 1940 int initial_state; |
| 1940 if (extension_dict->GetInteger(kPrefState, &initial_state)) { | 1941 if (extension_dict->GetInteger(kPrefState, &initial_state)) { |
| 1941 is_enabled = initial_state == Extension::ENABLED; | 1942 is_enabled = initial_state == Extension::ENABLED; |
| 1942 } | 1943 } |
| 1943 bool is_incognito_enabled = IsIncognitoEnabled(extension_id); | 1944 bool is_incognito_enabled = IsIncognitoEnabled(extension_id); |
| 1944 | 1945 |
| 1945 extension_pref_value_map_->RegisterExtension( | 1946 extension_pref_value_map_->RegisterExtension( |
| 1946 extension_id, install_time, is_enabled, is_incognito_enabled); | 1947 extension_id, install_time, is_enabled, is_incognito_enabled); |
| 1947 | 1948 |
| 1948 for (auto& observer : observer_list_) | 1949 for (auto& observer : observer_list_) |
| 1949 observer.OnExtensionRegistered(extension_id, install_time, is_enabled); | 1950 observer.OnExtensionRegistered(extension_id, install_time, is_enabled); |
| 1950 } | 1951 } |
| 1951 | 1952 |
| 1952 } // namespace extensions | 1953 } // namespace extensions |
| OLD | NEW |