| OLD | NEW |
| 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 Loading... |
| 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::ROBUST_JPEG_CODEC); |
| 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 Loading... |
| 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 |
| OLD | NEW |