| 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 VLOG(2) << "will try to update " << id; | 535 VLOG(2) << "will try to update " << id; |
| 536 result->push_back(i); | 536 result->push_back(i); |
| 537 } | 537 } |
| 538 } | 538 } |
| 539 | 539 |
| 540 // Begins (or queues up) download of an updated extension. | 540 // Begins (or queues up) download of an updated extension. |
| 541 void ExtensionDownloader::FetchUpdatedExtension(const std::string& id, | 541 void ExtensionDownloader::FetchUpdatedExtension(const std::string& id, |
| 542 const GURL& url, | 542 const GURL& url, |
| 543 const std::string& hash, | 543 const std::string& hash, |
| 544 const std::string& version) { | 544 const std::string& version) { |
| 545 if (!url.is_valid()) { |
| 546 // TODO(asargent): This can sometimes be invalid. See crbug.com/130881. |
| 547 LOG(ERROR) << "Invalid URL: " << url.spec(); |
| 548 return; |
| 549 } |
| 550 |
| 545 for (std::deque<ExtensionFetch>::const_iterator iter = | 551 for (std::deque<ExtensionFetch>::const_iterator iter = |
| 546 extensions_pending_.begin(); | 552 extensions_pending_.begin(); |
| 547 iter != extensions_pending_.end(); ++iter) { | 553 iter != extensions_pending_.end(); ++iter) { |
| 548 if (iter->id == id || iter->url == url) { | 554 if (iter->id == id || iter->url == url) { |
| 549 return; // already scheduled | 555 return; // already scheduled |
| 550 } | 556 } |
| 551 } | 557 } |
| 552 | 558 |
| 553 if (extension_fetcher_.get() != NULL) { | 559 if (extension_fetcher_.get() != NULL) { |
| 554 if (extension_fetcher_->GetURL() != url) { | 560 if (extension_fetcher_->GetURL() != url) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 } | 648 } |
| 643 | 649 |
| 644 void ExtensionDownloader::NotifyUpdateFound(const std::string& id) { | 650 void ExtensionDownloader::NotifyUpdateFound(const std::string& id) { |
| 645 content::NotificationService::current()->Notify( | 651 content::NotificationService::current()->Notify( |
| 646 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, | 652 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, |
| 647 content::NotificationService::AllBrowserContextsAndSources(), | 653 content::NotificationService::AllBrowserContextsAndSources(), |
| 648 content::Details<const std::string>(&id)); | 654 content::Details<const std::string>(&id)); |
| 649 } | 655 } |
| 650 | 656 |
| 651 } // namespace extensions | 657 } // namespace extensions |
| OLD | NEW |