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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc

Issue 10892023: Force avatar and wallpaper decoding to use robust JPEG. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Applied comments. Created 8 years, 3 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/chromeos/login/user_image_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 std::string mime_type, charset, raw_data; 225 std::string mime_type, charset, raw_data;
226 if (!net::DataURL::Parse(GURL(image_url), &mime_type, &charset, &raw_data)) 226 if (!net::DataURL::Parse(GURL(image_url), &mime_type, &charset, &raw_data))
227 NOTREACHED(); 227 NOTREACHED();
228 DCHECK_EQ("image/png", mime_type); 228 DCHECK_EQ("image/png", mime_type);
229 229
230 user_photo_ = gfx::ImageSkia(); 230 user_photo_ = gfx::ImageSkia();
231 user_photo_data_url_ = image_url; 231 user_photo_data_url_ = image_url;
232 232
233 if (image_decoder_.get()) 233 if (image_decoder_.get())
234 image_decoder_->set_delegate(NULL); 234 image_decoder_->set_delegate(NULL);
235 image_decoder_ = new ImageDecoder(this, raw_data); 235 image_decoder_ = new ImageDecoder(this, raw_data,
236 ImageDecoder::DEFAULT_CODEC);
Nikita (slow) 2012/08/29 14:20:11 Why do we use default codec here but in user_image
Emmanuel Saint-loubert-Bié 2012/08/29 17:52:08 Done.
236 image_decoder_->Start(); 237 image_decoder_->Start();
237 } 238 }
238 239
239 void UserImageScreenHandler::HandleTakePhoto(const base::ListValue* args) { 240 void UserImageScreenHandler::HandleTakePhoto(const base::ListValue* args) {
240 DCHECK(args && args->empty()); 241 DCHECK(args && args->empty());
241 views::Widget* window = views::Widget::CreateWindowWithParent( 242 views::Widget* window = views::Widget::CreateWindowWithParent(
242 new TakePhotoDialog(this), GetNativeWindow()); 243 new TakePhotoDialog(this), GetNativeWindow());
243 window->SetAlwaysOnTop(true); 244 window->SetAlwaysOnTop(true);
244 window->Show(); 245 window->Show();
245 } 246 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 user_photo_ = gfx::ImageSkia(decoded_image); 307 user_photo_ = gfx::ImageSkia(decoded_image);
307 if (screen_ && accept_photo_after_decoding_) 308 if (screen_ && accept_photo_after_decoding_)
308 screen_->OnPhotoTaken(user_photo_); 309 screen_->OnPhotoTaken(user_photo_);
309 } 310 }
310 311
311 void UserImageScreenHandler::OnDecodeImageFailed(const ImageDecoder* decoder) { 312 void UserImageScreenHandler::OnDecodeImageFailed(const ImageDecoder* decoder) {
312 NOTREACHED() << "Failed to decode PNG image from WebUI"; 313 NOTREACHED() << "Failed to decode PNG image from WebUI";
313 } 314 }
314 315
315 } // namespace chromeos 316 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698