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

Side by Side Diff: chrome/browser/extensions/extension_updater.cc

Issue 6166010: net: Remove typedef net::URLRequestStatus URLRequestStatus; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extension_updater.h" 5 #include "chrome/browser/extensions/extension_updater.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 prefs_ = NULL; 456 prefs_ = NULL;
457 timer_.Stop(); 457 timer_.Stop();
458 manifest_fetcher_.reset(); 458 manifest_fetcher_.reset();
459 extension_fetcher_.reset(); 459 extension_fetcher_.reset();
460 STLDeleteElements(&manifests_pending_); 460 STLDeleteElements(&manifests_pending_);
461 manifests_pending_.clear(); 461 manifests_pending_.clear();
462 extensions_pending_.clear(); 462 extensions_pending_.clear();
463 } 463 }
464 464
465 void ExtensionUpdater::OnURLFetchComplete( 465 void ExtensionUpdater::OnURLFetchComplete(
466 const URLFetcher* source, const GURL& url, const URLRequestStatus& status, 466 const URLFetcher* source,
467 int response_code, const ResponseCookies& cookies, 467 const GURL& url,
468 const net::URLRequestStatus& status,
469 int response_code,
470 const ResponseCookies& cookies,
468 const std::string& data) { 471 const std::string& data) {
469 // Stop() destroys all our URLFetchers, which means we shouldn't be 472 // Stop() destroys all our URLFetchers, which means we shouldn't be
470 // called after Stop() is called. 473 // called after Stop() is called.
471 DCHECK(alive_); 474 DCHECK(alive_);
472 475
473 if (source == manifest_fetcher_.get()) { 476 if (source == manifest_fetcher_.get()) {
474 OnManifestFetchComplete(url, status, response_code, data); 477 OnManifestFetchComplete(url, status, response_code, data);
475 } else if (source == extension_fetcher_.get()) { 478 } else if (source == extension_fetcher_.get()) {
476 OnCRXFetchComplete(url, status, response_code, data); 479 OnCRXFetchComplete(url, status, response_code, data);
477 } else { 480 } else {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 private: 549 private:
547 ~SafeManifestParser() {} 550 ~SafeManifestParser() {}
548 551
549 const std::string& xml_; 552 const std::string& xml_;
550 scoped_ptr<ManifestFetchData> fetch_data_; 553 scoped_ptr<ManifestFetchData> fetch_data_;
551 554
552 scoped_refptr<ExtensionUpdater> updater_; 555 scoped_refptr<ExtensionUpdater> updater_;
553 }; 556 };
554 557
555 558
556 void ExtensionUpdater::OnManifestFetchComplete(const GURL& url, 559 void ExtensionUpdater::OnManifestFetchComplete(
557 const URLRequestStatus& status, 560 const GURL& url,
558 int response_code, 561 const net::URLRequestStatus& status,
559 const std::string& data) { 562 int response_code,
563 const std::string& data) {
560 // We want to try parsing the manifest, and if it indicates updates are 564 // We want to try parsing the manifest, and if it indicates updates are
561 // available, we want to fire off requests to fetch those updates. 565 // available, we want to fire off requests to fetch those updates.
562 if (status.status() == URLRequestStatus::SUCCESS && response_code == 200) { 566 if ((status.status() == net::URLRequestStatus::SUCCESS) &&
567 (response_code == 200)) {
563 scoped_refptr<SafeManifestParser> safe_parser( 568 scoped_refptr<SafeManifestParser> safe_parser(
564 new SafeManifestParser(data, current_manifest_fetch_.release(), this)); 569 new SafeManifestParser(data, current_manifest_fetch_.release(), this));
565 safe_parser->Start(); 570 safe_parser->Start();
566 } else { 571 } else {
567 // TODO(asargent) Do exponential backoff here. (http://crbug.com/12546). 572 // TODO(asargent) Do exponential backoff here. (http://crbug.com/12546).
568 VLOG(1) << "Failed to fetch manifest '" << url.possibly_invalid_spec() 573 VLOG(1) << "Failed to fetch manifest '" << url.possibly_invalid_spec()
569 << "' response code:" << response_code; 574 << "' response code:" << response_code;
570 } 575 }
571 manifest_fetcher_.reset(); 576 manifest_fetcher_.reset();
572 current_manifest_fetch_.reset(); 577 current_manifest_fetch_.reset();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 // Tell ExtensionService to update prefs. 641 // Tell ExtensionService to update prefs.
637 service_->UpdateExtensionBlacklist(blacklist); 642 service_->UpdateExtensionBlacklist(blacklist);
638 643
639 // Update the pref value for blacklist version 644 // Update the pref value for blacklist version
640 prefs_->SetString(kExtensionBlacklistUpdateVersion, 645 prefs_->SetString(kExtensionBlacklistUpdateVersion,
641 current_extension_fetch_.version); 646 current_extension_fetch_.version);
642 prefs_->ScheduleSavePersistentPrefs(); 647 prefs_->ScheduleSavePersistentPrefs();
643 } 648 }
644 649
645 void ExtensionUpdater::OnCRXFetchComplete(const GURL& url, 650 void ExtensionUpdater::OnCRXFetchComplete(const GURL& url,
646 const URLRequestStatus& status, 651 const net::URLRequestStatus& status,
647 int response_code, 652 int response_code,
648 const std::string& data) { 653 const std::string& data) {
649 if (status.status() == URLRequestStatus::SUCCESS && 654 if (status.status() == net::URLRequestStatus::SUCCESS &&
650 response_code == 200) { 655 response_code == 200) {
651 if (current_extension_fetch_.id == kBlacklistAppID) { 656 if (current_extension_fetch_.id == kBlacklistAppID) {
652 ProcessBlacklist(data); 657 ProcessBlacklist(data);
653 } else { 658 } else {
654 // Successfully fetched - now write crx to a file so we can have the 659 // Successfully fetched - now write crx to a file so we can have the
655 // ExtensionService install it. 660 // ExtensionService install it.
656 BrowserThread::PostTask( 661 BrowserThread::PostTask(
657 BrowserThread::FILE, FROM_HERE, 662 BrowserThread::FILE, FROM_HERE,
658 NewRunnableMethod( 663 NewRunnableMethod(
659 file_handler_.get(), &ExtensionUpdaterFileHandler::WriteTempFile, 664 file_handler_.get(), &ExtensionUpdaterFileHandler::WriteTempFile,
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 URLFetcher::Create(kExtensionFetcherId, url, URLFetcher::GET, this)); 925 URLFetcher::Create(kExtensionFetcherId, url, URLFetcher::GET, this));
921 extension_fetcher_->set_request_context( 926 extension_fetcher_->set_request_context(
922 Profile::GetDefaultRequestContext()); 927 Profile::GetDefaultRequestContext());
923 extension_fetcher_->set_load_flags(net::LOAD_DO_NOT_SEND_COOKIES | 928 extension_fetcher_->set_load_flags(net::LOAD_DO_NOT_SEND_COOKIES |
924 net::LOAD_DO_NOT_SAVE_COOKIES | 929 net::LOAD_DO_NOT_SAVE_COOKIES |
925 net::LOAD_DISABLE_CACHE); 930 net::LOAD_DISABLE_CACHE);
926 extension_fetcher_->Start(); 931 extension_fetcher_->Start();
927 current_extension_fetch_ = ExtensionFetch(id, url, hash, version); 932 current_extension_fetch_ = ExtensionFetch(id, url, hash, version);
928 } 933 }
929 } 934 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/filebrowse_ui.cc ('k') | chrome/browser/extensions/extension_updater_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698