| 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/search_provider_logos/logo_tracker.h" | 5 #include "components/search_provider_logos/logo_tracker.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 if (!animated_url.empty()) | 132 if (!animated_url.empty()) |
| 133 dict.SetString("update.logo.url", animated_url); | 133 dict.SetString("update.logo.url", animated_url); |
| 134 if (!mime_type.empty()) | 134 if (!mime_type.empty()) |
| 135 dict.SetString("update.logo.mime_type", mime_type); | 135 dict.SetString("update.logo.mime_type", mime_type); |
| 136 dict.SetString("update.logo.fingerprint", fingerprint); | 136 dict.SetString("update.logo.fingerprint", fingerprint); |
| 137 if (time_to_live.ToInternalValue() != 0) | 137 if (time_to_live.ToInternalValue() != 0) |
| 138 dict.SetInteger("update.logo.time_to_live", | 138 dict.SetInteger("update.logo.time_to_live", |
| 139 static_cast<int>(time_to_live.InMilliseconds())); | 139 static_cast<int>(time_to_live.InMilliseconds())); |
| 140 | 140 |
| 141 std::string output; | 141 std::string output; |
| 142 base::JSONWriter::Write(&dict, &output); | 142 base::JSONWriter::Write(dict, &output); |
| 143 return output; | 143 return output; |
| 144 } | 144 } |
| 145 | 145 |
| 146 std::string MakeServerResponse(const Logo& logo, base::TimeDelta time_to_live) { | 146 std::string MakeServerResponse(const Logo& logo, base::TimeDelta time_to_live) { |
| 147 return MakeServerResponse(logo.image, | 147 return MakeServerResponse(logo.image, |
| 148 logo.metadata.on_click_url, | 148 logo.metadata.on_click_url, |
| 149 logo.metadata.alt_text, | 149 logo.metadata.alt_text, |
| 150 logo.metadata.animated_url, | 150 logo.metadata.animated_url, |
| 151 logo.metadata.mime_type, | 151 logo.metadata.mime_type, |
| 152 logo.metadata.fingerprint, | 152 logo.metadata.fingerprint, |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 MockLogoObserver listener2; | 733 MockLogoObserver listener2; |
| 734 listener2.ExpectFreshLogo(&logo); | 734 listener2.ExpectFreshLogo(&logo); |
| 735 logo_tracker_->GetLogo(&listener2); | 735 logo_tracker_->GetLogo(&listener2); |
| 736 | 736 |
| 737 base::RunLoop().RunUntilIdle(); | 737 base::RunLoop().RunUntilIdle(); |
| 738 } | 738 } |
| 739 | 739 |
| 740 } // namespace | 740 } // namespace |
| 741 | 741 |
| 742 } // namespace search_provider_logos | 742 } // namespace search_provider_logos |
| OLD | NEW |