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

Side by Side Diff: chrome/browser/intents/cws_intents_registry.cc

Issue 10554008: Move content::URLFetcher static functions to net::URLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win link error Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/intents/cws_intents_registry.h" 5 #include "chrome/browser/intents/cws_intents_registry.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/json/json_string_value_serializer.h" 8 #include "base/json/json_string_value_serializer.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "base/string16.h" 11 #include "base/string16.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/intents/api_key.h" 13 #include "chrome/browser/intents/api_key.h"
14 #include "chrome/browser/net/chrome_url_request_context.h" 14 #include "chrome/browser/net/chrome_url_request_context.h"
15 #include "chrome/browser/webdata/web_data_service.h" 15 #include "chrome/browser/webdata/web_data_service.h"
16 #include "chrome/common/net/url_util.h" 16 #include "chrome/common/net/url_util.h"
17 #include "content/public/common/url_fetcher.h"
18 #include "net/base/load_flags.h" 17 #include "net/base/load_flags.h"
19 #include "net/base/mime_util.h" 18 #include "net/base/mime_util.h"
19 #include "net/url_request/url_fetcher.h"
20 20
21 namespace { 21 namespace {
22 22
23 // Limit for the number of suggestions we fix from CWS. Ideally, the registry 23 // Limit for the number of suggestions we fix from CWS. Ideally, the registry
24 // simply get all of them, but there is a) chunking on the CWS side, and b) 24 // simply get all of them, but there is a) chunking on the CWS side, and b)
25 // there is a cost with suggestions fetched. (Network overhead for favicons, 25 // there is a cost with suggestions fetched. (Network overhead for favicons,
26 // roundtrips to registry to check if installed). 26 // roundtrips to registry to check if installed).
27 // 27 //
28 // Since the picker limits the number of suggestions displayed to 5, 15 means 28 // Since the picker limits the number of suggestions displayed to 5, 15 means
29 // the suggestion list only has the potential to be shorter than that once the 29 // the suggestion list only has the potential to be shorter than that once the
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 if (!query->callback.is_null()) 154 if (!query->callback.is_null())
155 query->callback.Run(intents); 155 query->callback.Run(intents);
156 } 156 }
157 157
158 void CWSIntentsRegistry::GetIntentServices(const string16& action, 158 void CWSIntentsRegistry::GetIntentServices(const string16& action,
159 const string16& mimetype, 159 const string16& mimetype,
160 const ResultsCallback& cb) { 160 const ResultsCallback& cb) {
161 scoped_ptr<IntentsQuery> query(new IntentsQuery); 161 scoped_ptr<IntentsQuery> query(new IntentsQuery);
162 query->callback = cb; 162 query->callback = cb;
163 query->url_fetcher.reset(content::URLFetcher::Create( 163 query->url_fetcher.reset(net::URLFetcher::Create(
164 0, BuildQueryURL(action,mimetype), net::URLFetcher::GET, this)); 164 0, BuildQueryURL(action,mimetype), net::URLFetcher::GET, this));
165 165
166 if (query->url_fetcher.get() == NULL) 166 if (query->url_fetcher.get() == NULL)
167 return; 167 return;
168 168
169 query->url_fetcher->SetRequestContext(request_context_); 169 query->url_fetcher->SetRequestContext(request_context_);
170 query->url_fetcher->SetLoadFlags( 170 query->url_fetcher->SetLoadFlags(
171 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); 171 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES);
172 172
173 URLFetcherHandle handle = reinterpret_cast<URLFetcherHandle>( 173 URLFetcherHandle handle = reinterpret_cast<URLFetcherHandle>(
(...skipping 14 matching lines...) Expand all
188 "0"); 188 "0");
189 request = chrome_common_net::AppendQueryParameter(request, "num_results", 189 request = chrome_common_net::AppendQueryParameter(request, "num_results",
190 kMaxSuggestions); 190 kMaxSuggestions);
191 if (web_intents::kApiKey[0]) { 191 if (web_intents::kApiKey[0]) {
192 request = chrome_common_net::AppendQueryParameter(request, "key", 192 request = chrome_common_net::AppendQueryParameter(request, "key",
193 web_intents::kApiKey); 193 web_intents::kApiKey);
194 } 194 }
195 195
196 return request; 196 return request;
197 } 197 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/toolbar_importer.cc ('k') | chrome/browser/intranet_redirect_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698