| 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> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 243 |
| 244 // Inform the native Wallpaper Picker Application that the current wallpaper | 244 // Inform the native Wallpaper Picker Application that the current wallpaper |
| 245 // has been modified by a third party application. | 245 // has been modified by a third party application. |
| 246 if (extension()->id() != extension_misc::kWallpaperManagerId) { | 246 if (extension()->id() != extension_misc::kWallpaperManagerId) { |
| 247 Profile* profile = Profile::FromBrowserContext(browser_context()); | 247 Profile* profile = Profile::FromBrowserContext(browser_context()); |
| 248 extensions::EventRouter* event_router = | 248 extensions::EventRouter* event_router = |
| 249 extensions::EventRouter::Get(profile); | 249 extensions::EventRouter::Get(profile); |
| 250 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); | 250 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); |
| 251 event_args->Append(original_result->DeepCopy()); | 251 event_args->Append(original_result->DeepCopy()); |
| 252 event_args->Append(thumbnail_result->DeepCopy()); | 252 event_args->Append(thumbnail_result->DeepCopy()); |
| 253 event_args->Append(new base::StringValue( | 253 event_args->AppendString( |
| 254 extensions::api::wallpaper::ToString(params_->details.layout))); | 254 extensions::api::wallpaper::ToString(params_->details.layout)); |
| 255 // Setting wallpaper from right click menu in 'Files' app is a feature that | 255 // Setting wallpaper from right click menu in 'Files' app is a feature that |
| 256 // was implemented in crbug.com/578935. Since 'Files' app is a built-in v1 | 256 // was implemented in crbug.com/578935. Since 'Files' app is a built-in v1 |
| 257 // app in ChromeOS, we should treat it slightly differently with other third | 257 // app in ChromeOS, we should treat it slightly differently with other third |
| 258 // party apps: the wallpaper set by the 'Files' app should still be syncable | 258 // party apps: the wallpaper set by the 'Files' app should still be syncable |
| 259 // and it should not appear in the wallpaper grid in the Wallpaper Picker. | 259 // and it should not appear in the wallpaper grid in the Wallpaper Picker. |
| 260 // But we should not display the 'wallpaper-set-by-mesage' since it might | 260 // But we should not display the 'wallpaper-set-by-mesage' since it might |
| 261 // introduce confusion as shown in crbug.com/599407. | 261 // introduce confusion as shown in crbug.com/599407. |
| 262 event_args->Append(new base::StringValue( | 262 event_args->AppendString( |
| 263 (extension()->id() == file_manager::kFileManagerAppId) | 263 (extension()->id() == file_manager::kFileManagerAppId) |
| 264 ? std::string() | 264 ? std::string() |
| 265 : extension()->name())); | 265 : extension()->name()); |
| 266 std::unique_ptr<extensions::Event> event(new extensions::Event( | 266 std::unique_ptr<extensions::Event> event(new extensions::Event( |
| 267 extensions::events::WALLPAPER_PRIVATE_ON_WALLPAPER_CHANGED_BY_3RD_PARTY, | 267 extensions::events::WALLPAPER_PRIVATE_ON_WALLPAPER_CHANGED_BY_3RD_PARTY, |
| 268 extensions::api::wallpaper_private::OnWallpaperChangedBy3rdParty:: | 268 extensions::api::wallpaper_private::OnWallpaperChangedBy3rdParty:: |
| 269 kEventName, | 269 kEventName, |
| 270 std::move(event_args))); | 270 std::move(event_args))); |
| 271 event_router->DispatchEventToExtension(extension_misc::kWallpaperManagerId, | 271 event_router->DispatchEventToExtension(extension_misc::kWallpaperManagerId, |
| 272 std::move(event)); | 272 std::move(event)); |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 | 275 |
| 276 void WallpaperSetWallpaperFunction::OnWallpaperFetched( | 276 void WallpaperSetWallpaperFunction::OnWallpaperFetched( |
| 277 bool success, | 277 bool success, |
| 278 const std::string& response) { | 278 const std::string& response) { |
| 279 if (success) { | 279 if (success) { |
| 280 params_->details.data.reset( | 280 params_->details.data.reset( |
| 281 new std::vector<char>(response.begin(), response.end())); | 281 new std::vector<char>(response.begin(), response.end())); |
| 282 StartDecode(*params_->details.data); | 282 StartDecode(*params_->details.data); |
| 283 } else { | 283 } else { |
| 284 SetError(response); | 284 SetError(response); |
| 285 SendResponse(false); | 285 SendResponse(false); |
| 286 } | 286 } |
| 287 } | 287 } |
| OLD | NEW |