| 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/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 *error = l10n_util::GetStringFUTF8( | 276 *error = l10n_util::GetStringFUTF8( |
| 277 IDS_EXTENSION_DISALLOW_NON_DOWNLOADED_GALLERY_INSTALLS, | 277 IDS_EXTENSION_DISALLOW_NON_DOWNLOADED_GALLERY_INSTALLS, |
| 278 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); | 278 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); |
| 279 return false; | 279 return false; |
| 280 } | 280 } |
| 281 | 281 |
| 282 // For self-hosted apps, verify that the entire extent is on the same | 282 // For self-hosted apps, verify that the entire extent is on the same |
| 283 // host (or a subdomain of the host) the download happened from. There's | 283 // host (or a subdomain of the host) the download happened from. There's |
| 284 // no way for us to verify that the app controls any other hosts. | 284 // no way for us to verify that the app controls any other hosts. |
| 285 URLPattern pattern(UserScript::kValidUserScriptSchemes); | 285 URLPattern pattern(UserScript::kValidUserScriptSchemes); |
| 286 pattern.set_host(original_url_.host()); | 286 pattern.SetHost(original_url_.host()); |
| 287 pattern.set_match_subdomains(true); | 287 pattern.SetMatchSubdomains(true); |
| 288 | 288 |
| 289 URLPatternList patterns = extension_->web_extent().patterns(); | 289 URLPatternSet patterns = extension_->web_extent(); |
| 290 for (size_t i = 0; i < patterns.size(); ++i) { | 290 for (URLPatternSet::const_iterator i = patterns.begin(); |
| 291 if (!pattern.MatchesHost(patterns[i].host())) { | 291 i != patterns.end(); ++i) { |
| 292 if (!pattern.MatchesHost(i->host())) { |
| 292 *error = base::StringPrintf( | 293 *error = base::StringPrintf( |
| 293 "Apps must be served from the host that they affect."); | 294 "Apps must be served from the host that they affect."); |
| 294 return false; | 295 return false; |
| 295 } | 296 } |
| 296 } | 297 } |
| 297 } | 298 } |
| 298 } | 299 } |
| 299 | 300 |
| 300 return true; | 301 return true; |
| 301 } | 302 } |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 // Some users (such as the download shelf) need to know when a | 570 // Some users (such as the download shelf) need to know when a |
| 570 // CRXInstaller is done. Listening for the EXTENSION_* events | 571 // CRXInstaller is done. Listening for the EXTENSION_* events |
| 571 // is problematic because they don't know anything about the | 572 // is problematic because they don't know anything about the |
| 572 // extension before it is unpacked, so they can not filter based | 573 // extension before it is unpacked, so they can not filter based |
| 573 // on the extension. | 574 // on the extension. |
| 574 NotificationService::current()->Notify( | 575 NotificationService::current()->Notify( |
| 575 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 576 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
| 576 Source<CrxInstaller>(this), | 577 Source<CrxInstaller>(this), |
| 577 NotificationService::NoDetails()); | 578 NotificationService::NoDetails()); |
| 578 } | 579 } |
| OLD | NEW |