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/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 bool launch_on_load) { | 122 bool launch_on_load) { |
123 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 123 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
124 DCHECK(extension_path_.empty()); | 124 DCHECK(extension_path_.empty()); |
125 | 125 |
126 if (!service_weak_.get()) | 126 if (!service_weak_.get()) |
127 return; | 127 return; |
128 // Load extensions from the command line synchronously to avoid a race | 128 // Load extensions from the command line synchronously to avoid a race |
129 // between extension loading and loading an URL from the command line. | 129 // between extension loading and loading an URL from the command line. |
130 base::ThreadRestrictions::ScopedAllowIO allow_io; | 130 base::ThreadRestrictions::ScopedAllowIO allow_io; |
131 | 131 |
132 extension_path_ = path_in; | 132 extension_path_ = base::MakeAbsoluteFilePath(path_in); |
133 file_util::AbsolutePath(&extension_path_); | |
134 | 133 |
135 if (!IsLoadingUnpackedAllowed()) { | 134 if (!IsLoadingUnpackedAllowed()) { |
136 ReportExtensionLoadError(kUnpackedExtensionsBlacklistedError); | 135 ReportExtensionLoadError(kUnpackedExtensionsBlacklistedError); |
137 return; | 136 return; |
138 } | 137 } |
139 | 138 |
140 std::string error; | 139 std::string error; |
141 extension_ = extension_file_util::LoadExtension( | 140 extension_ = extension_file_util::LoadExtension( |
142 extension_path_, | 141 extension_path_, |
143 Manifest::COMMAND_LINE, | 142 Manifest::COMMAND_LINE, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 if (!service_weak_) | 192 if (!service_weak_) |
194 return true; | 193 return true; |
195 // If there is a "*" in the extension blacklist, then no extensions should be | 194 // If there is a "*" in the extension blacklist, then no extensions should be |
196 // allowed at all (except explicitly whitelisted extensions). | 195 // allowed at all (except explicitly whitelisted extensions). |
197 return !service_weak_->extension_prefs()->ExtensionsBlacklistedByDefault(); | 196 return !service_weak_->extension_prefs()->ExtensionsBlacklistedByDefault(); |
198 } | 197 } |
199 | 198 |
200 void UnpackedInstaller::GetAbsolutePath() { | 199 void UnpackedInstaller::GetAbsolutePath() { |
201 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 200 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
202 | 201 |
203 file_util::AbsolutePath(&extension_path_); | 202 extension_path_ = base::MakeAbsoluteFilePath(extension_path_); |
204 | 203 |
205 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 204 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
206 base::Bind(&UnpackedInstaller::CheckExtensionFileAccess, this)); | 205 base::Bind(&UnpackedInstaller::CheckExtensionFileAccess, this)); |
207 } | 206 } |
208 | 207 |
209 void UnpackedInstaller::CheckExtensionFileAccess() { | 208 void UnpackedInstaller::CheckExtensionFileAccess() { |
210 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 209 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
211 if (!service_weak_) | 210 if (!service_weak_) |
212 return; | 211 return; |
213 | 212 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 if (launch_on_load_) | 273 if (launch_on_load_) |
275 service_weak_->ScheduleLaunchOnLoad(extension_->id()); | 274 service_weak_->ScheduleLaunchOnLoad(extension_->id()); |
276 | 275 |
277 service_weak_->OnExtensionInstalled(extension_, | 276 service_weak_->OnExtensionInstalled(extension_, |
278 syncer::StringOrdinal(), | 277 syncer::StringOrdinal(), |
279 false /* no requirement errors */, | 278 false /* no requirement errors */, |
280 false /* don't wait for idle */); | 279 false /* don't wait for idle */); |
281 } | 280 } |
282 | 281 |
283 } // namespace extensions | 282 } // namespace extensions |
OLD | NEW |