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

Side by Side Diff: chrome/browser/extensions/updater/extension_downloader.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/extensions/updater/extension_downloader.h" 5 #include "chrome/browser/extensions/updater/extension_downloader.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 10 matching lines...) Expand all
21 #include "base/version.h" 21 #include "base/version.h"
22 #include "chrome/browser/extensions/updater/safe_manifest_parser.h" 22 #include "chrome/browser/extensions/updater/safe_manifest_parser.h"
23 #include "chrome/browser/metrics/metrics_service.h" 23 #include "chrome/browser/metrics/metrics_service.h"
24 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
25 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/chrome_version_info.h" 26 #include "chrome/common/chrome_version_info.h"
27 #include "chrome/common/extensions/extension_constants.h" 27 #include "chrome/common/extensions/extension_constants.h"
28 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
29 #include "content/public/browser/notification_details.h" 29 #include "content/public/browser/notification_details.h"
30 #include "content/public/browser/notification_service.h" 30 #include "content/public/browser/notification_service.h"
31 #include "content/public/common/url_fetcher.h"
32 #include "net/base/load_flags.h" 31 #include "net/base/load_flags.h"
32 #include "net/url_request/url_fetcher.h"
33 #include "net/url_request/url_request_status.h" 33 #include "net/url_request/url_request_status.h"
34 34
35 using base::Time; 35 using base::Time;
36 using base::TimeDelta; 36 using base::TimeDelta;
37 using content::BrowserThread; 37 using content::BrowserThread;
38 38
39 namespace extensions { 39 namespace extensions {
40 40
41 const char ExtensionDownloader::kBlacklistAppID[] = "com.google.crx.blacklist"; 41 const char ExtensionDownloader::kBlacklistAppID[] = "com.google.crx.blacklist";
42 42
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 fetch_data->full_url().possibly_invalid_spec().length()); 336 fetch_data->full_url().possibly_invalid_spec().length());
337 337
338 if (VLOG_IS_ON(2)) { 338 if (VLOG_IS_ON(2)) {
339 std::vector<std::string> id_vector(id_set.begin(), id_set.end()); 339 std::vector<std::string> id_vector(id_set.begin(), id_set.end());
340 std::string id_list = JoinString(id_vector, ','); 340 std::string id_list = JoinString(id_vector, ',');
341 VLOG(2) << "Fetching " << fetch_data->full_url() << " for " 341 VLOG(2) << "Fetching " << fetch_data->full_url() << " for "
342 << id_list; 342 << id_list;
343 } 343 }
344 344
345 current_manifest_fetch_.swap(scoped_fetch_data); 345 current_manifest_fetch_.swap(scoped_fetch_data);
346 manifest_fetcher_.reset(content::URLFetcher::Create( 346 manifest_fetcher_.reset(net::URLFetcher::Create(
347 kManifestFetcherId, fetch_data->full_url(), net::URLFetcher::GET, 347 kManifestFetcherId, fetch_data->full_url(), net::URLFetcher::GET,
348 this)); 348 this));
349 manifest_fetcher_->SetRequestContext(request_context_); 349 manifest_fetcher_->SetRequestContext(request_context_);
350 manifest_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 350 manifest_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
351 net::LOAD_DO_NOT_SAVE_COOKIES | 351 net::LOAD_DO_NOT_SAVE_COOKIES |
352 net::LOAD_DISABLE_CACHE); 352 net::LOAD_DISABLE_CACHE);
353 manifest_fetcher_->Start(); 353 manifest_fetcher_->Start();
354 } 354 }
355 } 355 }
356 356
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 if (iter->id == id || iter->url == url) { 555 if (iter->id == id || iter->url == url) {
556 return; // already scheduled 556 return; // already scheduled
557 } 557 }
558 } 558 }
559 559
560 if (extension_fetcher_.get() != NULL) { 560 if (extension_fetcher_.get() != NULL) {
561 if (extension_fetcher_->GetURL() != url) { 561 if (extension_fetcher_->GetURL() != url) {
562 extensions_pending_.push_back(ExtensionFetch(id, url, hash, version)); 562 extensions_pending_.push_back(ExtensionFetch(id, url, hash, version));
563 } 563 }
564 } else { 564 } else {
565 extension_fetcher_.reset(content::URLFetcher::Create( 565 extension_fetcher_.reset(net::URLFetcher::Create(
566 kExtensionFetcherId, url, net::URLFetcher::GET, this)); 566 kExtensionFetcherId, url, net::URLFetcher::GET, this));
567 extension_fetcher_->SetRequestContext(request_context_); 567 extension_fetcher_->SetRequestContext(request_context_);
568 extension_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 568 extension_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
569 net::LOAD_DO_NOT_SAVE_COOKIES | 569 net::LOAD_DO_NOT_SAVE_COOKIES |
570 net::LOAD_DISABLE_CACHE); 570 net::LOAD_DISABLE_CACHE);
571 // Download CRX files to a temp file. The blacklist is small and will be 571 // Download CRX files to a temp file. The blacklist is small and will be
572 // processed in memory, so it is fetched into a string. 572 // processed in memory, so it is fetched into a string.
573 if (id != kBlacklistAppID) { 573 if (id != kBlacklistAppID) {
574 extension_fetcher_->SaveResponseToTemporaryFile( 574 extension_fetcher_->SaveResponseToTemporaryFile(
575 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 575 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 } 649 }
650 650
651 void ExtensionDownloader::NotifyUpdateFound(const std::string& id) { 651 void ExtensionDownloader::NotifyUpdateFound(const std::string& id) {
652 content::NotificationService::current()->Notify( 652 content::NotificationService::current()->Notify(
653 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, 653 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND,
654 content::NotificationService::AllBrowserContextsAndSources(), 654 content::NotificationService::AllBrowserContextsAndSources(),
655 content::Details<const std::string>(&id)); 655 content::Details<const std::string>(&id));
656 } 656 }
657 657
658 } // namespace extensions 658 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management_browsertest.cc ('k') | chrome/browser/extensions/webstore_inline_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698