| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/crx_installer.h" | 5 #include "chrome/browser/extensions/crx_installer.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 ReportFailureFromFileThread(StringPrintf( | 161 ReportFailureFromFileThread(StringPrintf( |
| 162 "ID in new extension manifest (%s) does not match expected id (%s)", | 162 "ID in new extension manifest (%s) does not match expected id (%s)", |
| 163 extension->id().c_str(), | 163 extension->id().c_str(), |
| 164 expected_id_.c_str())); | 164 expected_id_.c_str())); |
| 165 return; | 165 return; |
| 166 } | 166 } |
| 167 | 167 |
| 168 // Require that apps are served from the domain they claim in their extent, | 168 // Require that apps are served from the domain they claim in their extent, |
| 169 // or some ancestor domain. | 169 // or some ancestor domain. |
| 170 if (extension_->is_app() && limit_web_extent_to_download_host_) { | 170 if (extension_->is_app() && limit_web_extent_to_download_host_) { |
| 171 URLPattern pattern(URLPattern::SCHEMES_ALL); | 171 URLPattern pattern(UserScript::kValidUserScriptSchemes); |
| 172 pattern.set_host(original_url_.host()); | 172 pattern.set_host(original_url_.host()); |
| 173 pattern.set_match_subdomains(true); | 173 pattern.set_match_subdomains(true); |
| 174 | 174 |
| 175 for (size_t i = 0; i < extension_->web_extent().patterns().size(); ++i) { | 175 for (size_t i = 0; i < extension_->web_extent().patterns().size(); ++i) { |
| 176 if (!pattern.MatchesHost(extension_->web_extent().patterns()[i].host())) { | 176 if (!pattern.MatchesHost(extension_->web_extent().patterns()[i].host())) { |
| 177 ReportFailureFromFileThread(StringPrintf( | 177 ReportFailureFromFileThread(StringPrintf( |
| 178 "Apps must be served from the host that they affect.")); | 178 "Apps must be served from the host that they affect.")); |
| 179 return; | 179 return; |
| 180 } | 180 } |
| 181 } | 181 } |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 client_->OnInstallSuccess(extension_.get()); | 347 client_->OnInstallSuccess(extension_.get()); |
| 348 | 348 |
| 349 // Tell the frontend about the installation and hand off ownership of | 349 // Tell the frontend about the installation and hand off ownership of |
| 350 // extension_ to it. | 350 // extension_ to it. |
| 351 frontend_->OnExtensionInstalled(extension_.release(), | 351 frontend_->OnExtensionInstalled(extension_.release(), |
| 352 allow_privilege_increase_); | 352 allow_privilege_increase_); |
| 353 | 353 |
| 354 // We're done. We don't post any more tasks to ourselves so we are deleted | 354 // We're done. We don't post any more tasks to ourselves so we are deleted |
| 355 // soon. | 355 // soon. |
| 356 } | 356 } |
| OLD | NEW |