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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 new extensions::ExternalInstallManager(profile_, is_first_run_)); | 334 new extensions::ExternalInstallManager(profile_, is_first_run_)); |
335 | 335 |
336 extension_action_storage_manager_.reset( | 336 extension_action_storage_manager_.reset( |
337 new extensions::ExtensionActionStorageManager(profile_)); | 337 new extensions::ExtensionActionStorageManager(profile_)); |
338 | 338 |
339 // How long is the path to the Extensions directory? | 339 // How long is the path to the Extensions directory? |
340 UMA_HISTOGRAM_CUSTOM_COUNTS("Extensions.ExtensionRootPathLength", | 340 UMA_HISTOGRAM_CUSTOM_COUNTS("Extensions.ExtensionRootPathLength", |
341 install_directory_.value().length(), 0, 500, 100); | 341 install_directory_.value().length(), 0, 500, 100); |
342 } | 342 } |
343 | 343 |
344 const ExtensionSet* ExtensionService::extensions() const { | |
345 return ®istry_->enabled_extensions(); | |
346 } | |
347 | |
348 extensions::PendingExtensionManager* | 344 extensions::PendingExtensionManager* |
349 ExtensionService::pending_extension_manager() { | 345 ExtensionService::pending_extension_manager() { |
350 return &pending_extension_manager_; | 346 return &pending_extension_manager_; |
351 } | 347 } |
352 | 348 |
353 ExtensionService::~ExtensionService() { | 349 ExtensionService::~ExtensionService() { |
354 // No need to unload extensions here because they are profile-scoped, and the | 350 // No need to unload extensions here because they are profile-scoped, and the |
355 // profile is in the process of being deleted. | 351 // profile is in the process of being deleted. |
356 | 352 |
357 extensions::ProviderCollection::const_iterator i; | 353 extensions::ProviderCollection::const_iterator i; |
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1911 const std::string& id) const { | 1907 const std::string& id) const { |
1912 return delayed_installs_.GetByID(id); | 1908 return delayed_installs_.GetByID(id); |
1913 } | 1909 } |
1914 | 1910 |
1915 void ExtensionService::RegisterContentSettings( | 1911 void ExtensionService::RegisterContentSettings( |
1916 HostContentSettingsMap* host_content_settings_map) { | 1912 HostContentSettingsMap* host_content_settings_map) { |
1917 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1913 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1918 host_content_settings_map->RegisterProvider( | 1914 host_content_settings_map->RegisterProvider( |
1919 HostContentSettingsMap::INTERNAL_EXTENSION_PROVIDER, | 1915 HostContentSettingsMap::INTERNAL_EXTENSION_PROVIDER, |
1920 scoped_ptr<content_settings::ObservableProvider>( | 1916 scoped_ptr<content_settings::ObservableProvider>( |
1921 new content_settings::InternalExtensionProvider(this))); | 1917 new content_settings::InternalExtensionProvider(profile_))); |
1922 | 1918 |
1923 host_content_settings_map->RegisterProvider( | 1919 host_content_settings_map->RegisterProvider( |
1924 HostContentSettingsMap::CUSTOM_EXTENSION_PROVIDER, | 1920 HostContentSettingsMap::CUSTOM_EXTENSION_PROVIDER, |
1925 scoped_ptr<content_settings::ObservableProvider>( | 1921 scoped_ptr<content_settings::ObservableProvider>( |
1926 new content_settings::CustomExtensionProvider( | 1922 new content_settings::CustomExtensionProvider( |
1927 extensions::ContentSettingsService::Get( | 1923 extensions::ContentSettingsService::Get( |
1928 profile_)->content_settings_store(), | 1924 profile_)->content_settings_store(), |
1929 profile_->GetOriginalProfile() != profile_))); | 1925 profile_->GetOriginalProfile() != profile_))); |
1930 } | 1926 } |
1931 | 1927 |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2388 } | 2384 } |
2389 | 2385 |
2390 void ExtensionService::OnProfileDestructionStarted() { | 2386 void ExtensionService::OnProfileDestructionStarted() { |
2391 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2387 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2392 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2388 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2393 it != ids_to_unload.end(); | 2389 it != ids_to_unload.end(); |
2394 ++it) { | 2390 ++it) { |
2395 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2391 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2396 } | 2392 } |
2397 } | 2393 } |
OLD | NEW |