| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 std::set<std::string> extensions_; | 61 std::set<std::string> extensions_; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace | 64 } // namespace |
| 65 | 65 |
| 66 // ExtensionsService. | 66 // ExtensionsService. |
| 67 | 67 |
| 68 const char* ExtensionsService::kInstallDirectoryName = "Extensions"; | 68 const char* ExtensionsService::kInstallDirectoryName = "Extensions"; |
| 69 const char* ExtensionsService::kCurrentVersionFileName = "Current Version"; | 69 const char* ExtensionsService::kCurrentVersionFileName = "Current Version"; |
| 70 | 70 |
| 71 const char* ExtensionsService::kGalleryDownloadURLPrefix = | |
| 72 "https://dl-ssl.google.com/chrome/"; | |
| 73 const char* ExtensionsService::kGalleryURLPrefix = | |
| 74 "https://tools.google.com/chrome/"; | |
| 75 | |
| 76 // static | 71 // static |
| 77 bool ExtensionsService::IsDownloadFromGallery(const GURL& download_url, | 72 bool ExtensionsService::IsDownloadFromGallery(const GURL& download_url, |
| 78 const GURL& referrer_url) { | 73 const GURL& referrer_url) { |
| 79 if (StartsWithASCII(download_url.spec(), kGalleryDownloadURLPrefix, false) && | 74 if (StartsWithASCII(download_url.spec(), |
| 80 StartsWithASCII(referrer_url.spec(), kGalleryURLPrefix, false)) { | 75 extension_urls::kMiniGalleryDownloadPrefix, false) && |
| 76 StartsWithASCII(referrer_url.spec(), |
| 77 extension_urls::kMiniGalleryBrowsePrefix, false)) { |
| 81 return true; | 78 return true; |
| 82 } else { | |
| 83 return false; | |
| 84 } | 79 } |
| 80 |
| 81 if (StartsWithASCII(download_url.spec(), |
| 82 extension_urls::kGalleryDownloadPrefix, false) && |
| 83 StartsWithASCII(referrer_url.spec(), |
| 84 extension_urls::kGalleryBrowsePrefix, false)) { |
| 85 return true; |
| 86 } |
| 87 |
| 88 return false; |
| 85 } | 89 } |
| 86 | 90 |
| 87 ExtensionsService::ExtensionsService(Profile* profile, | 91 ExtensionsService::ExtensionsService(Profile* profile, |
| 88 const CommandLine* command_line, | 92 const CommandLine* command_line, |
| 89 PrefService* prefs, | 93 PrefService* prefs, |
| 90 const FilePath& install_directory, | 94 const FilePath& install_directory, |
| 91 bool autoupdate_enabled) | 95 bool autoupdate_enabled) |
| 92 : profile_(profile), | 96 : profile_(profile), |
| 93 extension_prefs_(new ExtensionPrefs(prefs, install_directory)), | 97 extension_prefs_(new ExtensionPrefs(prefs, install_directory)), |
| 94 install_directory_(install_directory), | 98 install_directory_(install_directory), |
| (...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 | 955 |
| 952 void ExtensionsServiceBackend::OnExternalExtensionFound( | 956 void ExtensionsServiceBackend::OnExternalExtensionFound( |
| 953 const std::string& id, const Version* version, const FilePath& path, | 957 const std::string& id, const Version* version, const FilePath& path, |
| 954 Extension::Location location) { | 958 Extension::Location location) { |
| 955 ChromeThread::PostTask( | 959 ChromeThread::PostTask( |
| 956 ChromeThread::UI, FROM_HERE, | 960 ChromeThread::UI, FROM_HERE, |
| 957 NewRunnableMethod( | 961 NewRunnableMethod( |
| 958 frontend_, &ExtensionsService::OnExternalExtensionFound, id, | 962 frontend_, &ExtensionsService::OnExternalExtensionFound, id, |
| 959 version->GetString(), path, location)); | 963 version->GetString(), path, location)); |
| 960 } | 964 } |
| OLD | NEW |