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

Side by Side Diff: chrome/browser/component_updater/component_updater_service.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/component_updater/component_updater_service.h" 5 #include "chrome/browser/component_updater/component_updater_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 10 matching lines...) Expand all
21 #include "base/timer.h" 21 #include "base/timer.h"
22 #include "chrome/browser/browser_process.h" 22 #include "chrome/browser/browser_process.h"
23 #include "chrome/browser/component_updater/component_unpacker.h" 23 #include "chrome/browser/component_updater/component_unpacker.h"
24 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
25 #include "chrome/common/chrome_utility_messages.h" 25 #include "chrome/common/chrome_utility_messages.h"
26 #include "chrome/common/chrome_version_info.h" 26 #include "chrome/common/chrome_version_info.h"
27 #include "chrome/common/extensions/extension.h" 27 #include "chrome/common/extensions/extension.h"
28 #include "content/public/browser/notification_service.h" 28 #include "content/public/browser/notification_service.h"
29 #include "content/public/browser/utility_process_host.h" 29 #include "content/public/browser/utility_process_host.h"
30 #include "content/public/browser/utility_process_host_client.h" 30 #include "content/public/browser/utility_process_host_client.h"
31 #include "content/public/common/url_fetcher.h"
32 #include "googleurl/src/gurl.h" 31 #include "googleurl/src/gurl.h"
33 #include "net/base/escape.h" 32 #include "net/base/escape.h"
34 #include "net/base/load_flags.h" 33 #include "net/base/load_flags.h"
34 #include "net/url_request/url_fetcher.h"
35 #include "net/url_request/url_fetcher_delegate.h" 35 #include "net/url_request/url_fetcher_delegate.h"
36 36
37 using content::BrowserThread; 37 using content::BrowserThread;
38 using content::UtilityProcessHost; 38 using content::UtilityProcessHost;
39 using content::UtilityProcessHostClient; 39 using content::UtilityProcessHostClient;
40 using extensions::Extension; 40 using extensions::Extension;
41 41
42 // The component updater is designed to live until process shutdown, so 42 // The component updater is designed to live until process shutdown, so
43 // base::Bind() calls are not refcounted. 43 // base::Bind() calls are not refcounted.
44 44
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 it != work_items_.end(); ++it) { 499 it != work_items_.end(); ++it) {
500 CrxUpdateItem* item = *it; 500 CrxUpdateItem* item = *it;
501 if (item->status != CrxUpdateItem::kCanUpdate) 501 if (item->status != CrxUpdateItem::kCanUpdate)
502 continue; 502 continue;
503 // Found component to update, start the process. 503 // Found component to update, start the process.
504 item->status = CrxUpdateItem::kDownloading; 504 item->status = CrxUpdateItem::kDownloading;
505 CRXContext* context = new CRXContext; 505 CRXContext* context = new CRXContext;
506 context->pk_hash = item->component.pk_hash; 506 context->pk_hash = item->component.pk_hash;
507 context->id = item->id; 507 context->id = item->id;
508 context->installer = item->component.installer; 508 context->installer = item->component.installer;
509 url_fetcher_.reset(content::URLFetcher::Create( 509 url_fetcher_.reset(net::URLFetcher::Create(
510 0, item->crx_url, net::URLFetcher::GET, 510 0, item->crx_url, net::URLFetcher::GET,
511 MakeContextDelegate(this, context))); 511 MakeContextDelegate(this, context)));
512 StartFetch(url_fetcher_.get(), config_->RequestContext(), true); 512 StartFetch(url_fetcher_.get(), config_->RequestContext(), true);
513 return; 513 return;
514 } 514 }
515 515
516 std::string query; 516 std::string query;
517 // If no pending upgrades, we check the if there are new 517 // If no pending upgrades, we check the if there are new
518 // components we have not checked against the server. We 518 // components we have not checked against the server. We
519 // can batch a bunch in a single url request. 519 // can batch a bunch in a single url request.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 if (query.empty()) { 560 if (query.empty()) {
561 // Next check after the long sleep. 561 // Next check after the long sleep.
562 ScheduleNextRun(false); 562 ScheduleNextRun(false);
563 return; 563 return;
564 } 564 }
565 565
566 // We got components to check. Start the url request. 566 // We got components to check. Start the url request.
567 const std::string full_query = MakeFinalQuery(config_->UpdateUrl().spec(), 567 const std::string full_query = MakeFinalQuery(config_->UpdateUrl().spec(),
568 query, 568 query,
569 config_->ExtraRequestParams()); 569 config_->ExtraRequestParams());
570 url_fetcher_.reset(content::URLFetcher::Create( 570 url_fetcher_.reset(net::URLFetcher::Create(
571 0, GURL(full_query), net::URLFetcher::GET, 571 0, GURL(full_query), net::URLFetcher::GET,
572 MakeContextDelegate(this, new UpdateContext()))); 572 MakeContextDelegate(this, new UpdateContext())));
573 StartFetch(url_fetcher_.get(), config_->RequestContext(), false); 573 StartFetch(url_fetcher_.get(), config_->RequestContext(), false);
574 } 574 }
575 575
576 // Caled when we got a response from the update server. It consists of an xml 576 // Caled when we got a response from the update server. It consists of an xml
577 // document following the omaha update scheme. 577 // document following the omaha update scheme.
578 void CrxUpdateService::OnURLFetchComplete(const net::URLFetcher* source, 578 void CrxUpdateService::OnURLFetchComplete(const net::URLFetcher* source,
579 UpdateContext* context) { 579 UpdateContext* context) {
580 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 580 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 ScheduleNextRun(false); 769 ScheduleNextRun(false);
770 } 770 }
771 771
772 // The component update factory. Using the component updater as a singleton 772 // The component update factory. Using the component updater as a singleton
773 // is the job of the browser process. 773 // is the job of the browser process.
774 ComponentUpdateService* ComponentUpdateServiceFactory( 774 ComponentUpdateService* ComponentUpdateServiceFactory(
775 ComponentUpdateService::Configurator* config) { 775 ComponentUpdateService::Configurator* config) {
776 DCHECK(config); 776 DCHECK(config);
777 return new CrxUpdateService(config); 777 return new CrxUpdateService(config);
778 } 778 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698