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

Side by Side Diff: chrome/browser/chromeos/extensions/wallpaper_api.cc

Issue 215293003: Move all wallpaper file loading and decoding from DesktopBackgroundController to WallpaperManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix clang debug build. Created 6 years, 8 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
OLDNEW
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread( 169 DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread(
170 sequence_token_)); 170 sequence_token_));
171 chromeos::UserImage wallpaper(*image.get()); 171 chromeos::UserImage wallpaper(*image.get());
172 if (!base::PathExists(thumbnail_path.DirName())) 172 if (!base::PathExists(thumbnail_path.DirName()))
173 base::CreateDirectory(thumbnail_path.DirName()); 173 base::CreateDirectory(thumbnail_path.DirName());
174 174
175 scoped_refptr<base::RefCountedBytes> data; 175 scoped_refptr<base::RefCountedBytes> data;
176 chromeos::WallpaperManager::Get()->ResizeWallpaper( 176 chromeos::WallpaperManager::Get()->ResizeWallpaper(
177 wallpaper, 177 wallpaper,
178 ash::WALLPAPER_LAYOUT_STRETCH, 178 ash::WALLPAPER_LAYOUT_STRETCH,
179 ash::kWallpaperThumbnailWidth, 179 chromeos::kWallpaperThumbnailWidth,
180 ash::kWallpaperThumbnailHeight, 180 chromeos::kWallpaperThumbnailHeight,
181 &data); 181 &data,
182 NULL);
182 BrowserThread::PostTask( 183 BrowserThread::PostTask(
183 BrowserThread::UI, FROM_HERE, 184 BrowserThread::UI, FROM_HERE,
184 base::Bind( 185 base::Bind(
185 &WallpaperSetWallpaperFunction::ThumbnailGenerated, 186 &WallpaperSetWallpaperFunction::ThumbnailGenerated,
186 this, data)); 187 this, data));
187 } 188 }
188 189
189 void WallpaperSetWallpaperFunction::ThumbnailGenerated( 190 void WallpaperSetWallpaperFunction::ThumbnailGenerated(
190 base::RefCountedBytes* data) { 191 base::RefCountedBytes* data) {
191 BinaryValue* result = BinaryValue::CreateWithCopiedBuffer( 192 BinaryValue* result = BinaryValue::CreateWithCopiedBuffer(
192 reinterpret_cast<const char*>(data->front()), data->size()); 193 reinterpret_cast<const char*>(data->front()), data->size());
193 SetResult(result); 194 SetResult(result);
194 SendResponse(true); 195 SendResponse(true);
195 } 196 }
196 197
197 void WallpaperSetWallpaperFunction::OnWallpaperFetched( 198 void WallpaperSetWallpaperFunction::OnWallpaperFetched(
198 bool success, 199 bool success,
199 const std::string& response) { 200 const std::string& response) {
200 if (success) { 201 if (success) {
201 params_->details.wallpaper_data.reset(new std::string(response)); 202 params_->details.wallpaper_data.reset(new std::string(response));
202 StartDecode(*params_->details.wallpaper_data); 203 StartDecode(*params_->details.wallpaper_data);
203 } else { 204 } else {
204 SetError(response); 205 SetError(response);
205 SendResponse(false); 206 SendResponse(false);
206 } 207 }
207 } 208 }
OLDNEW
« no previous file with comments | « ash/test/test_user_wallpaper_delegate.cc ('k') | chrome/browser/chromeos/extensions/wallpaper_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698