OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 SET_STRING("stretchLayout", IDS_OPTIONS_WALLPAPER_STRETCH_LAYOUT); | 256 SET_STRING("stretchLayout", IDS_OPTIONS_WALLPAPER_STRETCH_LAYOUT); |
257 SET_STRING("connectionFailed", IDS_WALLPAPER_MANAGER_ACCESS_FAIL); | 257 SET_STRING("connectionFailed", IDS_WALLPAPER_MANAGER_ACCESS_FAIL); |
258 SET_STRING("downloadFailed", IDS_WALLPAPER_MANAGER_DOWNLOAD_FAIL); | 258 SET_STRING("downloadFailed", IDS_WALLPAPER_MANAGER_DOWNLOAD_FAIL); |
259 SET_STRING("downloadCanceled", IDS_WALLPAPER_MANAGER_DOWNLOAD_CANCEL); | 259 SET_STRING("downloadCanceled", IDS_WALLPAPER_MANAGER_DOWNLOAD_CANCEL); |
260 SET_STRING("customWallpaperWarning", | 260 SET_STRING("customWallpaperWarning", |
261 IDS_WALLPAPER_MANAGER_SHOW_CUSTOM_WALLPAPER_ON_START_WARNING); | 261 IDS_WALLPAPER_MANAGER_SHOW_CUSTOM_WALLPAPER_ON_START_WARNING); |
262 SET_STRING("accessFileFailure", IDS_WALLPAPER_MANAGER_ACCESS_FILE_FAILURE); | 262 SET_STRING("accessFileFailure", IDS_WALLPAPER_MANAGER_ACCESS_FILE_FAILURE); |
263 SET_STRING("invalidWallpaper", IDS_WALLPAPER_MANAGER_INVALID_WALLPAPER); | 263 SET_STRING("invalidWallpaper", IDS_WALLPAPER_MANAGER_INVALID_WALLPAPER); |
264 SET_STRING("surpriseMeLabel", IDS_WALLPAPER_MANAGER_SURPRISE_ME_LABEL); | 264 SET_STRING("surpriseMeLabel", IDS_WALLPAPER_MANAGER_SURPRISE_ME_LABEL); |
265 SET_STRING("learnMore", IDS_LEARN_MORE); | 265 SET_STRING("learnMore", IDS_LEARN_MORE); |
| 266 SET_STRING("currentWallpaperSetByMessage", |
| 267 IDS_CURRENT_WALLPAPER_SET_BY_MESSAGE); |
266 #undef SET_STRING | 268 #undef SET_STRING |
267 | 269 |
268 webui::SetFontAndTextDirection(dict); | 270 webui::SetFontAndTextDirection(dict); |
269 | 271 |
270 chromeos::WallpaperManager* wallpaper_manager = | 272 chromeos::WallpaperManager* wallpaper_manager = |
271 chromeos::WallpaperManager::Get(); | 273 chromeos::WallpaperManager::Get(); |
272 chromeos::WallpaperInfo info; | 274 chromeos::WallpaperInfo info; |
273 | 275 |
274 if (wallpaper_manager->GetLoggedInUserWallpaperInfo(&info)) | 276 if (wallpaper_manager->GetLoggedInUserWallpaperInfo(&info)) |
275 dict->SetString("currentWallpaper", info.file); | 277 dict->SetString("currentWallpaper", info.file); |
276 | 278 |
277 #if defined(GOOGLE_CHROME_BUILD) | 279 #if defined(GOOGLE_CHROME_BUILD) |
278 dict->SetString("manifestBaseURL", kWallpaperManifestBaseURL); | 280 dict->SetString("manifestBaseURL", kWallpaperManifestBaseURL); |
279 #endif | 281 #endif |
280 | 282 |
| 283 Profile* profile = Profile::FromBrowserContext(browser_context()); |
| 284 std::string app_name( |
| 285 profile->GetPrefs()->GetString(prefs::kCurrentWallpaperAppName)); |
| 286 if (!app_name.empty()) |
| 287 dict->SetString("wallpaperAppName", app_name); |
| 288 |
281 dict->SetBoolean("isOEMDefaultWallpaper", IsOEMDefaultWallpaper()); | 289 dict->SetBoolean("isOEMDefaultWallpaper", IsOEMDefaultWallpaper()); |
282 dict->SetString("canceledWallpaper", | 290 dict->SetString("canceledWallpaper", |
283 wallpaper_api_util::kCancelWallpaperMessage); | 291 wallpaper_api_util::kCancelWallpaperMessage); |
284 return true; | 292 return true; |
285 } | 293 } |
286 | 294 |
287 WallpaperPrivateSetWallpaperIfExistsFunction:: | 295 WallpaperPrivateSetWallpaperIfExistsFunction:: |
288 WallpaperPrivateSetWallpaperIfExistsFunction() {} | 296 WallpaperPrivateSetWallpaperIfExistsFunction() {} |
289 | 297 |
290 WallpaperPrivateSetWallpaperIfExistsFunction:: | 298 WallpaperPrivateSetWallpaperIfExistsFunction:: |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 this, file_list)); | 886 this, file_list)); |
879 } | 887 } |
880 | 888 |
881 void WallpaperPrivateGetOfflineWallpaperListFunction::OnComplete( | 889 void WallpaperPrivateGetOfflineWallpaperListFunction::OnComplete( |
882 const std::vector<std::string>& file_list) { | 890 const std::vector<std::string>& file_list) { |
883 base::ListValue* results = new base::ListValue(); | 891 base::ListValue* results = new base::ListValue(); |
884 results->AppendStrings(file_list); | 892 results->AppendStrings(file_list); |
885 SetResult(results); | 893 SetResult(results); |
886 SendResponse(true); | 894 SendResponse(true); |
887 } | 895 } |
OLD | NEW |