| 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/unpacked_installer.h" | 5 #include "chrome/browser/extensions/unpacked_installer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 return; | 188 return; |
| 189 } | 189 } |
| 190 | 190 |
| 191 ConfirmInstall(); | 191 ConfirmInstall(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 int UnpackedInstaller::GetFlags() { | 194 int UnpackedInstaller::GetFlags() { |
| 195 std::string id = id_util::GenerateIdForPath(extension_path_); | 195 std::string id = id_util::GenerateIdForPath(extension_path_); |
| 196 bool allow_file_access = | 196 bool allow_file_access = |
| 197 Manifest::ShouldAlwaysAllowFileAccess(Manifest::UNPACKED); | 197 Manifest::ShouldAlwaysAllowFileAccess(Manifest::UNPACKED); |
| 198 ExtensionPrefs* prefs = service_weak_->extension_prefs(); | 198 ExtensionPrefs* prefs = ExtensionPrefs::Get(service_weak_->profile()); |
| 199 if (prefs->HasAllowFileAccessSetting(id)) | 199 if (prefs->HasAllowFileAccessSetting(id)) |
| 200 allow_file_access = prefs->AllowFileAccess(id); | 200 allow_file_access = prefs->AllowFileAccess(id); |
| 201 | 201 |
| 202 int result = Extension::FOLLOW_SYMLINKS_ANYWHERE; | 202 int result = Extension::FOLLOW_SYMLINKS_ANYWHERE; |
| 203 if (allow_file_access) | 203 if (allow_file_access) |
| 204 result |= Extension::ALLOW_FILE_ACCESS; | 204 result |= Extension::ALLOW_FILE_ACCESS; |
| 205 if (require_modern_manifest_version_) | 205 if (require_modern_manifest_version_) |
| 206 result |= Extension::REQUIRE_MODERN_MANIFEST_VERSION; | 206 result |= Extension::REQUIRE_MODERN_MANIFEST_VERSION; |
| 207 | 207 |
| 208 return result; | 208 return result; |
| 209 } | 209 } |
| 210 | 210 |
| 211 bool UnpackedInstaller::IsLoadingUnpackedAllowed() const { | 211 bool UnpackedInstaller::IsLoadingUnpackedAllowed() const { |
| 212 if (!service_weak_.get()) | 212 if (!service_weak_.get()) |
| 213 return true; | 213 return true; |
| 214 // If there is a "*" in the extension blacklist, then no extensions should be | 214 // If there is a "*" in the extension blacklist, then no extensions should be |
| 215 // allowed at all (except explicitly whitelisted extensions). | 215 // allowed at all (except explicitly whitelisted extensions). |
| 216 ExtensionPrefs* prefs = service_weak_->extension_prefs(); | 216 ExtensionPrefs* prefs = ExtensionPrefs::Get(service_weak_->profile()); |
| 217 return !prefs->ExtensionsBlacklistedByDefault(); | 217 return !prefs->ExtensionsBlacklistedByDefault(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void UnpackedInstaller::GetAbsolutePath() { | 220 void UnpackedInstaller::GetAbsolutePath() { |
| 221 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 221 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 222 | 222 |
| 223 extension_path_ = base::MakeAbsoluteFilePath(extension_path_); | 223 extension_path_ = base::MakeAbsoluteFilePath(extension_path_); |
| 224 | 224 |
| 225 std::string error; | 225 std::string error; |
| 226 if (!extension_file_util::CheckForIllegalFilenames(extension_path_, | 226 if (!extension_file_util::CheckForIllegalFilenames(extension_path_, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 297 |
| 298 service_weak_->OnExtensionInstalled( | 298 service_weak_->OnExtensionInstalled( |
| 299 installer_.extension().get(), | 299 installer_.extension().get(), |
| 300 syncer::StringOrdinal(), | 300 syncer::StringOrdinal(), |
| 301 false /* no requirement errors */, | 301 false /* no requirement errors */, |
| 302 NOT_BLACKLISTED, | 302 NOT_BLACKLISTED, |
| 303 false /* don't wait for idle */); | 303 false /* don't wait for idle */); |
| 304 } | 304 } |
| 305 | 305 |
| 306 } // namespace extensions | 306 } // namespace extensions |
| OLD | NEW |