Chromium Code Reviews| Index: chrome/browser/prerender/prerender_local_predictor.cc |
| diff --git a/chrome/browser/prerender/prerender_local_predictor.cc b/chrome/browser/prerender/prerender_local_predictor.cc |
| index 7f6a25b9d8e31a14df0a80cdc4d40bc56069214c..9821d267bb052a2af80db526c49d2b0415c6df7e 100644 |
| --- a/chrome/browser/prerender/prerender_local_predictor.cc |
| +++ b/chrome/browser/prerender/prerender_local_predictor.cc |
| @@ -839,9 +839,12 @@ bool PrerenderLocalPredictor::ApplyParsedPrerenderServiceResponse( |
| if (!list->GetDictionary(i, &d)) |
| return false; |
| string url; |
| + if (!d->GetString("url", &url) || !GURL(url).is_valid()) { |
|
sky
2014/07/15 04:22:24
nit: no {}
Peter Kasting
2014/07/15 18:56:07
Done.
|
| + return false; |
| + } |
| double priority; |
| - if (!d->GetString("url", &url) || !d->GetDouble("likelihood", &priority) |
| - || !GURL(url).is_valid()) { |
| + if (!d->GetDouble("likelihood", &priority) || priority < 0.0 || |
| + priority > 1.0) { |
| return false; |
| } |
| int in_index_timed_out = 0; |
| @@ -851,8 +854,8 @@ bool PrerenderLocalPredictor::ApplyParsedPrerenderServiceResponse( |
| !d->GetInteger("in_index", &in_index)) { |
| return false; |
| } |
| - if (priority < 0.0 || priority > 1.0 || in_index < 0 || in_index > 1 || |
| - in_index_timed_out < 0 || in_index_timed_out > 1) { |
| + if (in_index < 0 || in_index > 1 || in_index_timed_out < 0 || |
| + in_index_timed_out > 1) { |
| return false; |
| } |
| if (in_index_timed_out == 1) |
| @@ -860,7 +863,7 @@ bool PrerenderLocalPredictor::ApplyParsedPrerenderServiceResponse( |
| info->MaybeAddCandidateURLFromService(GURL(url), |
| priority, |
| in_index == 1, |
| - (1 - in_index_timed_out) == 1); |
| + !in_index_timed_out); |
| } |
| if (list->GetSize() > 0) |
| RecordEvent(EVENT_PRERENDER_SERIVCE_RETURNED_HINTING_CANDIDATES); |