| 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 "chrome/browser/extensions/extension_system_impl.h" | 5 #include "chrome/browser/extensions/extension_system_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 #if defined(ENABLE_NOTIFICATIONS) | 59 #if defined(ENABLE_NOTIFICATIONS) |
| 60 #include "chrome/browser/notifications/notifier_state_tracker.h" | 60 #include "chrome/browser/notifications/notifier_state_tracker.h" |
| 61 #include "chrome/browser/notifications/notifier_state_tracker_factory.h" | 61 #include "chrome/browser/notifications/notifier_state_tracker_factory.h" |
| 62 #include "ui/message_center/notifier_settings.h" | 62 #include "ui/message_center/notifier_settings.h" |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 #if defined(OS_CHROMEOS) | 65 #if defined(OS_CHROMEOS) |
| 66 #include "chrome/browser/app_mode/app_mode_utils.h" | 66 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 67 #include "chrome/browser/chromeos/app_mode/kiosk_app_update_install_gate.h" | 67 #include "chrome/browser/chromeos/app_mode/kiosk_app_update_install_gate.h" |
| 68 #include "chrome/browser/chromeos/extensions/device_local_account_management_pol
icy_provider.h" | 68 #include "chrome/browser/chromeos/extensions/device_local_account_management_pol
icy_provider.h" |
| 69 #include "chrome/browser/chromeos/extensions/signin_screen_policy_provider.h" |
| 69 #include "chrome/browser/chromeos/policy/device_local_account.h" | 70 #include "chrome/browser/chromeos/policy/device_local_account.h" |
| 71 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 70 #include "chromeos/chromeos_switches.h" | 72 #include "chromeos/chromeos_switches.h" |
| 71 #include "chromeos/login/login_state.h" | 73 #include "chromeos/login/login_state.h" |
| 72 #include "components/user_manager/user.h" | 74 #include "components/user_manager/user.h" |
| 73 #include "components/user_manager/user_manager.h" | 75 #include "components/user_manager/user_manager.h" |
| 74 #endif | 76 #endif |
| 75 | 77 |
| 76 using content::BrowserThread; | 78 using content::BrowserThread; |
| 77 | 79 |
| 78 namespace extensions { | 80 namespace extensions { |
| 79 | 81 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // requests. | 113 // requests. |
| 112 state_store_.reset(new StateStore( | 114 state_store_.reset(new StateStore( |
| 113 profile_, store_factory_, ValueStoreFrontend::BackendType::STATE, true)); | 115 profile_, store_factory_, ValueStoreFrontend::BackendType::STATE, true)); |
| 114 state_store_notification_observer_.reset( | 116 state_store_notification_observer_.reset( |
| 115 new StateStoreNotificationObserver(state_store_.get())); | 117 new StateStoreNotificationObserver(state_store_.get())); |
| 116 | 118 |
| 117 rules_store_.reset(new StateStore( | 119 rules_store_.reset(new StateStore( |
| 118 profile_, store_factory_, ValueStoreFrontend::BackendType::RULES, false)); | 120 profile_, store_factory_, ValueStoreFrontend::BackendType::RULES, false)); |
| 119 | 121 |
| 120 #if defined(OS_CHROMEOS) | 122 #if defined(OS_CHROMEOS) |
| 123 // We can not perform check for Signin Profile here, as it would result in |
| 124 // recursive call upon creation of Signin Profile, so we will create |
| 125 // SigninScreenPolicyProvider lazily in RegisterManagementPolicyProviders. |
| 126 |
| 121 const user_manager::User* user = | 127 const user_manager::User* user = |
| 122 user_manager::UserManager::Get()->GetActiveUser(); | 128 user_manager::UserManager::Get()->GetActiveUser(); |
| 123 policy::DeviceLocalAccount::Type device_local_account_type; | 129 policy::DeviceLocalAccount::Type device_local_account_type; |
| 124 if (user && | 130 if (user && |
| 125 policy::IsDeviceLocalAccountUser(user->GetAccountId().GetUserEmail(), | 131 policy::IsDeviceLocalAccountUser(user->GetAccountId().GetUserEmail(), |
| 126 &device_local_account_type)) { | 132 &device_local_account_type)) { |
| 127 device_local_account_management_policy_provider_.reset( | 133 device_local_account_management_policy_provider_.reset( |
| 128 new chromeos::DeviceLocalAccountManagementPolicyProvider( | 134 new chromeos::DeviceLocalAccountManagementPolicyProvider( |
| 129 device_local_account_type)); | 135 device_local_account_type)); |
| 130 } | 136 } |
| 131 #endif // defined(OS_CHROMEOS) | 137 #endif |
| 132 } | 138 } |
| 133 | 139 |
| 134 void ExtensionSystemImpl::Shared::RegisterManagementPolicyProviders() { | 140 void ExtensionSystemImpl::Shared::RegisterManagementPolicyProviders() { |
| 135 management_policy_->RegisterProviders( | 141 management_policy_->RegisterProviders( |
| 136 ExtensionManagementFactory::GetForBrowserContext(profile_) | 142 ExtensionManagementFactory::GetForBrowserContext(profile_) |
| 137 ->GetProviders()); | 143 ->GetProviders()); |
| 138 | 144 |
| 139 #if defined(OS_CHROMEOS) | 145 #if defined(OS_CHROMEOS) |
| 146 // Lazy creation of SigninScreenPolicyProvider. |
| 147 if (!signin_screen_policy_provider_) { |
| 148 if (chromeos::ProfileHelper::IsSigninProfile(profile_)) { |
| 149 signin_screen_policy_provider_.reset( |
| 150 new chromeos::SigninScreenPolicyProvider()); |
| 151 } |
| 152 } |
| 153 |
| 140 if (device_local_account_management_policy_provider_) { | 154 if (device_local_account_management_policy_provider_) { |
| 141 management_policy_->RegisterProvider( | 155 management_policy_->RegisterProvider( |
| 142 device_local_account_management_policy_provider_.get()); | 156 device_local_account_management_policy_provider_.get()); |
| 143 } | 157 } |
| 158 if (signin_screen_policy_provider_) |
| 159 management_policy_->RegisterProvider(signin_screen_policy_provider_.get()); |
| 144 #endif // defined(OS_CHROMEOS) | 160 #endif // defined(OS_CHROMEOS) |
| 145 | 161 |
| 146 management_policy_->RegisterProvider(InstallVerifier::Get(profile_)); | 162 management_policy_->RegisterProvider(InstallVerifier::Get(profile_)); |
| 147 } | 163 } |
| 148 | 164 |
| 149 void ExtensionSystemImpl::Shared::InitInstallGates() { | 165 void ExtensionSystemImpl::Shared::InitInstallGates() { |
| 150 update_install_gate_.reset(new UpdateInstallGate(extension_service_.get())); | 166 update_install_gate_.reset(new UpdateInstallGate(extension_service_.get())); |
| 151 extension_service_->RegisterInstallGate( | 167 extension_service_->RegisterInstallGate( |
| 152 ExtensionPrefs::DELAY_REASON_WAIT_FOR_IDLE, update_install_gate_.get()); | 168 ExtensionPrefs::DELAY_REASON_WAIT_FOR_IDLE, update_install_gate_.get()); |
| 153 extension_service_->RegisterInstallGate( | 169 extension_service_->RegisterInstallGate( |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 465 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
| 450 const std::string& extension_id, | 466 const std::string& extension_id, |
| 451 const UnloadedExtensionInfo::Reason reason) { | 467 const UnloadedExtensionInfo::Reason reason) { |
| 452 BrowserThread::PostTask( | 468 BrowserThread::PostTask( |
| 453 BrowserThread::IO, | 469 BrowserThread::IO, |
| 454 FROM_HERE, | 470 FROM_HERE, |
| 455 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); | 471 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); |
| 456 } | 472 } |
| 457 | 473 |
| 458 } // namespace extensions | 474 } // namespace extensions |
| OLD | NEW |