| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 reinterpret_cast<const char*>(thumbnail_data->front()), | 212 reinterpret_cast<const char*>(thumbnail_data->front()), |
| 213 thumbnail_data->size()); | 213 thumbnail_data->size()); |
| 214 | 214 |
| 215 if (params_->details.thumbnail) { | 215 if (params_->details.thumbnail) { |
| 216 SetResult(thumbnail_result); | 216 SetResult(thumbnail_result); |
| 217 SendResponse(true); | 217 SendResponse(true); |
| 218 } | 218 } |
| 219 | 219 |
| 220 // Inform the native Wallpaper Picker Application that the current wallpaper | 220 // Inform the native Wallpaper Picker Application that the current wallpaper |
| 221 // has been modified by a third party application. | 221 // has been modified by a third party application. |
| 222 Profile* profile = Profile::FromBrowserContext(browser_context()); | 222 if (extension()->id() != extension_misc::kWallpaperManagerId) { |
| 223 extensions::EventRouter* event_router = extensions::EventRouter::Get(profile); | 223 Profile* profile = Profile::FromBrowserContext(browser_context()); |
| 224 scoped_ptr<base::ListValue> event_args(new base::ListValue()); | 224 extensions::EventRouter* event_router = |
| 225 event_args->Append(original_result); | 225 extensions::EventRouter::Get(profile); |
| 226 event_args->Append(thumbnail_result); | 226 scoped_ptr<base::ListValue> event_args(new base::ListValue()); |
| 227 event_args->Append(new base::StringValue( | 227 event_args->Append(original_result); |
| 228 extensions::api::wallpaper::ToString(params_->details.layout))); | 228 event_args->Append(thumbnail_result); |
| 229 scoped_ptr<extensions::Event> event(new extensions::Event( | 229 event_args->Append(new base::StringValue( |
| 230 extensions::events::WALLPAPER_PRIVATE_ON_WALLPAPER_CHANGED_BY_3RD_PARTY, | 230 extensions::api::wallpaper::ToString(params_->details.layout))); |
| 231 extensions::api::wallpaper_private::OnWallpaperChangedBy3rdParty:: | 231 event_args->Append(new base::StringValue(extension()->name())); |
| 232 kEventName, | 232 scoped_ptr<extensions::Event> event(new extensions::Event( |
| 233 std::move(event_args))); | 233 extensions::events::WALLPAPER_PRIVATE_ON_WALLPAPER_CHANGED_BY_3RD_PARTY, |
| 234 event_router->DispatchEventToExtension(extension_misc::kWallpaperManagerId, | 234 extensions::api::wallpaper_private::OnWallpaperChangedBy3rdParty:: |
| 235 std::move(event)); | 235 kEventName, |
| 236 std::move(event_args))); |
| 237 event_router->DispatchEventToExtension(extension_misc::kWallpaperManagerId, |
| 238 std::move(event)); |
| 239 } |
| 236 } | 240 } |
| 237 | 241 |
| 238 void WallpaperSetWallpaperFunction::OnWallpaperFetched( | 242 void WallpaperSetWallpaperFunction::OnWallpaperFetched( |
| 239 bool success, | 243 bool success, |
| 240 const std::string& response) { | 244 const std::string& response) { |
| 241 if (success) { | 245 if (success) { |
| 242 params_->details.data.reset( | 246 params_->details.data.reset( |
| 243 new std::vector<char>(response.begin(), response.end())); | 247 new std::vector<char>(response.begin(), response.end())); |
| 244 StartDecode(*params_->details.data); | 248 StartDecode(*params_->details.data); |
| 245 } else { | 249 } else { |
| 246 SetError(response); | 250 SetError(response); |
| 247 SendResponse(false); | 251 SendResponse(false); |
| 248 } | 252 } |
| 249 } | 253 } |
| OLD | NEW |