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

Side by Side Diff: chrome/browser/search_engines/template_url_fetcher.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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/search_engines/template_url_fetcher.h" 7 #include "chrome/browser/search_engines/template_url_fetcher.h"
8 8
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/search_engines/template_url.h" 12 #include "chrome/browser/search_engines/template_url.h"
13 #include "chrome/browser/search_engines/template_url_fetcher_callbacks.h" 13 #include "chrome/browser/search_engines/template_url_fetcher_callbacks.h"
14 #include "chrome/browser/search_engines/template_url_parser.h" 14 #include "chrome/browser/search_engines/template_url_parser.h"
15 #include "chrome/browser/search_engines/template_url_service.h" 15 #include "chrome/browser/search_engines/template_url_service.h"
16 #include "chrome/browser/search_engines/template_url_service_factory.h" 16 #include "chrome/browser/search_engines/template_url_service_factory.h"
17 #include "chrome/common/chrome_notification_types.h" 17 #include "chrome/common/chrome_notification_types.h"
18 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
20 #include "content/public/browser/notification_source.h" 20 #include "content/public/browser/notification_source.h"
21 #include "content/public/browser/render_process_host.h" 21 #include "content/public/browser/render_process_host.h"
22 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
23 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
24 #include "content/public/common/url_fetcher.h" 24 #include "content/public/common/url_fetcher.h"
25 #include "net/base/load_flags.h" 25 #include "net/base/load_flags.h"
26 #include "net/url_request/url_fetcher.h"
26 #include "net/url_request/url_fetcher_delegate.h" 27 #include "net/url_request/url_fetcher_delegate.h"
27 #include "net/url_request/url_request_status.h" 28 #include "net/url_request/url_request_status.h"
28 29
29 // RequestDelegate ------------------------------------------------------------ 30 // RequestDelegate ------------------------------------------------------------
30 class TemplateURLFetcher::RequestDelegate 31 class TemplateURLFetcher::RequestDelegate
31 : public net::URLFetcherDelegate, 32 : public net::URLFetcherDelegate,
32 public content::NotificationObserver { 33 public content::NotificationObserver {
33 public: 34 public:
34 // Takes ownership of |callbacks|. 35 // Takes ownership of |callbacks|.
35 RequestDelegate(TemplateURLFetcher* fetcher, 36 RequestDelegate(TemplateURLFetcher* fetcher,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 }; 79 };
79 80
80 TemplateURLFetcher::RequestDelegate::RequestDelegate( 81 TemplateURLFetcher::RequestDelegate::RequestDelegate(
81 TemplateURLFetcher* fetcher, 82 TemplateURLFetcher* fetcher,
82 const string16& keyword, 83 const string16& keyword,
83 const GURL& osdd_url, 84 const GURL& osdd_url,
84 const GURL& favicon_url, 85 const GURL& favicon_url,
85 content::WebContents* web_contents, 86 content::WebContents* web_contents,
86 TemplateURLFetcherCallbacks* callbacks, 87 TemplateURLFetcherCallbacks* callbacks,
87 ProviderType provider_type) 88 ProviderType provider_type)
88 : ALLOW_THIS_IN_INITIALIZER_LIST(url_fetcher_(content::URLFetcher::Create( 89 : ALLOW_THIS_IN_INITIALIZER_LIST(url_fetcher_(net::URLFetcher::Create(
89 osdd_url, net::URLFetcher::GET, this))), 90 osdd_url, net::URLFetcher::GET, this))),
90 fetcher_(fetcher), 91 fetcher_(fetcher),
91 keyword_(keyword), 92 keyword_(keyword),
92 osdd_url_(osdd_url), 93 osdd_url_(osdd_url),
93 favicon_url_(favicon_url), 94 favicon_url_(favicon_url),
94 provider_type_(provider_type), 95 provider_type_(provider_type),
95 callbacks_(callbacks) { 96 callbacks_(callbacks) {
96 TemplateURLService* model = TemplateURLServiceFactory::GetForProfile( 97 TemplateURLService* model = TemplateURLServiceFactory::GetForProfile(
97 fetcher_->profile()); 98 fetcher_->profile());
98 DCHECK(model); // TemplateURLFetcher::ScheduleDownload verifies this. 99 DCHECK(model); // TemplateURLFetcher::ScheduleDownload verifies this.
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 owned_callbacks.release(), provider_type)); 288 owned_callbacks.release(), provider_type));
288 } 289 }
289 290
290 void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) { 291 void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) {
291 Requests::iterator i = 292 Requests::iterator i =
292 std::find(requests_->begin(), requests_->end(), request); 293 std::find(requests_->begin(), requests_->end(), request);
293 DCHECK(i != requests_->end()); 294 DCHECK(i != requests_->end());
294 requests_->erase(i); 295 requests_->erase(i);
295 delete request; 296 delete request;
296 } 297 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_test.cc ('k') | chrome/browser/spellchecker/spellcheck_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698