| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 registrar_.Add(this, | 345 registrar_.Add(this, |
| 346 extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, | 346 extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, |
| 347 content::NotificationService::AllBrowserContextsAndSources()); | 347 content::NotificationService::AllBrowserContextsAndSources()); |
| 348 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 348 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 349 content::NotificationService::AllBrowserContextsAndSources()); | 349 content::NotificationService::AllBrowserContextsAndSources()); |
| 350 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, | 350 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
| 351 content::NotificationService::AllBrowserContextsAndSources()); | 351 content::NotificationService::AllBrowserContextsAndSources()); |
| 352 registrar_.Add(this, | 352 registrar_.Add(this, |
| 353 chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, | 353 chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, |
| 354 content::Source<Profile>(profile_)); | 354 content::Source<Profile>(profile_)); |
| 355 #if defined(OS_CHROMEOS) |
| 356 // Sign in profile extension service should observe session start - when the |
| 357 // session is started, the context's process map should be updated to consider |
| 358 // extension scripts to run in lock screen context (as the sign-in profile |
| 359 // will be used to host lock screen apps from that point). |
| 360 // TODO(tbarzic): Consider introducing a profile dedicated to lock screen apps |
| 361 // so the process map's 'is lock screen context' flag does not have to be |
| 362 // changed when the user session starts. |
| 363 if (chromeos::ProfileHelper::IsSigninProfile(profile_)) { |
| 364 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED, |
| 365 content::NotificationService::AllSources()); |
| 366 } |
| 367 #endif |
| 355 | 368 |
| 356 extensions::ExtensionManagementFactory::GetForBrowserContext(profile_) | 369 extensions::ExtensionManagementFactory::GetForBrowserContext(profile_) |
| 357 ->AddObserver(this); | 370 ->AddObserver(this); |
| 358 | 371 |
| 359 // Set up the ExtensionUpdater. | 372 // Set up the ExtensionUpdater. |
| 360 if (autoupdate_enabled) { | 373 if (autoupdate_enabled) { |
| 361 int update_frequency = extensions::kDefaultUpdateFrequencySeconds; | 374 int update_frequency = extensions::kDefaultUpdateFrequencySeconds; |
| 362 if (command_line->HasSwitch(switches::kExtensionsUpdateFrequency)) { | 375 if (command_line->HasSwitch(switches::kExtensionsUpdateFrequency)) { |
| 363 base::StringToInt(command_line->GetSwitchValueASCII( | 376 base::StringToInt(command_line->GetSwitchValueASCII( |
| 364 switches::kExtensionsUpdateFrequency), | 377 switches::kExtensionsUpdateFrequency), |
| (...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2251 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { | 2264 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { |
| 2252 // Notify observers that chrome update is available. | 2265 // Notify observers that chrome update is available. |
| 2253 for (auto& observer : update_observers_) | 2266 for (auto& observer : update_observers_) |
| 2254 observer.OnChromeUpdateAvailable(); | 2267 observer.OnChromeUpdateAvailable(); |
| 2255 break; | 2268 break; |
| 2256 } | 2269 } |
| 2257 case chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED: { | 2270 case chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED: { |
| 2258 OnProfileDestructionStarted(); | 2271 OnProfileDestructionStarted(); |
| 2259 break; | 2272 break; |
| 2260 } | 2273 } |
| 2274 #if defined(OS_CHROMEOS) |
| 2275 case chrome::NOTIFICATION_SESSION_STARTED: { |
| 2276 DCHECK(chromeos::ProfileHelper::IsSigninProfile(profile_)); |
| 2277 |
| 2278 // When the user session starts, mark the signin context as lock screen |
| 2279 // context, as it will be used to host apps on lock screen. |
| 2280 extensions::ProcessMap::Get(profile_)->set_is_lock_screen_context(true); |
| 2281 BrowserThread::PostTask( |
| 2282 BrowserThread::IO, FROM_HERE, |
| 2283 base::BindOnce(&extensions::InfoMap::SetIsLockScreenContext, |
| 2284 system_->info_map(), true)); |
| 2285 break; |
| 2286 } |
| 2287 #endif |
| 2261 | 2288 |
| 2262 default: | 2289 default: |
| 2263 NOTREACHED() << "Unexpected notification type."; | 2290 NOTREACHED() << "Unexpected notification type."; |
| 2264 } | 2291 } |
| 2265 } | 2292 } |
| 2266 | 2293 |
| 2267 int ExtensionService::GetDisableReasonsOnInstalled(const Extension* extension) { | 2294 int ExtensionService::GetDisableReasonsOnInstalled(const Extension* extension) { |
| 2268 bool is_update_from_same_type = false; | 2295 bool is_update_from_same_type = false; |
| 2269 { | 2296 { |
| 2270 const Extension* existing_extension = | 2297 const Extension* existing_extension = |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2550 for (const auto& extension : registry_->disabled_extensions()) { | 2577 for (const auto& extension : registry_->disabled_extensions()) { |
| 2551 if (SharedModuleInfo::IsSharedModule(extension.get())) | 2578 if (SharedModuleInfo::IsSharedModule(extension.get())) |
| 2552 to_enable.push_back(extension); | 2579 to_enable.push_back(extension); |
| 2553 } | 2580 } |
| 2554 for (const auto& extension : to_enable) { | 2581 for (const auto& extension : to_enable) { |
| 2555 EnableExtension(extension->id()); | 2582 EnableExtension(extension->id()); |
| 2556 } | 2583 } |
| 2557 | 2584 |
| 2558 OnBlacklistUpdated(); | 2585 OnBlacklistUpdated(); |
| 2559 } | 2586 } |
| OLD | NEW |