OLD | NEW |
1 // Copyright (c) 2011 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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 if (source == manifest_fetcher_.get()) { | 603 if (source == manifest_fetcher_.get()) { |
604 OnManifestFetchComplete(url, status, response_code, data); | 604 OnManifestFetchComplete(url, status, response_code, data); |
605 } else if (source == extension_fetcher_.get()) { | 605 } else if (source == extension_fetcher_.get()) { |
606 OnCRXFetchComplete(url, status, response_code, data); | 606 OnCRXFetchComplete(url, status, response_code, data); |
607 } else { | 607 } else { |
608 NOTREACHED(); | 608 NOTREACHED(); |
609 } | 609 } |
610 NotifyIfFinished(); | 610 NotifyIfFinished(); |
611 } | 611 } |
612 | 612 |
| 613 void ExtensionUpdater::OnURLFetchCompleteNew( |
| 614 const URLFetcher* source, |
| 615 const GURL& url, |
| 616 const net::URLRequestStatus& status, |
| 617 int response_code, |
| 618 const ResponseCookies& cookies, |
| 619 const URLFetcher::ResponseBodyContainerInterface& response_body) { |
| 620 |
| 621 LOG(ERROR) << "================== GOTCHA ==================="; |
| 622 LOG(ERROR) << " url = "<< url.possibly_invalid_spec(); |
| 623 |
| 624 // TODO(skerner): Make a Response body class that writes directly to a file, a
nd |
| 625 // avoids use of a string. |
| 626 std::string response_data; |
| 627 CHECK(response_body.GetAsString(&response_data)); |
| 628 |
| 629 OnURLFetchComplete( |
| 630 source, url, status, response_code, cookies, response_data); |
| 631 } |
| 632 |
| 633 URLFetcher::ResponseBodyContainerInterface* |
| 634 ExtensionUpdater::CreateResponseBodyContainer() { |
| 635 // TODO(skerner): Return a class that writes response bytes to a file. |
| 636 return URLFetcher::Delegate::CreateResponseBodyContainer(); |
| 637 } |
| 638 |
613 // Utility class to handle doing xml parsing in a sandboxed utility process. | 639 // Utility class to handle doing xml parsing in a sandboxed utility process. |
614 class SafeManifestParser : public UtilityProcessHost::Client { | 640 class SafeManifestParser : public UtilityProcessHost::Client { |
615 public: | 641 public: |
616 // Takes ownership of |fetch_data|. | 642 // Takes ownership of |fetch_data|. |
617 SafeManifestParser(const std::string& xml, ManifestFetchData* fetch_data, | 643 SafeManifestParser(const std::string& xml, ManifestFetchData* fetch_data, |
618 base::WeakPtr<ExtensionUpdater> updater) | 644 base::WeakPtr<ExtensionUpdater> updater) |
619 : xml_(xml), updater_(updater) { | 645 : xml_(xml), updater_(updater) { |
620 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 646 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
621 fetch_data_.reset(fetch_data); | 647 fetch_data_.reset(fetch_data); |
622 } | 648 } |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 std::set<std::string>::const_iterator i; | 1194 std::set<std::string>::const_iterator i; |
1169 for (i = ids.begin(); i != ids.end(); ++i) | 1195 for (i = ids.begin(); i != ids.end(); ++i) |
1170 in_progress_ids_.insert(*i); | 1196 in_progress_ids_.insert(*i); |
1171 } | 1197 } |
1172 | 1198 |
1173 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { | 1199 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { |
1174 std::set<std::string>::const_iterator i; | 1200 std::set<std::string>::const_iterator i; |
1175 for (i = ids.begin(); i != ids.end(); ++i) | 1201 for (i = ids.begin(); i != ids.end(); ++i) |
1176 in_progress_ids_.erase(*i); | 1202 in_progress_ids_.erase(*i); |
1177 } | 1203 } |
OLD | NEW |