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

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

Issue 13375003: Fixing iframe jank in the local omnibox popup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebuilding on 14039004. Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 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 #include "chrome/browser/ui/webui/options/chromeos/user_image_source.h" 5 #include "chrome/browser/ui/webui/options/chromeos/user_image_source.h"
6 6
7 #include "base/memory/ref_counted_memory.h" 7 #include "base/memory/ref_counted_memory.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "chrome/browser/chromeos/login/default_user_images.h" 10 #include "chrome/browser/chromeos/login/default_user_images.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 UserImageSource::~UserImageSource() {} 82 UserImageSource::~UserImageSource() {}
83 83
84 std::string UserImageSource::GetSource() const { 84 std::string UserImageSource::GetSource() const {
85 return chrome::kChromeUIUserImageHost; 85 return chrome::kChromeUIUserImageHost;
86 } 86 }
87 87
88 void UserImageSource::StartDataRequest( 88 void UserImageSource::StartDataRequest(
89 const std::string& path, 89 const std::string& path,
90 bool is_incognito, 90 int render_process_id,
91 int render_view_id,
91 const content::URLDataSource::GotDataCallback& callback) { 92 const content::URLDataSource::GotDataCallback& callback) {
92 std::string email; 93 std::string email;
93 bool is_image_animated = false; 94 bool is_image_animated = false;
94 ui::ScaleFactor scale_factor; 95 ui::ScaleFactor scale_factor;
95 GURL url(chrome::kChromeUIUserImageURL + path); 96 GURL url(chrome::kChromeUIUserImageURL + path);
96 ParseRequest(url, &email, &is_image_animated, &scale_factor); 97 ParseRequest(url, &email, &is_image_animated, &scale_factor);
97 callback.Run(GetUserImage(email, is_image_animated, scale_factor)); 98 callback.Run(GetUserImage(email, is_image_animated, scale_factor));
98 } 99 }
99 100
100 std::string UserImageSource::GetMimeType(const std::string& path) const { 101 std::string UserImageSource::GetMimeType(const std::string& path) const {
101 // We need to explicitly return a mime type, otherwise if the user tries to 102 // We need to explicitly return a mime type, otherwise if the user tries to
102 // drag the image they get no extension. 103 // drag the image they get no extension.
103 std::string email; 104 std::string email;
104 bool is_image_animated = false; 105 bool is_image_animated = false;
105 ui::ScaleFactor scale_factor; 106 ui::ScaleFactor scale_factor;
106 107
107 GURL url(chrome::kChromeUIUserImageURL + path); 108 GURL url(chrome::kChromeUIUserImageURL + path);
108 ParseRequest(url, &email, &is_image_animated, &scale_factor); 109 ParseRequest(url, &email, &is_image_animated, &scale_factor);
109 110
110 if (is_image_animated) { 111 if (is_image_animated) {
111 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email); 112 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email);
112 if (user && user->has_animated_image()) 113 if (user && user->has_animated_image())
113 return "image/gif"; 114 return "image/gif";
114 } 115 }
115 return "image/png"; 116 return "image/png";
116 } 117 }
117 118
118 } // namespace options 119 } // namespace options
119 } // namespace chromeos 120 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698