| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/password_manager/core/browser/affiliation_fetcher.h" | 5 #include "components/password_manager/core/browser/affiliation_fetcher.h" |
| 6 | 6 |
| 7 #include "components/password_manager/core/browser/affiliation_api.pb.h" | 7 #include "components/password_manager/core/browser/affiliation_api.pb.h" |
| 8 #include "components/password_manager/core/browser/affiliation_utils.h" | 8 #include "components/password_manager/core/browser/affiliation_utils.h" |
| 9 #include "components/password_manager/core/browser/test_affiliation_fetcher_fact
ory.h" | 9 #include "components/password_manager/core/browser/test_affiliation_fetcher_fact
ory.h" |
| 10 #include "google_apis/google_api_keys.h" | 10 #include "google_apis/google_api_keys.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 result->reserve(requested_facet_uris_.size()); | 113 result->reserve(requested_facet_uris_.size()); |
| 114 | 114 |
| 115 std::map<FacetURI, size_t> facet_uri_to_class_index; | 115 std::map<FacetURI, size_t> facet_uri_to_class_index; |
| 116 for (int i = 0; i < response.affiliation_size(); ++i) { | 116 for (int i = 0; i < response.affiliation_size(); ++i) { |
| 117 const affiliation_pb::Affiliation& equivalence_class( | 117 const affiliation_pb::Affiliation& equivalence_class( |
| 118 response.affiliation(i)); | 118 response.affiliation(i)); |
| 119 | 119 |
| 120 AffiliatedFacets affiliated_uris; | 120 AffiliatedFacets affiliated_uris; |
| 121 for (int j = 0; j < equivalence_class.facet_size(); ++j) { | 121 for (int j = 0; j < equivalence_class.facet_size(); ++j) { |
| 122 const std::string& uri_spec(equivalence_class.facet(j)); | 122 const std::string& uri_spec(equivalence_class.facet(j).id()); |
| 123 FacetURI uri = FacetURI::FromPotentiallyInvalidSpec(uri_spec); | 123 FacetURI uri = FacetURI::FromPotentiallyInvalidSpec(uri_spec); |
| 124 // Ignore potential future kinds of facet URIs (e.g. for new platforms). | 124 // Ignore potential future kinds of facet URIs (e.g. for new platforms). |
| 125 if (!uri.is_valid()) | 125 if (!uri.is_valid()) |
| 126 continue; | 126 continue; |
| 127 affiliated_uris.push_back(uri); | 127 affiliated_uris.push_back(uri); |
| 128 } | 128 } |
| 129 | 129 |
| 130 // Be lenient and ignore empty (after filtering) equivalence classes. | 130 // Be lenient and ignore empty (after filtering) equivalence classes. |
| 131 if (affiliated_uris.empty()) | 131 if (affiliated_uris.empty()) |
| 132 continue; | 132 continue; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 if (ParseResponse(result.get())) | 168 if (ParseResponse(result.get())) |
| 169 delegate_->OnFetchSucceeded(result.Pass()); | 169 delegate_->OnFetchSucceeded(result.Pass()); |
| 170 else | 170 else |
| 171 delegate_->OnMalformedResponse(); | 171 delegate_->OnMalformedResponse(); |
| 172 } else { | 172 } else { |
| 173 delegate_->OnFetchFailed(); | 173 delegate_->OnFetchFailed(); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace password_manager | 177 } // namespace password_manager |
| OLD | NEW |