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

Side by Side Diff: chrome/browser/profiles/profile_downloader.h

Issue 8772055: Use Google Plus API to get profile information (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 9 years 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_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
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 virtual SkBitmap GetProfilePicture() const; 54 virtual SkBitmap GetProfilePicture() const;
55 55
56 // Gets the profile picture status. 56 // Gets the profile picture status.
57 virtual PictureStatus GetProfilePictureStatus() const; 57 virtual PictureStatus GetProfilePictureStatus() const;
58 58
59 // Gets the URL for the profile picture. This can be cached so that the same 59 // Gets the URL for the profile picture. This can be cached so that the same
60 // picture is not downloaded multiple times. This value should only be used 60 // picture is not downloaded multiple times. This value should only be used
61 // when the picture status is PICTURE_SUCCESS. 61 // when the picture status is PICTURE_SUCCESS.
62 virtual std::string GetProfilePictureURL() const; 62 virtual std::string GetProfilePictureURL() const;
63 63
64 // Parses the entry response and gets the name and and profile image URL.
65 // Returns false to indicate a parsing error.
66 static bool GetProfileNameAndImageURL(const std::string& data,
Ivan Korotkov 2011/12/04 15:08:52 Please document what |data| is (entry response is
sail 2011/12/05 19:26:12 Done.
67 string16* nick_name,
68 std::string* url,
69 int image_size);
Ivan Korotkov 2011/12/04 15:08:52 if this is public for testing only, consider decla
sail 2011/12/05 19:26:12 Done.
70
64 private: 71 private:
65 // Overriden from content::URLFetcherDelegate: 72 // Overriden from content::URLFetcherDelegate:
66 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; 73 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE;
67 74
68 // Overriden from ImageDecoder::Delegate: 75 // Overriden from ImageDecoder::Delegate:
69 virtual void OnImageDecoded(const ImageDecoder* decoder, 76 virtual void OnImageDecoded(const ImageDecoder* decoder,
70 const SkBitmap& decoded_image) OVERRIDE; 77 const SkBitmap& decoded_image) OVERRIDE;
71 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; 78 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE;
72 79
73 // Overriden from content::NotificationObserver: 80 // Overriden from content::NotificationObserver:
74 virtual void Observe(int type, 81 virtual void Observe(int type,
75 const content::NotificationSource& source, 82 const content::NotificationSource& source,
76 const content::NotificationDetails& details) OVERRIDE; 83 const content::NotificationDetails& details) OVERRIDE;
77 84
78 // Overriden from OAuth2AccessTokenConsumer: 85 // Overriden from OAuth2AccessTokenConsumer:
79 virtual void OnGetTokenSuccess(const std::string& access_token) OVERRIDE; 86 virtual void OnGetTokenSuccess(const std::string& access_token) OVERRIDE;
80 virtual void OnGetTokenFailure(const GoogleServiceAuthError& error) OVERRIDE; 87 virtual void OnGetTokenFailure(const GoogleServiceAuthError& error) OVERRIDE;
81 88
82 // Parses the entry response from Picasa and gets the nick name and
83 // and profile image URL. Returns false to indicate a parsing error.
84 bool GetProfileNickNameAndImageURL(const std::string& data,
85 string16* nick_name,
86 std::string* url) const;
87
88 // Returns true if the image url is url of the default profile picture. 89 // Returns true if the image url is url of the default profile picture.
89 bool IsDefaultProfileImageURL(const std::string& url) const; 90 bool IsDefaultProfileImageURL(const std::string& url) const;
90 91
91 // Issues the first request to get user profile image. 92 // Issues the first request to get user profile image.
92 void StartFetchingImage(); 93 void StartFetchingImage();
93 94
94 // Gets the authorization header. 95 // Gets the authorization header.
95 const char* GetAuthorizationHeader() const; 96 const char* GetAuthorizationHeader() const;
96 97
97 // Starts fetching OAuth2 access token. This is needed before the GAIA info 98 // Starts fetching OAuth2 access token. This is needed before the GAIA info
98 // can be downloaded. 99 // can be downloaded.
99 void StartFetchingOAuth2AccessToken(); 100 void StartFetchingOAuth2AccessToken();
100 101
101 ProfileDownloaderDelegate* delegate_; 102 ProfileDownloaderDelegate* delegate_;
102 std::string auth_token_; 103 std::string auth_token_;
103 scoped_ptr<content::URLFetcher> user_entry_fetcher_; 104 scoped_ptr<content::URLFetcher> user_entry_fetcher_;
104 scoped_ptr<content::URLFetcher> profile_image_fetcher_; 105 scoped_ptr<content::URLFetcher> profile_image_fetcher_;
105 scoped_ptr<OAuth2AccessTokenFetcher> oauth2_access_token_fetcher_; 106 scoped_ptr<OAuth2AccessTokenFetcher> oauth2_access_token_fetcher_;
106 content::NotificationRegistrar registrar_; 107 content::NotificationRegistrar registrar_;
107 string16 profile_full_name_; 108 string16 profile_full_name_;
108 SkBitmap profile_picture_; 109 SkBitmap profile_picture_;
109 PictureStatus picture_status_; 110 PictureStatus picture_status_;
110 std::string picture_url_; 111 std::string picture_url_;
111 112
112 DISALLOW_COPY_AND_ASSIGN(ProfileDownloader); 113 DISALLOW_COPY_AND_ASSIGN(ProfileDownloader);
113 }; 114 };
114 115
115 #endif // CHROME_BROWSER_PROFILES_PROFILE_DOWNLOADER_H_ 116 #endif // CHROME_BROWSER_PROFILES_PROFILE_DOWNLOADER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_downloader.cc » ('j') | chrome/browser/profiles/profile_downloader.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698