Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: chrome/browser/chromeos/login/profile_image_downloader.h

Issue 8373021: Convert URLFetcher::Delegates to use an interface in content/public/common. Also remove the old U... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync and remove unncessary forward declares Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_PROFILE_IMAGE_DOWNLOADER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_IMAGE_DOWNLOADER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_IMAGE_DOWNLOADER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_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/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/chromeos/login/image_decoder.h" 13 #include "chrome/browser/chromeos/login/image_decoder.h"
14 #include "content/common/net/url_fetcher.h"
15 #include "content/public/browser/notification_observer.h" 14 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 15 #include "content/public/browser/notification_registrar.h"
16 #include "content/public/common/url_fetcher_delegate.h"
17 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
18 18
19 namespace chromeos { 19 namespace chromeos {
20 20
21 // Downloads user profile image, decodes it in a sandboxed process. 21 // Downloads user profile image, decodes it in a sandboxed process.
22 class ProfileImageDownloader : public URLFetcher::Delegate, 22 class ProfileImageDownloader : public content::URLFetcherDelegate,
23 public ImageDecoder::Delegate, 23 public ImageDecoder::Delegate,
24 public content::NotificationObserver { 24 public content::NotificationObserver {
25 public: 25 public:
26 // Reports on success or failure of Profile image download. 26 // Reports on success or failure of Profile image download.
27 class Delegate { 27 class Delegate {
28 public: 28 public:
29 virtual ~Delegate() {} 29 virtual ~Delegate() {}
30 30
31 // Called when image is successfully downloaded and decoded. 31 // Called when image is successfully downloaded and decoded.
32 virtual void OnDownloadSuccess(const SkBitmap& image) = 0; 32 virtual void OnDownloadSuccess(const SkBitmap& image) = 0;
33 33
34 // Called on download failure. 34 // Called on download failure.
35 virtual void OnDownloadFailure() {} 35 virtual void OnDownloadFailure() {}
36 }; 36 };
37 37
38 explicit ProfileImageDownloader(Delegate* delegate); 38 explicit ProfileImageDownloader(Delegate* delegate);
39 virtual ~ProfileImageDownloader(); 39 virtual ~ProfileImageDownloader();
40 40
41 // Starts downloading the picture if the necessary authorization token is 41 // Starts downloading the picture if the necessary authorization token is
42 // ready. If not, subscribes to token service and starts fetching if the 42 // ready. If not, subscribes to token service and starts fetching if the
43 // token is available. 43 // token is available.
44 void Start(); 44 void Start();
45 45
46 private: 46 private:
47 // Overriden from URLFetcher::Delegate: 47 // Overriden from content::URLFetcherDelegate:
48 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; 48 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
49 49
50 // Overriden from ImageDecoder::Delegate: 50 // Overriden from ImageDecoder::Delegate:
51 virtual void OnImageDecoded(const ImageDecoder* decoder, 51 virtual void OnImageDecoded(const ImageDecoder* decoder,
52 const SkBitmap& decoded_image) OVERRIDE; 52 const SkBitmap& decoded_image) OVERRIDE;
53 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; 53 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE;
54 54
55 // Overriden from content::NotificationObserver: 55 // Overriden from content::NotificationObserver:
56 virtual void Observe(int type, 56 virtual void Observe(int type,
57 const content::NotificationSource& source, 57 const content::NotificationSource& source,
(...skipping 11 matching lines...) Expand all
69 scoped_ptr<URLFetcher> user_entry_fetcher_; 69 scoped_ptr<URLFetcher> user_entry_fetcher_;
70 scoped_ptr<URLFetcher> profile_image_fetcher_; 70 scoped_ptr<URLFetcher> profile_image_fetcher_;
71 content::NotificationRegistrar registrar_; 71 content::NotificationRegistrar registrar_;
72 72
73 DISALLOW_COPY_AND_ASSIGN(ProfileImageDownloader); 73 DISALLOW_COPY_AND_ASSIGN(ProfileImageDownloader);
74 }; 74 };
75 75
76 } // namespace chromeos 76 } // namespace chromeos
77 77
78 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_IMAGE_DOWNLOADER_H_ 78 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_IMAGE_DOWNLOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698