| OLD | NEW |
| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(content::URLFetcher::Create( |
| 347 kManifestFetcherId, fetch_data->full_url(), content::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 |
| 357 void ExtensionDownloader::OnURLFetchComplete( | 357 void ExtensionDownloader::OnURLFetchComplete( |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 return; // already scheduled | 549 return; // already scheduled |
| 550 } | 550 } |
| 551 } | 551 } |
| 552 | 552 |
| 553 if (extension_fetcher_.get() != NULL) { | 553 if (extension_fetcher_.get() != NULL) { |
| 554 if (extension_fetcher_->GetURL() != url) { | 554 if (extension_fetcher_->GetURL() != url) { |
| 555 extensions_pending_.push_back(ExtensionFetch(id, url, hash, version)); | 555 extensions_pending_.push_back(ExtensionFetch(id, url, hash, version)); |
| 556 } | 556 } |
| 557 } else { | 557 } else { |
| 558 extension_fetcher_.reset(content::URLFetcher::Create( | 558 extension_fetcher_.reset(content::URLFetcher::Create( |
| 559 kExtensionFetcherId, url, content::URLFetcher::GET, this)); | 559 kExtensionFetcherId, url, net::URLFetcher::GET, this)); |
| 560 extension_fetcher_->SetRequestContext(request_context_); | 560 extension_fetcher_->SetRequestContext(request_context_); |
| 561 extension_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 561 extension_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 562 net::LOAD_DO_NOT_SAVE_COOKIES | | 562 net::LOAD_DO_NOT_SAVE_COOKIES | |
| 563 net::LOAD_DISABLE_CACHE); | 563 net::LOAD_DISABLE_CACHE); |
| 564 // Download CRX files to a temp file. The blacklist is small and will be | 564 // Download CRX files to a temp file. The blacklist is small and will be |
| 565 // processed in memory, so it is fetched into a string. | 565 // processed in memory, so it is fetched into a string. |
| 566 if (id != kBlacklistAppID) { | 566 if (id != kBlacklistAppID) { |
| 567 extension_fetcher_->SaveResponseToTemporaryFile( | 567 extension_fetcher_->SaveResponseToTemporaryFile( |
| 568 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 568 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
| 569 } | 569 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 } | 642 } |
| 643 | 643 |
| 644 void ExtensionDownloader::NotifyUpdateFound(const std::string& id) { | 644 void ExtensionDownloader::NotifyUpdateFound(const std::string& id) { |
| 645 content::NotificationService::current()->Notify( | 645 content::NotificationService::current()->Notify( |
| 646 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, | 646 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, |
| 647 content::NotificationService::AllBrowserContextsAndSources(), | 647 content::NotificationService::AllBrowserContextsAndSources(), |
| 648 content::Details<const std::string>(&id)); | 648 content::Details<const std::string>(&id)); |
| 649 } | 649 } |
| 650 | 650 |
| 651 } // namespace extensions | 651 } // namespace extensions |
| OLD | NEW |