Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 #include "extensions/common/permissions/api_permission.h" | 92 #include "extensions/common/permissions/api_permission.h" |
| 93 #include "extensions/common/permissions/permission_message_provider.h" | 93 #include "extensions/common/permissions/permission_message_provider.h" |
| 94 #include "extensions/common/permissions/permissions_data.h" | 94 #include "extensions/common/permissions/permissions_data.h" |
| 95 | 95 |
| 96 #if defined(ENABLE_SUPERVISED_USERS) | 96 #if defined(ENABLE_SUPERVISED_USERS) |
| 97 #include "chrome/browser/supervised_user/supervised_user_service.h" | 97 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 98 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 98 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 99 #endif | 99 #endif |
| 100 | 100 |
| 101 #if defined(OS_CHROMEOS) | 101 #if defined(OS_CHROMEOS) |
| 102 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | |
| 102 #include "chrome/browser/chromeos/extensions/install_limiter.h" | 103 #include "chrome/browser/chromeos/extensions/install_limiter.h" |
| 103 #include "storage/browser/fileapi/file_system_backend.h" | 104 #include "storage/browser/fileapi/file_system_backend.h" |
| 104 #include "storage/browser/fileapi/file_system_context.h" | 105 #include "storage/browser/fileapi/file_system_context.h" |
| 105 #endif | 106 #endif |
| 106 | 107 |
| 107 using content::BrowserContext; | 108 using content::BrowserContext; |
| 108 using content::BrowserThread; | 109 using content::BrowserThread; |
| 109 using content::DevToolsAgentHost; | 110 using content::DevToolsAgentHost; |
| 110 using extensions::APIPermission; | 111 using extensions::APIPermission; |
| 111 using extensions::AppSorting; | 112 using extensions::AppSorting; |
| (...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1805 if (status == SharedModuleService::IMPORT_STATUS_UNSATISFIED) { | 1806 if (status == SharedModuleService::IMPORT_STATUS_UNSATISFIED) { |
| 1806 extension_prefs_->SetDelayedInstallInfo( | 1807 extension_prefs_->SetDelayedInstallInfo( |
| 1807 extension, | 1808 extension, |
| 1808 initial_state, | 1809 initial_state, |
| 1809 install_flags, | 1810 install_flags, |
| 1810 extensions::ExtensionPrefs::DELAY_REASON_WAIT_FOR_IMPORTS, | 1811 extensions::ExtensionPrefs::DELAY_REASON_WAIT_FOR_IMPORTS, |
| 1811 page_ordinal, | 1812 page_ordinal, |
| 1812 install_parameter); | 1813 install_parameter); |
| 1813 delayed_installs_.Insert(extension); | 1814 delayed_installs_.Insert(extension); |
| 1814 } | 1815 } |
| 1816 #if defined(OS_CHROMEOS) | |
| 1817 } else if (!chromeos::KioskAppManager::Get()->IsPlatformCompliantWithApp( | |
| 1818 extension) && | |
| 1819 !!GetInstalledExtension(extension->id())) { | |
| 1820 // Delay updating of an existing extension when required platform version | |
| 1821 // of the new extension is not compliant. | |
| 1822 extension_prefs_->SetDelayedInstallInfo( | |
| 1823 extension, | |
| 1824 initial_state, | |
| 1825 install_flags, | |
| 1826 extensions::ExtensionPrefs::DELAY_REASON_WAIT_FOR_OS_UPDATE, | |
| 1827 page_ordinal, | |
| 1828 install_parameter); | |
| 1829 delayed_installs_.Insert(extension); | |
| 1830 | |
| 1831 // Updates the required platform version meta data to allow update engine | |
| 1832 // to move on to the new OS version. | |
| 1833 chromeos::KioskAppManager::Get()->UpdateAppDataFromProfile( | |
| 1834 extension->id(), profile(), extension); | |
| 1835 #endif | |
|
asargent_no_longer_on_chrome
2016/04/06 19:32:23
This function is already getting kind of long and
xiyuan
2016/04/19 18:38:54
Done.
| |
| 1815 } else { | 1836 } else { |
| 1816 AddNewOrUpdatedExtension(extension, | 1837 AddNewOrUpdatedExtension(extension, |
| 1817 initial_state, | 1838 initial_state, |
| 1818 install_flags, | 1839 install_flags, |
| 1819 page_ordinal, | 1840 page_ordinal, |
| 1820 install_parameter); | 1841 install_parameter); |
| 1821 } | 1842 } |
| 1822 } | 1843 } |
| 1823 | 1844 |
| 1824 void ExtensionService::OnExtensionManagementSettingsChanged() { | 1845 void ExtensionService::OnExtensionManagementSettingsChanged() { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1891 delayed_installs_.Remove(extension_id); | 1912 delayed_installs_.Remove(extension_id); |
| 1892 // Make sure no version of the extension is actually installed, (i.e., | 1913 // Make sure no version of the extension is actually installed, (i.e., |
| 1893 // that this delayed install was not an update). | 1914 // that this delayed install was not an update). |
| 1894 CHECK(!extension_prefs_->GetInstalledExtensionInfo(extension_id).get()); | 1915 CHECK(!extension_prefs_->GetInstalledExtensionInfo(extension_id).get()); |
| 1895 extension_prefs_->DeleteExtensionPrefs(extension_id); | 1916 extension_prefs_->DeleteExtensionPrefs(extension_id); |
| 1896 } | 1917 } |
| 1897 return; | 1918 return; |
| 1898 } | 1919 } |
| 1899 } | 1920 } |
| 1900 | 1921 |
| 1922 #if defined(OS_CHROMEOS) | |
| 1923 if (reason == extensions::ExtensionPrefs::DELAY_REASON_WAIT_FOR_OS_UPDATE && | |
| 1924 !chromeos::KioskAppManager::Get()->IsPlatformCompliantWithApp( | |
| 1925 extension)) { | |
| 1926 return; | |
| 1927 } | |
| 1928 #endif | |
| 1929 | |
| 1901 FinishDelayedInstallation(extension_id); | 1930 FinishDelayedInstallation(extension_id); |
| 1902 } | 1931 } |
| 1903 | 1932 |
| 1904 void ExtensionService::FinishDelayedInstallation( | 1933 void ExtensionService::FinishDelayedInstallation( |
| 1905 const std::string& extension_id) { | 1934 const std::string& extension_id) { |
| 1906 scoped_refptr<const Extension> extension( | 1935 scoped_refptr<const Extension> extension( |
| 1907 GetPendingExtensionUpdate(extension_id)); | 1936 GetPendingExtensionUpdate(extension_id)); |
| 1908 CHECK(extension.get()); | 1937 CHECK(extension.get()); |
| 1909 delayed_installs_.Remove(extension_id); | 1938 delayed_installs_.Remove(extension_id); |
| 1910 | 1939 |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2451 } | 2480 } |
| 2452 | 2481 |
| 2453 void ExtensionService::OnProfileDestructionStarted() { | 2482 void ExtensionService::OnProfileDestructionStarted() { |
| 2454 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2483 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
| 2455 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2484 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
| 2456 it != ids_to_unload.end(); | 2485 it != ids_to_unload.end(); |
| 2457 ++it) { | 2486 ++it) { |
| 2458 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2487 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
| 2459 } | 2488 } |
| 2460 } | 2489 } |
| OLD | NEW |