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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 original_mime_type_ != Extension::kMimeType) { | 183 original_mime_type_ != Extension::kMimeType) { |
184 *error = base::StringPrintf( | 184 *error = base::StringPrintf( |
185 "Apps must be served with content type %s.", | 185 "Apps must be served with content type %s.", |
186 Extension::kMimeType); | 186 Extension::kMimeType); |
187 return false; | 187 return false; |
188 } | 188 } |
189 | 189 |
190 // For self-hosted apps, verify that the entire extent is on the same | 190 // For self-hosted apps, verify that the entire extent is on the same |
191 // host (or a subdomain of the host) the download happened from. There's | 191 // host (or a subdomain of the host) the download happened from. There's |
192 // no way for us to verify that the app controls any other hosts. | 192 // no way for us to verify that the app controls any other hosts. |
193 if (!is_gallery_install_) { | 193 if (!is_gallery_install_ && client_) { |
194 URLPattern pattern(UserScript::kValidUserScriptSchemes); | 194 URLPattern pattern(UserScript::kValidUserScriptSchemes); |
195 pattern.set_host(original_url_.host()); | 195 pattern.set_host(original_url_.host()); |
196 pattern.set_match_subdomains(true); | 196 pattern.set_match_subdomains(true); |
197 | 197 |
198 ExtensionExtent::PatternList patterns = | 198 ExtensionExtent::PatternList patterns = |
199 extension_->web_extent().patterns(); | 199 extension_->web_extent().patterns(); |
200 for (size_t i = 0; i < patterns.size(); ++i) { | 200 for (size_t i = 0; i < patterns.size(); ++i) { |
201 if (!pattern.MatchesHost(patterns[i].host())) { | 201 if (!pattern.MatchesHost(patterns[i].host())) { |
202 *error = base::StringPrintf( | 202 *error = base::StringPrintf( |
203 "Apps must be served from the host that they affect."); | 203 "Apps must be served from the host that they affect."); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 client_->OnInstallSuccess(extension_.get()); | 397 client_->OnInstallSuccess(extension_.get()); |
398 | 398 |
399 // Tell the frontend about the installation and hand off ownership of | 399 // Tell the frontend about the installation and hand off ownership of |
400 // extension_ to it. | 400 // extension_ to it. |
401 frontend_->OnExtensionInstalled(extension_.release(), | 401 frontend_->OnExtensionInstalled(extension_.release(), |
402 allow_privilege_increase_); | 402 allow_privilege_increase_); |
403 | 403 |
404 // We're done. We don't post any more tasks to ourselves so we are deleted | 404 // We're done. We don't post any more tasks to ourselves so we are deleted |
405 // soon. | 405 // soon. |
406 } | 406 } |
OLD | NEW |