| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/webstore_inline_installer.h" | 5 #include "chrome/browser/extensions/webstore_inline_installer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 verified_site); | 77 verified_site); |
| 78 } else { | 78 } else { |
| 79 const base::ListValue* verified_sites = NULL; | 79 const base::ListValue* verified_sites = NULL; |
| 80 if (!webstore_data.GetList(kVerifiedSitesKey, &verified_sites)) { | 80 if (!webstore_data.GetList(kVerifiedSitesKey, &verified_sites)) { |
| 81 *error = kInvalidWebstoreResponseError; | 81 *error = kInvalidWebstoreResponseError; |
| 82 return false; | 82 return false; |
| 83 } | 83 } |
| 84 for (base::ListValue::const_iterator it = verified_sites->begin(); | 84 for (base::ListValue::const_iterator it = verified_sites->begin(); |
| 85 it != verified_sites->end() && !requestor_is_ok; ++it) { | 85 it != verified_sites->end() && !requestor_is_ok; ++it) { |
| 86 std::string verified_site; | 86 std::string verified_site; |
| 87 if (!(*it)->GetAsString(&verified_site)) { | 87 if (!it->GetAsString(&verified_site)) { |
| 88 *error = kInvalidWebstoreResponseError; | 88 *error = kInvalidWebstoreResponseError; |
| 89 return false; | 89 return false; |
| 90 } | 90 } |
| 91 if (IsRequestorURLInVerifiedSite(requestor_url, verified_site)) { | 91 if (IsRequestorURLInVerifiedSite(requestor_url, verified_site)) { |
| 92 requestor_is_ok = true; | 92 requestor_is_ok = true; |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 if (!requestor_is_ok) { | 96 if (!requestor_is_ok) { |
| 97 *error = kNotFromVerifiedSitesError; | 97 *error = kNotFromVerifiedSitesError; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 DLOG(WARNING) << "Could not parse " << verified_site_pattern_spec << | 288 DLOG(WARNING) << "Could not parse " << verified_site_pattern_spec << |
| 289 " as URL pattern " << parse_result; | 289 " as URL pattern " << parse_result; |
| 290 return false; | 290 return false; |
| 291 } | 291 } |
| 292 verified_site_pattern.SetScheme("*"); | 292 verified_site_pattern.SetScheme("*"); |
| 293 | 293 |
| 294 return verified_site_pattern.MatchesURL(requestor_url); | 294 return verified_site_pattern.MatchesURL(requestor_url); |
| 295 } | 295 } |
| 296 | 296 |
| 297 } // namespace extensions | 297 } // namespace extensions |
| OLD | NEW |