Commit ca7c6cd6 authored by ranj's avatar ranj Committed by Commit bot

change chrome.wallpaper.setWallpaper api

change field name from wallpaperData to data
change field name from name to filename

BUG=411286

Review URL: https://codereview.chromium.org/559583002

Cr-Commit-Position: refs/heads/master@{#294181}
parent 033f3af0
...@@ -104,8 +104,8 @@ bool WallpaperSetWallpaperFunction::RunAsync() { ...@@ -104,8 +104,8 @@ bool WallpaperSetWallpaperFunction::RunAsync() {
user_id_hash_ = user_id_hash_ =
user_manager::UserManager::Get()->GetLoggedInUser()->username_hash(); user_manager::UserManager::Get()->GetLoggedInUser()->username_hash();
if (params_->details.wallpaper_data) { if (params_->details.data) {
StartDecode(*params_->details.wallpaper_data); StartDecode(*params_->details.data);
} else { } else {
GURL wallpaper_url(*params_->details.url); GURL wallpaper_url(*params_->details.url);
if (wallpaper_url.is_valid()) { if (wallpaper_url.is_valid()) {
...@@ -127,7 +127,7 @@ void WallpaperSetWallpaperFunction::OnWallpaperDecoded( ...@@ -127,7 +127,7 @@ void WallpaperSetWallpaperFunction::OnWallpaperDecoded(
base::FilePath thumbnail_path = wallpaper_manager->GetCustomWallpaperPath( base::FilePath thumbnail_path = wallpaper_manager->GetCustomWallpaperPath(
chromeos::kThumbnailWallpaperSubDir, chromeos::kThumbnailWallpaperSubDir,
user_id_hash_, user_id_hash_,
params_->details.name); params_->details.filename);
sequence_token_ = BrowserThread::GetBlockingPool()-> sequence_token_ = BrowserThread::GetBlockingPool()->
GetNamedSequenceToken(chromeos::kWallpaperSequenceTokenName); GetNamedSequenceToken(chromeos::kWallpaperSequenceTokenName);
...@@ -141,7 +141,7 @@ void WallpaperSetWallpaperFunction::OnWallpaperDecoded( ...@@ -141,7 +141,7 @@ void WallpaperSetWallpaperFunction::OnWallpaperDecoded(
user_id_ == user_manager::UserManager::Get()->GetActiveUser()->email(); user_id_ == user_manager::UserManager::Get()->GetActiveUser()->email();
wallpaper_manager->SetCustomWallpaper(user_id_, wallpaper_manager->SetCustomWallpaper(user_id_,
user_id_hash_, user_id_hash_,
params_->details.name, params_->details.filename,
layout, layout,
user_manager::User::CUSTOMIZED, user_manager::User::CUSTOMIZED,
image, image,
...@@ -209,8 +209,8 @@ void WallpaperSetWallpaperFunction::OnWallpaperFetched( ...@@ -209,8 +209,8 @@ void WallpaperSetWallpaperFunction::OnWallpaperFetched(
bool success, bool success,
const std::string& response) { const std::string& response) {
if (success) { if (success) {
params_->details.wallpaper_data.reset(new std::string(response)); params_->details.data.reset(new std::string(response));
StartDecode(*params_->details.wallpaper_data); StartDecode(*params_->details.data);
} else { } else {
SetError(response); SetError(response);
SendResponse(false); SendResponse(false);
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"name": "details", "name": "details",
"type": "object", "type": "object",
"properties": { "properties": {
"wallpaperData": { "data": {
"type": "binary", "type": "binary",
"optional": true, "optional": true,
"description": "The jpeg or png encoded wallpaper image." "description": "The jpeg or png encoded wallpaper image."
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
"enum": [ "STRETCH", "CENTER", "CENTER_CROPPED" ], "enum": [ "STRETCH", "CENTER", "CENTER_CROPPED" ],
"description": "The supported wallpaper layouts." "description": "The supported wallpaper layouts."
}, },
"name": { "filename": {
"type": "string", "type": "string",
"description": "The file name of the saved wallpaper." "description": "The file name of the saved wallpaper."
}, },
......
...@@ -25,6 +25,6 @@ chrome.wallpaper.setWallpaper( ...@@ -25,6 +25,6 @@ chrome.wallpaper.setWallpaper(
{ {
'url': 'http://example.com/a_file.jpg', 'url': 'http://example.com/a_file.jpg',
'layout': 'CENTER_CROPPED', 'layout': 'CENTER_CROPPED',
'name': 'test_wallpaper' 'filename': 'test_wallpaper'
}, function() {}); }, function() {});
</pre> </pre>
...@@ -25,9 +25,9 @@ chrome.test.getConfig(function(config) { ...@@ -25,9 +25,9 @@ chrome.test.getConfig(function(config) {
wallpaperRequest.onloadend = function(e) { wallpaperRequest.onloadend = function(e) {
if (wallpaperRequest.status === 200) { if (wallpaperRequest.status === 200) {
chrome.wallpaper.setWallpaper( chrome.wallpaper.setWallpaper(
{'wallpaperData': wallpaperRequest.response, {'data': wallpaperRequest.response,
'layout': 'CENTER_CROPPED', 'layout': 'CENTER_CROPPED',
'name': 'test'}, 'filename': 'test'},
// Set wallpaper directly with an arraybuffer should pass. // Set wallpaper directly with an arraybuffer should pass.
pass() pass()
); );
...@@ -56,7 +56,7 @@ chrome.test.getConfig(function(config) { ...@@ -56,7 +56,7 @@ chrome.test.getConfig(function(config) {
chrome.wallpaper.setWallpaper( chrome.wallpaper.setWallpaper(
{'url': url, {'url': url,
'layout': 'CENTER_CROPPED', 'layout': 'CENTER_CROPPED',
'name': 'test'}, 'filename': 'test'},
// A valid url should set wallpaper correctly. // A valid url should set wallpaper correctly.
pass() pass()
); );
...@@ -68,7 +68,7 @@ chrome.test.getConfig(function(config) { ...@@ -68,7 +68,7 @@ chrome.test.getConfig(function(config) {
chrome.wallpaper.setWallpaper( chrome.wallpaper.setWallpaper(
{'url': url, {'url': url,
'layout': 'CENTER_CROPPED', 'layout': 'CENTER_CROPPED',
'name': 'test'}, 'filename': 'test'},
// Expect a failure. // Expect a failure.
fail(optExpectedError)); fail(optExpectedError));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment