1 // Copyright 2017 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "components/search_provider_logos/fixed_logo_api.h" 6 7 #include <memory> 8 9 #include "base/memory/ref_counted_memory.h" 10 #include "components/search_provider_logos/logo_common.h" 11 #include "url/gurl.h" 12 13 namespace search_provider_logos { 14 ParseFixedLogoResponse(std::unique_ptr<std::string> response,base::Time response_time,bool * parsing_failed)15std::unique_ptr<EncodedLogo> ParseFixedLogoResponse( 16 std::unique_ptr<std::string> response, 17 base::Time response_time, 18 bool* parsing_failed) { 19 auto logo = std::make_unique<EncodedLogo>(); 20 logo->encoded_image = base::RefCountedString::TakeString(response.get()); 21 22 // If |can_show_after_expiration| is true, the |expiration_time| has little 23 // effect. Set it as far as possible in the future just as an approximation. 24 logo->metadata.expiration_time = 25 response_time + base::TimeDelta::FromMilliseconds(kMaxTimeToLiveMS); 26 logo->metadata.can_show_after_expiration = true; 27 28 *parsing_failed = false; 29 return logo; 30 } 31 UseFixedLogoUrl(const GURL & logo_url,const std::string & fingerprint)32GURL UseFixedLogoUrl(const GURL& logo_url, const std::string& fingerprint) { 33 return logo_url; 34 } 35 36 } // namespace search_provider_logos 37