| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 Details<const std::string>(&error)); | 735 Details<const std::string>(&error)); |
| 736 | 736 |
| 737 // TODO(port): note that this isn't guaranteed to work properly on Linux. | 737 // TODO(port): note that this isn't guaranteed to work properly on Linux. |
| 738 std::string path_str = WideToASCII(extension_path.ToWStringHack()); | 738 std::string path_str = WideToASCII(extension_path.ToWStringHack()); |
| 739 std::string message = StringPrintf("Could not load extension from '%s'. %s", | 739 std::string message = StringPrintf("Could not load extension from '%s'. %s", |
| 740 path_str.c_str(), error.c_str()); | 740 path_str.c_str(), error.c_str()); |
| 741 ExtensionErrorReporter::GetInstance()->ReportError(message, be_noisy); | 741 ExtensionErrorReporter::GetInstance()->ReportError(message, be_noisy); |
| 742 } | 742 } |
| 743 | 743 |
| 744 std::vector<FilePath> ExtensionsService::GetPersistentBlacklistPaths() { | 744 std::vector<FilePath> ExtensionsService::GetPersistentBlacklistPaths() { |
| 745 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
| 746 |
| 745 std::vector<FilePath> result; | 747 std::vector<FilePath> result; |
| 746 for (ExtensionList::const_iterator extension_iter = extensions()->begin(); | 748 for (ExtensionList::const_iterator extension_iter = extensions()->begin(); |
| 747 extension_iter != extensions()->end(); ++extension_iter) { | 749 extension_iter != extensions()->end(); ++extension_iter) { |
| 748 if ((*extension_iter)->location() == Extension::LOAD) | 750 if ((*extension_iter)->location() == Extension::LOAD) |
| 749 continue; | 751 continue; |
| 750 | 752 |
| 751 std::vector<Extension::PrivacyBlacklistInfo> blacklists( | 753 std::vector<Extension::PrivacyBlacklistInfo> blacklists( |
| 752 (*extension_iter)->privacy_blacklists()); | 754 (*extension_iter)->privacy_blacklists()); |
| 753 std::vector<Extension::PrivacyBlacklistInfo>::const_iterator blacklist_iter; | 755 std::vector<Extension::PrivacyBlacklistInfo>::const_iterator blacklist_iter; |
| 754 for (blacklist_iter = blacklists.begin(); | 756 for (blacklist_iter = blacklists.begin(); |
| 755 blacklist_iter != blacklists.end(); ++blacklist_iter) { | 757 blacklist_iter != blacklists.end(); ++blacklist_iter) { |
| 756 result.push_back(blacklist_iter->path); | 758 result.push_back(blacklist_iter->path); |
| 757 } | 759 } |
| 758 } | 760 } |
| 759 return result; | 761 return result; |
| 760 } | 762 } |
| 761 | 763 |
| 762 std::vector<FilePath> ExtensionsService::GetTransientBlacklistPaths() { | 764 std::vector<FilePath> ExtensionsService::GetTransientBlacklistPaths() { |
| 765 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
| 766 |
| 763 std::vector<FilePath> result; | 767 std::vector<FilePath> result; |
| 764 for (ExtensionList::const_iterator extension_iter = extensions()->begin(); | 768 for (ExtensionList::const_iterator extension_iter = extensions()->begin(); |
| 765 extension_iter != extensions()->end(); ++extension_iter) { | 769 extension_iter != extensions()->end(); ++extension_iter) { |
| 766 if ((*extension_iter)->location() != Extension::LOAD) | 770 if ((*extension_iter)->location() != Extension::LOAD) |
| 767 continue; | 771 continue; |
| 768 | 772 |
| 769 std::vector<Extension::PrivacyBlacklistInfo> blacklists( | 773 std::vector<Extension::PrivacyBlacklistInfo> blacklists( |
| 770 (*extension_iter)->privacy_blacklists()); | 774 (*extension_iter)->privacy_blacklists()); |
| 771 std::vector<Extension::PrivacyBlacklistInfo>::const_iterator blacklist_iter; | 775 std::vector<Extension::PrivacyBlacklistInfo>::const_iterator blacklist_iter; |
| 772 for (blacklist_iter = blacklists.begin(); | 776 for (blacklist_iter = blacklists.begin(); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 | 951 |
| 948 void ExtensionsServiceBackend::OnExternalExtensionFound( | 952 void ExtensionsServiceBackend::OnExternalExtensionFound( |
| 949 const std::string& id, const Version* version, const FilePath& path, | 953 const std::string& id, const Version* version, const FilePath& path, |
| 950 Extension::Location location) { | 954 Extension::Location location) { |
| 951 ChromeThread::PostTask( | 955 ChromeThread::PostTask( |
| 952 ChromeThread::UI, FROM_HERE, | 956 ChromeThread::UI, FROM_HERE, |
| 953 NewRunnableMethod( | 957 NewRunnableMethod( |
| 954 frontend_, &ExtensionsService::OnExternalExtensionFound, id, | 958 frontend_, &ExtensionsService::OnExternalExtensionFound, id, |
| 955 version->GetString(), path, location)); | 959 version->GetString(), path, location)); |
| 956 } | 960 } |
| OLD | NEW |