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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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( |
358 const content::URLFetcher* source) { | 358 const net::URLFetcher* source) { |
359 VLOG(2) << source->GetResponseCode() << " " << source->GetURL(); | 359 VLOG(2) << source->GetResponseCode() << " " << source->GetURL(); |
360 | 360 |
361 if (source == manifest_fetcher_.get()) { | 361 if (source == manifest_fetcher_.get()) { |
362 std::string data; | 362 std::string data; |
363 source->GetResponseAsString(&data); | 363 source->GetResponseAsString(&data); |
364 OnManifestFetchComplete(source->GetURL(), | 364 OnManifestFetchComplete(source->GetURL(), |
365 source->GetStatus(), | 365 source->GetStatus(), |
366 source->GetResponseCode(), | 366 source->GetResponseCode(), |
367 data); | 367 data); |
368 } else if (source == extension_fetcher_.get()) { | 368 } else if (source == extension_fetcher_.get()) { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 } | 569 } |
570 | 570 |
571 VLOG(2) << "Starting fetch of " << url << " for " << id; | 571 VLOG(2) << "Starting fetch of " << url << " for " << id; |
572 | 572 |
573 extension_fetcher_->Start(); | 573 extension_fetcher_->Start(); |
574 current_extension_fetch_ = ExtensionFetch(id, url, hash, version); | 574 current_extension_fetch_ = ExtensionFetch(id, url, hash, version); |
575 } | 575 } |
576 } | 576 } |
577 | 577 |
578 void ExtensionDownloader::OnCRXFetchComplete( | 578 void ExtensionDownloader::OnCRXFetchComplete( |
579 const content::URLFetcher* source, | 579 const net::URLFetcher* source, |
580 const GURL& url, | 580 const GURL& url, |
581 const net::URLRequestStatus& status, | 581 const net::URLRequestStatus& status, |
582 int response_code) { | 582 int response_code) { |
583 const std::string& id = current_extension_fetch_.id; | 583 const std::string& id = current_extension_fetch_.id; |
584 const ExtensionDownloaderDelegate::PingResult& ping = ping_results_[id]; | 584 const ExtensionDownloaderDelegate::PingResult& ping = ping_results_[id]; |
585 | 585 |
586 base::PlatformFileError error_code = base::PLATFORM_FILE_OK; | 586 base::PlatformFileError error_code = base::PLATFORM_FILE_OK; |
587 if (source->FileErrorOccurred(&error_code)) { | 587 if (source->FileErrorOccurred(&error_code)) { |
588 LOG(ERROR) << "Failed to write update CRX with id " << id << ". " | 588 LOG(ERROR) << "Failed to write update CRX with id " << id << ". " |
589 << "Error code is "<< error_code; | 589 << "Error code is "<< error_code; |
(...skipping 52 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 |