OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_api.h" | 5 #include "chrome/browser/chromeos/extensions/wallpaper_api.h" |
6 | 6 |
7 #include "ash/desktop_background/desktop_background_controller.h" | 7 #include "ash/desktop_background/desktop_background_controller.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 SendResponse(true); | 155 SendResponse(true); |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 void WallpaperSetWallpaperFunction::GenerateThumbnail( | 159 void WallpaperSetWallpaperFunction::GenerateThumbnail( |
160 const base::FilePath& thumbnail_path, scoped_ptr<gfx::ImageSkia> image) { | 160 const base::FilePath& thumbnail_path, scoped_ptr<gfx::ImageSkia> image) { |
161 DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread( | 161 DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread( |
162 sequence_token_)); | 162 sequence_token_)); |
163 chromeos::UserImage wallpaper(*image.get()); | 163 chromeos::UserImage wallpaper(*image.get()); |
164 if (!base::PathExists(thumbnail_path.DirName())) | 164 if (!base::PathExists(thumbnail_path.DirName())) |
165 file_util::CreateDirectory(thumbnail_path.DirName()); | 165 base::CreateDirectory(thumbnail_path.DirName()); |
166 | 166 |
167 scoped_refptr<base::RefCountedBytes> data; | 167 scoped_refptr<base::RefCountedBytes> data; |
168 chromeos::WallpaperManager::Get()->ResizeWallpaper( | 168 chromeos::WallpaperManager::Get()->ResizeWallpaper( |
169 wallpaper, | 169 wallpaper, |
170 ash::WALLPAPER_LAYOUT_STRETCH, | 170 ash::WALLPAPER_LAYOUT_STRETCH, |
171 ash::kWallpaperThumbnailWidth, | 171 ash::kWallpaperThumbnailWidth, |
172 ash::kWallpaperThumbnailHeight, | 172 ash::kWallpaperThumbnailHeight, |
173 &data); | 173 &data); |
174 BrowserThread::PostTask( | 174 BrowserThread::PostTask( |
175 BrowserThread::UI, FROM_HERE, | 175 BrowserThread::UI, FROM_HERE, |
(...skipping 13 matching lines...) Expand all Loading... |
189 void WallpaperSetWallpaperFunction::OnWallpaperFetched( | 189 void WallpaperSetWallpaperFunction::OnWallpaperFetched( |
190 net::URLRequestStatus::Status status, const std::string& response) { | 190 net::URLRequestStatus::Status status, const std::string& response) { |
191 if (status == net::URLRequestStatus::SUCCESS) { | 191 if (status == net::URLRequestStatus::SUCCESS) { |
192 params_->details.wallpaper_data.reset(new std::string(response)); | 192 params_->details.wallpaper_data.reset(new std::string(response)); |
193 StartDecode(*params_->details.wallpaper_data); | 193 StartDecode(*params_->details.wallpaper_data); |
194 } else { | 194 } else { |
195 SetError(response); | 195 SetError(response); |
196 SendResponse(false); | 196 SendResponse(false); |
197 } | 197 } |
198 } | 198 } |
OLD | NEW |