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

Side by Side Diff: chrome/utility/chrome_content_utility_client.cc

Issue 10912019: Enable robust decoding of custom wallpaper and allow custom wallpaper on login page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Check conflict. 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
« no previous file with comments | « chrome/browser/chromeos/login/wallpaper_manager.cc ('k') | ui/gfx/codec/jpeg_codec.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/utility/chrome_content_utility_client.h" 5 #include "chrome/utility/chrome_content_utility_client.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 metafile.FinishPage(); 355 metafile.FinishPage();
356 } 356 }
357 } 357 }
358 metafile.FinishDocument(); 358 metafile.FinishDocument();
359 return ret; 359 return ret;
360 } 360 }
361 #endif // defined(OS_WIN) 361 #endif // defined(OS_WIN)
362 362
363 void ChromeContentUtilityClient::OnRobustJPEGDecodeImage( 363 void ChromeContentUtilityClient::OnRobustJPEGDecodeImage(
364 const std::vector<unsigned char>& encoded_data) { 364 const std::vector<unsigned char>& encoded_data) {
365 scoped_ptr<SkBitmap> decoded_image(gfx::JPEGCodec::Decode( 365 // Our robust jpeg decoding is using IJG libjpeg.
366 &encoded_data[0], encoded_data.size())); 366 if (gfx::JPEGCodec::JpegLibraryVariant() == gfx::JPEGCodec::IJG_LIBJPEG) {
367 if (decoded_image->empty()) { 367 scoped_ptr<SkBitmap> decoded_image(gfx::JPEGCodec::Decode(
368 &encoded_data[0], encoded_data.size()));
369 if (!decoded_image.get() || decoded_image->empty()) {
370 Send(new ChromeUtilityHostMsg_DecodeImage_Failed());
371 } else {
372 Send(new ChromeUtilityHostMsg_DecodeImage_Succeeded(*decoded_image));
373 }
374 } else {
368 Send(new ChromeUtilityHostMsg_DecodeImage_Failed()); 375 Send(new ChromeUtilityHostMsg_DecodeImage_Failed());
369 } else {
370 Send(new ChromeUtilityHostMsg_DecodeImage_Succeeded(*decoded_image));
371 } 376 }
372 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); 377 content::UtilityThread::Get()->ReleaseProcessIfNeeded();
373 } 378 }
374 379
375 void ChromeContentUtilityClient::OnParseJSON(const std::string& json) { 380 void ChromeContentUtilityClient::OnParseJSON(const std::string& json) {
376 int error_code; 381 int error_code;
377 std::string error; 382 std::string error;
378 Value* value = base::JSONReader::ReadAndReturnError( 383 Value* value = base::JSONReader::ReadAndReturnError(
379 json, base::JSON_PARSE_RFC, &error_code, &error); 384 json, base::JSON_PARSE_RFC, &error_code, &error);
380 if (value) { 385 if (value) {
(...skipping 22 matching lines...) Expand all
403 } else 408 } else
404 #endif 409 #endif
405 { 410 {
406 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( 411 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed(
407 printer_name)); 412 printer_name));
408 } 413 }
409 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); 414 content::UtilityThread::Get()->ReleaseProcessIfNeeded();
410 } 415 }
411 416
412 } // namespace chrome 417 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wallpaper_manager.cc ('k') | ui/gfx/codec/jpeg_codec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698