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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 using extensions::SharedModuleService; | 109 using extensions::SharedModuleService; |
110 using extensions::UnloadedExtensionInfo; | 110 using extensions::UnloadedExtensionInfo; |
111 | 111 |
112 namespace errors = extensions::manifest_errors; | 112 namespace errors = extensions::manifest_errors; |
113 | 113 |
114 namespace { | 114 namespace { |
115 | 115 |
116 // Wait this many seconds after an extensions becomes idle before updating it. | 116 // Wait this many seconds after an extensions becomes idle before updating it. |
117 const int kUpdateIdleDelay = 5; | 117 const int kUpdateIdleDelay = 5; |
118 | 118 |
119 #if defined(ENABLE_EXTENSIONS) | |
120 scoped_ptr<IdentityProvider> CreateWebstoreIdentityProvider(Profile* profile) { | 119 scoped_ptr<IdentityProvider> CreateWebstoreIdentityProvider(Profile* profile) { |
121 return make_scoped_ptr<IdentityProvider>(new ProfileIdentityProvider( | 120 return make_scoped_ptr<IdentityProvider>(new ProfileIdentityProvider( |
122 SigninManagerFactory::GetForProfile(profile), | 121 SigninManagerFactory::GetForProfile(profile), |
123 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 122 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
124 LoginUIServiceFactory::GetForProfile(profile))); | 123 LoginUIServiceFactory::GetForProfile(profile))); |
125 } | 124 } |
126 #endif // defined(ENABLE_EXTENSIONS) | |
127 | 125 |
128 } // namespace | 126 } // namespace |
129 | 127 |
130 // ExtensionService. | 128 // ExtensionService. |
131 | 129 |
132 void ExtensionService::CheckExternalUninstall(const std::string& id) { | 130 void ExtensionService::CheckExternalUninstall(const std::string& id) { |
133 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 131 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
134 | 132 |
135 // Check if the providers know about this extension. | 133 // Check if the providers know about this extension. |
136 extensions::ProviderCollection::const_iterator i; | 134 extensions::ProviderCollection::const_iterator i; |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 580 |
583 if (out_crx_installer) | 581 if (out_crx_installer) |
584 *out_crx_installer = installer.get(); | 582 *out_crx_installer = installer.get(); |
585 | 583 |
586 return true; | 584 return true; |
587 } | 585 } |
588 | 586 |
589 scoped_ptr<ExtensionDownloader> ExtensionService::CreateExtensionDownloader( | 587 scoped_ptr<ExtensionDownloader> ExtensionService::CreateExtensionDownloader( |
590 ExtensionDownloaderDelegate* delegate) { | 588 ExtensionDownloaderDelegate* delegate) { |
591 scoped_ptr<ExtensionDownloader> downloader; | 589 scoped_ptr<ExtensionDownloader> downloader; |
592 #if defined(ENABLE_EXTENSIONS) | |
593 scoped_ptr<IdentityProvider> identity_provider = | 590 scoped_ptr<IdentityProvider> identity_provider = |
594 CreateWebstoreIdentityProvider(profile_); | 591 CreateWebstoreIdentityProvider(profile_); |
595 downloader.reset(new ExtensionDownloader( | 592 downloader.reset(new ExtensionDownloader( |
596 delegate, | 593 delegate, |
597 profile_->GetRequestContext())); | 594 profile_->GetRequestContext())); |
598 downloader->SetWebstoreIdentityProvider(identity_provider.Pass()); | 595 downloader->SetWebstoreIdentityProvider(identity_provider.Pass()); |
599 #endif | |
600 return downloader.Pass(); | 596 return downloader.Pass(); |
601 } | 597 } |
602 | 598 |
603 void ExtensionService::ReloadExtensionImpl( | 599 void ExtensionService::ReloadExtensionImpl( |
604 // "transient" because the process of reloading may cause the reference | 600 // "transient" because the process of reloading may cause the reference |
605 // to become invalid. Instead, use |extension_id|, a copy. | 601 // to become invalid. Instead, use |extension_id|, a copy. |
606 const std::string& transient_extension_id, | 602 const std::string& transient_extension_id, |
607 bool be_noisy) { | 603 bool be_noisy) { |
608 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 604 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
609 | 605 |
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2362 } | 2358 } |
2363 | 2359 |
2364 void ExtensionService::OnProfileDestructionStarted() { | 2360 void ExtensionService::OnProfileDestructionStarted() { |
2365 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2361 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2366 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2362 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2367 it != ids_to_unload.end(); | 2363 it != ids_to_unload.end(); |
2368 ++it) { | 2364 ++it) { |
2369 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2365 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2370 } | 2366 } |
2371 } | 2367 } |
OLD | NEW |