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

Unified Diff: chrome/browser/ui/webui/options/chromeos/user_image_source.cc

Issue 395133002: Clean up. Experimental user avatars removed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Libvpx update. Created 6 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/user_image_source.h ('k') | components/user_manager/user.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/chromeos/user_image_source.cc
diff --git a/chrome/browser/ui/webui/options/chromeos/user_image_source.cc b/chrome/browser/ui/webui/options/chromeos/user_image_source.cc
index a5c0a62b9ea29ca27b415d9ca6e5e6124ed329ff..54b1b46c81672fba5a64d2e328b2d7174d6546d1 100644
--- a/chrome/browser/ui/webui/options/chromeos/user_image_source.cc
+++ b/chrome/browser/ui/webui/options/chromeos/user_image_source.cc
@@ -19,31 +19,15 @@
namespace {
-// Animated key is used in user image URL requests to specify that
-// animated version of user image is required. Without that key
-// non-animated version of user image should be returned.
-const char kKeyAnimated[] = "animated";
-
// Parses the user image URL, which looks like
// "chrome://userimage/user@host?key1=value1&...&key_n=value_n",
-// to user email and optional parameters.
+// to user email.
void ParseRequest(const GURL& url,
- std::string* email,
- bool* is_image_animated) {
+ std::string* email) {
DCHECK(url.is_valid());
*email = net::UnescapeURLComponent(url.path().substr(1),
(net::UnescapeRule::URL_SPECIAL_CHARS |
net::UnescapeRule::SPACES));
- std::string url_spec = url.possibly_invalid_spec();
- url::Component query = url.parsed_for_possibly_invalid_spec().query;
- url::Component key, value;
- *is_image_animated = false;
- while (ExtractQueryKeyValue(url_spec.c_str(), &query, &key, &value)) {
- if (url_spec.substr(key.begin, key.len) == kKeyAnimated) {
- *is_image_animated = true;
- break;
- }
- }
}
} // namespace
@@ -53,14 +37,11 @@ namespace options {
base::RefCountedMemory* UserImageSource::GetUserImage(
const std::string& email,
- bool is_image_animated,
ui::ScaleFactor scale_factor) const {
const user_manager::User* user =
chromeos::UserManager::Get()->FindUser(email);
if (user) {
- if (user->has_animated_image() && is_image_animated) {
- return new base::RefCountedBytes(user->animated_image());
- } else if (user->has_raw_image()) {
+ if (user->has_raw_image()) {
return new base::RefCountedBytes(user->raw_image());
} else if (user->image_is_stub()) {
return ResourceBundle::GetSharedInstance().
@@ -94,27 +75,14 @@ void UserImageSource::StartDataRequest(
int render_frame_id,
const content::URLDataSource::GotDataCallback& callback) {
std::string email;
- bool is_image_animated = false;
GURL url(chrome::kChromeUIUserImageURL + path);
- ParseRequest(url, &email, &is_image_animated);
- callback.Run(GetUserImage(email, is_image_animated, ui::SCALE_FACTOR_100P));
+ ParseRequest(url, &email);
+ callback.Run(GetUserImage(email, ui::SCALE_FACTOR_100P));
}
std::string UserImageSource::GetMimeType(const std::string& path) const {
// We need to explicitly return a mime type, otherwise if the user tries to
// drag the image they get no extension.
- std::string email;
- bool is_image_animated = false;
-
- GURL url(chrome::kChromeUIUserImageURL + path);
- ParseRequest(url, &email, &is_image_animated);
-
- if (is_image_animated) {
- const user_manager::User* user =
- chromeos::UserManager::Get()->FindUser(email);
- if (user && user->has_animated_image())
- return "image/gif";
- }
return "image/png";
}
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/user_image_source.h ('k') | components/user_manager/user.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698