OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 if (extension->UpdatesFromGallery()) { | 285 if (extension->UpdatesFromGallery()) { |
286 *error = l10n_util::GetStringFUTF8( | 286 *error = l10n_util::GetStringFUTF8( |
287 IDS_EXTENSION_DISALLOW_NON_DOWNLOADED_GALLERY_INSTALLS, | 287 IDS_EXTENSION_DISALLOW_NON_DOWNLOADED_GALLERY_INSTALLS, |
288 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); | 288 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); |
289 return false; | 289 return false; |
290 } | 290 } |
291 | 291 |
292 // For self-hosted apps, verify that the entire extent is on the same | 292 // For self-hosted apps, verify that the entire extent is on the same |
293 // host (or a subdomain of the host) the download happened from. There's | 293 // host (or a subdomain of the host) the download happened from. There's |
294 // no way for us to verify that the app controls any other hosts. | 294 // no way for us to verify that the app controls any other hosts. |
295 URLPattern pattern(UserScript::kValidUserScriptSchemes); | 295 URLPattern pattern(URLPattern::ERROR_ON_PORTS, |
| 296 UserScript::kValidUserScriptSchemes); |
296 pattern.SetHost(download_url_.host()); | 297 pattern.SetHost(download_url_.host()); |
297 pattern.SetMatchSubdomains(true); | 298 pattern.SetMatchSubdomains(true); |
298 | 299 |
299 URLPatternSet patterns = extension_->web_extent(); | 300 URLPatternSet patterns = extension_->web_extent(); |
300 for (URLPatternSet::const_iterator i = patterns.begin(); | 301 for (URLPatternSet::const_iterator i = patterns.begin(); |
301 i != patterns.end(); ++i) { | 302 i != patterns.end(); ++i) { |
302 if (!pattern.MatchesHost(i->host())) { | 303 if (!pattern.MatchesHost(i->host())) { |
303 *error = base::StringPrintf( | 304 *error = base::StringPrintf( |
304 "Apps must be served from the host that they affect."); | 305 "Apps must be served from the host that they affect."); |
305 return false; | 306 return false; |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 // Some users (such as the download shelf) need to know when a | 601 // Some users (such as the download shelf) need to know when a |
601 // CRXInstaller is done. Listening for the EXTENSION_* events | 602 // CRXInstaller is done. Listening for the EXTENSION_* events |
602 // is problematic because they don't know anything about the | 603 // is problematic because they don't know anything about the |
603 // extension before it is unpacked, so they cannot filter based | 604 // extension before it is unpacked, so they cannot filter based |
604 // on the extension. | 605 // on the extension. |
605 content::NotificationService::current()->Notify( | 606 content::NotificationService::current()->Notify( |
606 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 607 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
607 content::Source<CrxInstaller>(this), | 608 content::Source<CrxInstaller>(this), |
608 content::Details<const Extension>(extension)); | 609 content::Details<const Extension>(extension)); |
609 } | 610 } |
OLD | NEW |