OLD | NEW |
1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_PROFILES_PROFILE_DOWNLOADER_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_DOWNLOADER_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_DOWNLOADER_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_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/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 #include "chrome/browser/image_decoder.h" | 15 #include "chrome/browser/image_decoder.h" |
| 16 #include "chrome/common/net/gaia/oauth2_access_token_consumer.h" |
16 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
18 #include "content/public/common/url_fetcher_delegate.h" | 19 #include "content/public/common/url_fetcher_delegate.h" |
19 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
20 #include "third_party/skia/include/core/SkBitmap.h" | 21 #include "third_party/skia/include/core/SkBitmap.h" |
21 #include "chrome/common/net/gaia/oauth2_access_token_consumer.h" | |
22 | 22 |
23 class ProfileDownloaderDelegate; | 23 class ProfileDownloaderDelegate; |
24 class OAuth2AccessTokenFetcher; | 24 class OAuth2AccessTokenFetcher; |
25 | 25 |
26 // Downloads user profile information. The profile picture is decoded in a | 26 // Downloads user profile information. The profile picture is decoded in a |
27 // sandboxed process. | 27 // sandboxed process. |
28 class ProfileDownloader : public content::URLFetcherDelegate, | 28 class ProfileDownloader : public content::URLFetcherDelegate, |
29 public ImageDecoder::Delegate, | 29 public ImageDecoder::Delegate, |
30 public content::NotificationObserver, | 30 public content::NotificationObserver, |
31 public OAuth2AccessTokenConsumer { | 31 public OAuth2AccessTokenConsumer { |
(...skipping 29 matching lines...) Expand all Loading... |
61 // picture is not downloaded multiple times. This value should only be used | 61 // picture is not downloaded multiple times. This value should only be used |
62 // when the picture status is PICTURE_SUCCESS. | 62 // when the picture status is PICTURE_SUCCESS. |
63 virtual std::string GetProfilePictureURL() const; | 63 virtual std::string GetProfilePictureURL() const; |
64 | 64 |
65 private: | 65 private: |
66 friend class ProfileDownloaderTest; | 66 friend class ProfileDownloaderTest; |
67 FRIEND_TEST_ALL_PREFIXES(ProfileDownloaderTest, ParseData); | 67 FRIEND_TEST_ALL_PREFIXES(ProfileDownloaderTest, ParseData); |
68 FRIEND_TEST_ALL_PREFIXES(ProfileDownloaderTest, DefaultURL); | 68 FRIEND_TEST_ALL_PREFIXES(ProfileDownloaderTest, DefaultURL); |
69 | 69 |
70 // Overriden from content::URLFetcherDelegate: | 70 // Overriden from content::URLFetcherDelegate: |
71 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; | 71 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
72 | 72 |
73 // Overriden from ImageDecoder::Delegate: | 73 // Overriden from ImageDecoder::Delegate: |
74 virtual void OnImageDecoded(const ImageDecoder* decoder, | 74 virtual void OnImageDecoded(const ImageDecoder* decoder, |
75 const SkBitmap& decoded_image) OVERRIDE; | 75 const SkBitmap& decoded_image) OVERRIDE; |
76 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; | 76 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; |
77 | 77 |
78 // Overriden from content::NotificationObserver: | 78 // Overriden from content::NotificationObserver: |
79 virtual void Observe(int type, | 79 virtual void Observe(int type, |
80 const content::NotificationSource& source, | 80 const content::NotificationSource& source, |
81 const content::NotificationDetails& details) OVERRIDE; | 81 const content::NotificationDetails& details) OVERRIDE; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 content::NotificationRegistrar registrar_; | 113 content::NotificationRegistrar registrar_; |
114 string16 profile_full_name_; | 114 string16 profile_full_name_; |
115 SkBitmap profile_picture_; | 115 SkBitmap profile_picture_; |
116 PictureStatus picture_status_; | 116 PictureStatus picture_status_; |
117 std::string picture_url_; | 117 std::string picture_url_; |
118 | 118 |
119 DISALLOW_COPY_AND_ASSIGN(ProfileDownloader); | 119 DISALLOW_COPY_AND_ASSIGN(ProfileDownloader); |
120 }; | 120 }; |
121 | 121 |
122 #endif // CHROME_BROWSER_PROFILES_PROFILE_DOWNLOADER_H_ | 122 #endif // CHROME_BROWSER_PROFILES_PROFILE_DOWNLOADER_H_ |
OLD | NEW |