| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 scoped_refptr<WallpaperSetWallpaperFunction> function_; | 92 scoped_refptr<WallpaperSetWallpaperFunction> function_; |
| 93 scoped_refptr<ImageDecoder> image_decoder_; | 93 scoped_refptr<ImageDecoder> image_decoder_; |
| 94 base::CancellationFlag cancel_flag_; | 94 base::CancellationFlag cancel_flag_; |
| 95 | 95 |
| 96 DISALLOW_COPY_AND_ASSIGN(WallpaperDecoder); | 96 DISALLOW_COPY_AND_ASSIGN(WallpaperDecoder); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 WallpaperSetWallpaperFunction::WallpaperDecoder* | 99 WallpaperSetWallpaperFunction::WallpaperDecoder* |
| 100 WallpaperSetWallpaperFunction::wallpaper_decoder_; | 100 WallpaperSetWallpaperFunction::wallpaper_decoder_; |
| 101 | 101 |
| 102 WallpaperSetWallpaperFunction::WallpaperSetWallpaperFunction(){ | 102 WallpaperSetWallpaperFunction::WallpaperSetWallpaperFunction() { |
| 103 } | 103 } |
| 104 | 104 |
| 105 WallpaperSetWallpaperFunction::~WallpaperSetWallpaperFunction(){ | 105 WallpaperSetWallpaperFunction::~WallpaperSetWallpaperFunction() { |
| 106 } | 106 } |
| 107 | 107 |
| 108 bool WallpaperSetWallpaperFunction::RunImpl() { | 108 bool WallpaperSetWallpaperFunction::RunImpl() { |
| 109 BinaryValue* input = NULL; | 109 BinaryValue* input = NULL; |
| 110 if (args_ == NULL || !args_->GetBinary(0, &input)) { | 110 if (args_ == NULL || !args_->GetBinary(0, &input)) { |
| 111 return false; | 111 return false; |
| 112 } | 112 } |
| 113 std::string layout_string; | 113 std::string layout_string; |
| 114 if (!args_->GetString(1, &layout_string) || layout_string.empty()) { | 114 if (!args_->GetString(1, &layout_string) || layout_string.empty()) { |
| 115 return false; | 115 return false; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 this)); | 169 this)); |
| 170 } else { | 170 } else { |
| 171 BrowserThread::PostTask( | 171 BrowserThread::PostTask( |
| 172 BrowserThread::UI, FROM_HERE, | 172 BrowserThread::UI, FROM_HERE, |
| 173 base::Bind(&WallpaperSetWallpaperFunction::OnFail, | 173 base::Bind(&WallpaperSetWallpaperFunction::OnFail, |
| 174 this)); | 174 this)); |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 | 177 |
| 178 void WallpaperSetWallpaperFunction::SetDecodedWallpaper() { | 178 void WallpaperSetWallpaperFunction::SetDecodedWallpaper() { |
| 179 ash::Shell::GetInstance()->desktop_background_controller()-> | 179 chromeos::WallpaperManager* wallpaper_manager = |
| 180 SetCustomWallpaper(wallpaper_, layout_); | 180 chromeos::WallpaperManager::Get(); |
| 181 wallpaper_manager->SetWallpaperFromImageSkia(wallpaper_, layout_); |
| 182 wallpaper_manager->SaveUserWallpaperInfo(email_, file_name_, layout_, |
| 183 chromeos::User::DEFAULT); |
| 181 wallpaper_decoder_ = NULL; | 184 wallpaper_decoder_ = NULL; |
| 182 SendResponse(true); | 185 SendResponse(true); |
| 183 } | 186 } |
| OLD | NEW |