| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/extensions/extensions_service.h" | 21 #include "chrome/browser/extensions/extensions_service.h" |
| 22 #include "chrome/browser/profile.h" | 22 #include "chrome/browser/profile.h" |
| 23 #include "chrome/browser/utility_process_host.h" | 23 #include "chrome/browser/utility_process_host.h" |
| 24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/extensions/extension.h" | 25 #include "chrome/common/extensions/extension.h" |
| 26 #include "chrome/common/extensions/extension_error_reporter.h" | 26 #include "chrome/common/extensions/extension_error_reporter.h" |
| 27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/common/pref_service.h" | 28 #include "chrome/common/pref_service.h" |
| 29 #include "googleurl/src/gurl.h" | 29 #include "googleurl/src/gurl.h" |
| 30 #include "net/base/escape.h" | 30 #include "net/base/escape.h" |
| 31 #include "net/base/load_flags.h" |
| 31 #include "net/url_request/url_request_status.h" | 32 #include "net/url_request/url_request_status.h" |
| 32 | 33 |
| 33 using base::RandDouble; | 34 using base::RandDouble; |
| 34 using base::RandInt; | 35 using base::RandInt; |
| 35 using base::Time; | 36 using base::Time; |
| 36 using base::TimeDelta; | 37 using base::TimeDelta; |
| 37 using prefs::kExtensionBlacklistUpdateVersion; | 38 using prefs::kExtensionBlacklistUpdateVersion; |
| 38 using prefs::kLastExtensionsUpdateCheck; | 39 using prefs::kLastExtensionsUpdateCheck; |
| 39 using prefs::kNextExtensionsUpdateCheck; | 40 using prefs::kNextExtensionsUpdateCheck; |
| 40 | 41 |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 } | 594 } |
| 594 | 595 |
| 595 if (manifest_fetcher_.get() != NULL) { | 596 if (manifest_fetcher_.get() != NULL) { |
| 596 if (manifest_fetcher_->url() != url) { | 597 if (manifest_fetcher_->url() != url) { |
| 597 manifests_pending_.push_back(url); | 598 manifests_pending_.push_back(url); |
| 598 } | 599 } |
| 599 } else { | 600 } else { |
| 600 manifest_fetcher_.reset( | 601 manifest_fetcher_.reset( |
| 601 URLFetcher::Create(kManifestFetcherId, url, URLFetcher::GET, this)); | 602 URLFetcher::Create(kManifestFetcherId, url, URLFetcher::GET, this)); |
| 602 manifest_fetcher_->set_request_context(Profile::GetDefaultRequestContext()); | 603 manifest_fetcher_->set_request_context(Profile::GetDefaultRequestContext()); |
| 604 manifest_fetcher_->set_load_flags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 605 net::LOAD_DO_NOT_SAVE_COOKIES); |
| 603 manifest_fetcher_->Start(); | 606 manifest_fetcher_->Start(); |
| 604 } | 607 } |
| 605 } | 608 } |
| 606 | 609 |
| 607 void ExtensionUpdater::FetchUpdatedExtension(const std::string& id, | 610 void ExtensionUpdater::FetchUpdatedExtension(const std::string& id, |
| 608 const GURL& url, | 611 const GURL& url, |
| 609 const std::string& hash, | 612 const std::string& hash, |
| 610 const std::string& version) { | 613 const std::string& version) { |
| 611 for (std::deque<ExtensionFetch>::const_iterator iter = | 614 for (std::deque<ExtensionFetch>::const_iterator iter = |
| 612 extensions_pending_.begin(); | 615 extensions_pending_.begin(); |
| 613 iter != extensions_pending_.end(); ++iter) { | 616 iter != extensions_pending_.end(); ++iter) { |
| 614 if (iter->id == id || iter->url == url) { | 617 if (iter->id == id || iter->url == url) { |
| 615 return; // already scheduled | 618 return; // already scheduled |
| 616 } | 619 } |
| 617 } | 620 } |
| 618 | 621 |
| 619 if (extension_fetcher_.get() != NULL) { | 622 if (extension_fetcher_.get() != NULL) { |
| 620 if (extension_fetcher_->url() != url) { | 623 if (extension_fetcher_->url() != url) { |
| 621 extensions_pending_.push_back(ExtensionFetch(id, url, hash, version)); | 624 extensions_pending_.push_back(ExtensionFetch(id, url, hash, version)); |
| 622 } | 625 } |
| 623 } else { | 626 } else { |
| 624 extension_fetcher_.reset( | 627 extension_fetcher_.reset( |
| 625 URLFetcher::Create(kExtensionFetcherId, url, URLFetcher::GET, this)); | 628 URLFetcher::Create(kExtensionFetcherId, url, URLFetcher::GET, this)); |
| 626 extension_fetcher_->set_request_context( | 629 extension_fetcher_->set_request_context( |
| 627 Profile::GetDefaultRequestContext()); | 630 Profile::GetDefaultRequestContext()); |
| 631 extension_fetcher_->set_load_flags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 632 net::LOAD_DO_NOT_SAVE_COOKIES); |
| 628 extension_fetcher_->Start(); | 633 extension_fetcher_->Start(); |
| 629 current_extension_fetch_ = ExtensionFetch(id, url, hash, version); | 634 current_extension_fetch_ = ExtensionFetch(id, url, hash, version); |
| 630 } | 635 } |
| 631 } | 636 } |
| OLD | NEW |