| 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 <string> |
| 8 #include <vector> |
| 9 |
| 7 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
| 8 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 9 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 10 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 11 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 12 #include "base/threading/worker_pool.h" | 15 #include "base/threading/worker_pool.h" |
| 13 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 17 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 BinaryValue* result = BinaryValue::CreateWithCopiedBuffer( | 201 BinaryValue* result = BinaryValue::CreateWithCopiedBuffer( |
| 199 reinterpret_cast<const char*>(data->front()), data->size()); | 202 reinterpret_cast<const char*>(data->front()), data->size()); |
| 200 SetResult(result); | 203 SetResult(result); |
| 201 SendResponse(true); | 204 SendResponse(true); |
| 202 } | 205 } |
| 203 | 206 |
| 204 void WallpaperSetWallpaperFunction::OnWallpaperFetched( | 207 void WallpaperSetWallpaperFunction::OnWallpaperFetched( |
| 205 bool success, | 208 bool success, |
| 206 const std::string& response) { | 209 const std::string& response) { |
| 207 if (success) { | 210 if (success) { |
| 208 params_->details.data.reset(new std::string(response)); | 211 params_->details.data.reset( |
| 212 new std::vector<char>(response.begin(), response.end())); |
| 209 StartDecode(*params_->details.data); | 213 StartDecode(*params_->details.data); |
| 210 } else { | 214 } else { |
| 211 SetError(response); | 215 SetError(response); |
| 212 SendResponse(false); | 216 SendResponse(false); |
| 213 } | 217 } |
| 214 } | 218 } |
| OLD | NEW |