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/chromeos/extensions/wallpaper_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h" |
6 | 6 |
7 #include "ash/desktop_background/desktop_background_controller.h" | 7 #include "ash/desktop_background/desktop_background_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 class WallpaperSetWallpaperFunction::WallpaperDecoder | 56 class WallpaperSetWallpaperFunction::WallpaperDecoder |
57 : public ImageDecoder::Delegate { | 57 : public ImageDecoder::Delegate { |
58 public: | 58 public: |
59 explicit WallpaperDecoder( | 59 explicit WallpaperDecoder( |
60 scoped_refptr<WallpaperSetWallpaperFunction> function) | 60 scoped_refptr<WallpaperSetWallpaperFunction> function) |
61 : function_(function) { | 61 : function_(function) { |
62 } | 62 } |
63 | 63 |
64 void Start(const std::string& image_data) { | 64 void Start(const std::string& image_data) { |
65 image_decoder_ = new ImageDecoder(this, image_data); | 65 image_decoder_ = new ImageDecoder(this, image_data, |
| 66 ImageDecoder::ROBUST_JPEG_CODEC); |
66 image_decoder_->Start(); | 67 image_decoder_->Start(); |
67 } | 68 } |
68 | 69 |
69 void Cancel() { | 70 void Cancel() { |
70 cancel_flag_.Set(); | 71 cancel_flag_.Set(); |
71 function_->SendResponse(false); | 72 function_->SendResponse(false); |
72 } | 73 } |
73 | 74 |
74 virtual void OnImageDecoded(const ImageDecoder* decoder, | 75 virtual void OnImageDecoded(const ImageDecoder* decoder, |
75 const SkBitmap& decoded_image) OVERRIDE { | 76 const SkBitmap& decoded_image) OVERRIDE { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 chromeos::WallpaperInfo info = { | 189 chromeos::WallpaperInfo info = { |
189 file_name_, | 190 file_name_, |
190 layout_, | 191 layout_, |
191 chromeos::User::ONLINE, | 192 chromeos::User::ONLINE, |
192 base::Time::Now().LocalMidnight() | 193 base::Time::Now().LocalMidnight() |
193 }; | 194 }; |
194 wallpaper_manager->SetUserWallpaperInfo(email_, info, is_persistent); | 195 wallpaper_manager->SetUserWallpaperInfo(email_, info, is_persistent); |
195 wallpaper_decoder_ = NULL; | 196 wallpaper_decoder_ = NULL; |
196 SendResponse(true); | 197 SendResponse(true); |
197 } | 198 } |
OLD | NEW |