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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DOWNLOADER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DOWNLOADER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DOWNLOADER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DOWNLOADER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "chrome/browser/image_decoder.h" | 14 #include "chrome/browser/image_decoder.h" |
14 #include "content/public/common/url_fetcher_delegate.h" | 15 #include "content/public/common/url_fetcher_delegate.h" |
15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
16 | 17 |
17 namespace chromeos { | 18 namespace chromeos { |
18 | 19 |
19 // Downloads the image, decodes it in a sandboxed process. | 20 // Downloads the image, decodes it in a sandboxed process. |
20 // This objects deletes itself after OnURLFetchComplete. | 21 // This objects deletes itself after OnURLFetchComplete. |
21 class ImageDownloader : public content::URLFetcherDelegate { | 22 class ImageDownloader : public content::URLFetcherDelegate { |
22 public: | 23 public: |
23 // Starts downloading the picture. Optional auth_token could be passed. | 24 // Starts downloading the picture. Optional auth_token could be passed. |
24 // Object is deleted as reference counted object. | 25 // Object is deleted as reference counted object. |
25 ImageDownloader(ImageDecoder::Delegate* delegate, | 26 ImageDownloader(ImageDecoder::Delegate* delegate, |
26 const GURL& image_url, | 27 const GURL& image_url, |
27 const std::string& auth_token); | 28 const std::string& auth_token); |
28 virtual ~ImageDownloader(); | 29 virtual ~ImageDownloader(); |
29 | 30 |
30 private: | 31 private: |
31 // Overriden from content::URLFetcherDelegate: | 32 // Overriden from content::URLFetcherDelegate: |
32 virtual void OnURLFetchComplete(const content::URLFetcher* source); | 33 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; |
33 | 34 |
34 ImageDecoder::Delegate* delegate_; | 35 ImageDecoder::Delegate* delegate_; |
35 scoped_ptr<content::URLFetcher> image_fetcher_; | 36 scoped_ptr<content::URLFetcher> image_fetcher_; |
36 | 37 |
37 DISALLOW_COPY_AND_ASSIGN(ImageDownloader); | 38 DISALLOW_COPY_AND_ASSIGN(ImageDownloader); |
38 }; | 39 }; |
39 | 40 |
40 } // namespace chromeos | 41 } // namespace chromeos |
41 | 42 |
42 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DOWNLOADER_H_ | 43 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DOWNLOADER_H_ |
OLD | NEW |