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

Unified Diff: chrome/browser/chromeos/extensions/wallpaper_api.cc

Issue 2058833002: [Merge to M52] [Retry] Fix the browser crash when changing wallpaper with chrome.wallpaper API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/wallpaper/test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/extensions/wallpaper_api.cc
diff --git a/chrome/browser/chromeos/extensions/wallpaper_api.cc b/chrome/browser/chromeos/extensions/wallpaper_api.cc
index 5d16b287c3c909dd3ea118be8f87fa37374fa797..f7e97f9cc38094455da244068dd840886f481b13 100644
--- a/chrome/browser/chromeos/extensions/wallpaper_api.cc
+++ b/chrome/browser/chromeos/extensions/wallpaper_api.cc
@@ -228,15 +228,17 @@ void WallpaperSetWallpaperFunction::GenerateThumbnail(
void WallpaperSetWallpaperFunction::ThumbnailGenerated(
base::RefCountedBytes* original_data,
base::RefCountedBytes* thumbnail_data) {
- BinaryValue* original_result = BinaryValue::CreateWithCopiedBuffer(
- reinterpret_cast<const char*>(original_data->front()),
- original_data->size());
- BinaryValue* thumbnail_result = BinaryValue::CreateWithCopiedBuffer(
- reinterpret_cast<const char*>(thumbnail_data->front()),
- thumbnail_data->size());
+ std::unique_ptr<BinaryValue> original_result =
+ base::WrapUnique(BinaryValue::CreateWithCopiedBuffer(
+ reinterpret_cast<const char*>(original_data->front()),
+ original_data->size()));
+ std::unique_ptr<BinaryValue> thumbnail_result =
+ base::WrapUnique(BinaryValue::CreateWithCopiedBuffer(
+ reinterpret_cast<const char*>(thumbnail_data->front()),
+ thumbnail_data->size()));
if (params_->details.thumbnail) {
- SetResult(thumbnail_result);
+ SetResult(thumbnail_result->DeepCopy());
SendResponse(true);
}
@@ -247,8 +249,8 @@ void WallpaperSetWallpaperFunction::ThumbnailGenerated(
extensions::EventRouter* event_router =
extensions::EventRouter::Get(profile);
std::unique_ptr<base::ListValue> event_args(new base::ListValue());
- event_args->Append(original_result);
- event_args->Append(thumbnail_result);
+ event_args->Append(original_result->DeepCopy());
+ event_args->Append(thumbnail_result->DeepCopy());
event_args->Append(new base::StringValue(
extensions::api::wallpaper::ToString(params_->details.layout)));
// Setting wallpaper from right click menu in 'Files' app is a feature that
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/wallpaper/test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698