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

Side by Side Diff: chrome/browser/supervised_user/experimental/supervised_user_async_url_checker.cc

Issue 1117703002: Adjust URLFetcher::Create API so that object is returned as scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded Pass() calls Created 5 years, 7 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
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 "chrome/browser/supervised_user/experimental/supervised_user_async_url_ checker.h" 5 #include "chrome/browser/supervised_user/experimental/supervised_user_async_url_ checker.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // specified, enables SafeSearch for this request. 80 // specified, enables SafeSearch for this request.
81 scoped_ptr<net::URLFetcher> CreateFetcher( 81 scoped_ptr<net::URLFetcher> CreateFetcher(
82 URLFetcherDelegate* delegate, 82 URLFetcherDelegate* delegate,
83 URLRequestContextGetter* context, 83 URLRequestContextGetter* context,
84 const std::string& api_key, 84 const std::string& api_key,
85 const GURL& url, 85 const GURL& url,
86 bool safe) { 86 bool safe) {
87 const int kSafeId = 0; 87 const int kSafeId = 0;
88 const int kUnsafeId = 1; 88 const int kUnsafeId = 1;
89 int id = safe ? kSafeId : kUnsafeId; 89 int id = safe ? kSafeId : kUnsafeId;
90 scoped_ptr<net::URLFetcher> fetcher(URLFetcher::Create( 90 scoped_ptr<net::URLFetcher> fetcher = URLFetcher::Create(
91 id, BuildSearchURL(api_key, url, safe), URLFetcher::GET, delegate)); 91 id, BuildSearchURL(api_key, url, safe), URLFetcher::GET, delegate);
92 fetcher->SetRequestContext(context); 92 fetcher->SetRequestContext(context);
93 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 93 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
94 net::LOAD_DO_NOT_SAVE_COOKIES); 94 net::LOAD_DO_NOT_SAVE_COOKIES);
95 return fetcher.Pass(); 95 return fetcher.Pass();
96 } 96 }
97 97
98 // Checks whether the search |response| (in JSON format) contains an entry for 98 // Checks whether the search |response| (in JSON format) contains an entry for
99 // the given |url|. 99 // the given |url|.
100 bool ResponseContainsURL(const std::string& response, const GURL& url) { 100 bool ResponseContainsURL(const std::string& response, const GURL& url) {
101 scoped_ptr<base::Value> value(base::JSONReader::Read(response)); 101 scoped_ptr<base::Value> value(base::JSONReader::Read(response));
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 313
314 UMA_HISTOGRAM_TIMES("ManagedUsers.SafeSitesDelay", 314 UMA_HISTOGRAM_TIMES("ManagedUsers.SafeSitesDelay",
315 base::Time::Now() - check->start_time); 315 base::Time::Now() - check->start_time);
316 316
317 cache_.Put(check->url, CheckResult(behavior, uncertain)); 317 cache_.Put(check->url, CheckResult(behavior, uncertain));
318 318
319 for (size_t i = 0; i < check->callbacks.size(); i++) 319 for (size_t i = 0; i < check->callbacks.size(); i++)
320 check->callbacks[i].Run(check->url, behavior, uncertain); 320 check->callbacks[i].Run(check->url, behavior, uncertain);
321 checks_in_progress_.erase(it); 321 checks_in_progress_.erase(it);
322 } 322 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698