Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(671)

Side by Side Diff: components/search_provider_logos/google_logo_api.cc

Issue 1551433002: Switch to standard integer types in components/, part 3 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/search_engines/util.cc ('k') | components/search_provider_logos/logo_cache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/google_logo_api.h" 5 #include "components/search_provider_logos/google_logo_api.h"
6 6
7 #include <stdint.h>
8
7 #include <algorithm> 9 #include <algorithm>
8 10
9 #include "base/base64.h" 11 #include "base/base64.h"
10 #include "base/json/json_reader.h" 12 #include "base/json/json_reader.h"
11 #include "base/memory/ref_counted_memory.h" 13 #include "base/memory/ref_counted_memory.h"
12 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
13 #include "base/values.h" 15 #include "base/values.h"
14 16
15 namespace search_provider_logos { 17 namespace search_provider_logos {
16 18
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 logo_dict->GetString("alt", &logo->metadata.alt_text); 113 logo_dict->GetString("alt", &logo->metadata.alt_text);
112 114
113 // Existance of url indicates |data| is a call to action image for an 115 // Existance of url indicates |data| is a call to action image for an
114 // animated doodle. |url| points to that animated doodle. 116 // animated doodle. |url| points to that animated doodle.
115 logo_dict->GetString("url", &logo->metadata.animated_url); 117 logo_dict->GetString("url", &logo->metadata.animated_url);
116 118
117 base::TimeDelta time_to_live; 119 base::TimeDelta time_to_live;
118 int time_to_live_ms; 120 int time_to_live_ms;
119 if (logo_dict->GetInteger("time_to_live", &time_to_live_ms)) { 121 if (logo_dict->GetInteger("time_to_live", &time_to_live_ms)) {
120 time_to_live = base::TimeDelta::FromMilliseconds( 122 time_to_live = base::TimeDelta::FromMilliseconds(
121 std::min(static_cast<int64>(time_to_live_ms), kMaxTimeToLiveMS)); 123 std::min(static_cast<int64_t>(time_to_live_ms), kMaxTimeToLiveMS));
122 logo->metadata.can_show_after_expiration = false; 124 logo->metadata.can_show_after_expiration = false;
123 } else { 125 } else {
124 time_to_live = base::TimeDelta::FromMilliseconds(kMaxTimeToLiveMS); 126 time_to_live = base::TimeDelta::FromMilliseconds(kMaxTimeToLiveMS);
125 logo->metadata.can_show_after_expiration = true; 127 logo->metadata.can_show_after_expiration = true;
126 } 128 }
127 logo->metadata.expiration_time = response_time + time_to_live; 129 logo->metadata.expiration_time = response_time + time_to_live;
128 130
129 // If this point is reached, parsing has succeeded. 131 // If this point is reached, parsing has succeeded.
130 *parsing_failed = false; 132 *parsing_failed = false;
131 return logo.Pass(); 133 return logo.Pass();
132 } 134 }
133 135
134 } // namespace search_provider_logos 136 } // namespace search_provider_logos
OLDNEW
« no previous file with comments | « components/search_engines/util.cc ('k') | components/search_provider_logos/logo_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698