OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DOWNLOADER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DOWNLOADER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/scoped_ptr.h" |
| 12 #include "chrome/browser/chromeos/login/image_decoder.h" |
| 13 #include "chrome/common/net/url_fetcher.h" |
| 14 #include "googleurl/src/gurl.h" |
| 15 |
| 16 namespace chromeos { |
| 17 |
| 18 // Downloads the image, decodes it in a sandboxed process. |
| 19 // This objects deletes itself after OnURLFetchComplete. |
| 20 class ImageDownloader : public URLFetcher::Delegate { |
| 21 public: |
| 22 // Starts downloading the picture. Optional auth_token could be passed. |
| 23 // Object is deleted as reference counted object. |
| 24 ImageDownloader(ImageDecoder::Delegate* delegate, |
| 25 const GURL& image_url, |
| 26 const std::string& auth_token); |
| 27 virtual ~ImageDownloader() {} |
| 28 |
| 29 private: |
| 30 // Overriden from URLFetcher::Delegate: |
| 31 virtual void OnURLFetchComplete(const URLFetcher* source, |
| 32 const GURL& url, |
| 33 const URLRequestStatus& status, |
| 34 int response_code, |
| 35 const ResponseCookies& cookies, |
| 36 const std::string& data); |
| 37 |
| 38 ImageDecoder::Delegate* delegate_; |
| 39 scoped_ptr<URLFetcher> image_fetcher_; |
| 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(ImageDownloader); |
| 42 }; |
| 43 |
| 44 } // namespace chromeos |
| 45 |
| 46 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DOWNLOADER_H_ |
OLD | NEW |