| 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 <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 | 627 |
| 628 bool update_wallpaper = | 628 bool update_wallpaper = |
| 629 account_id_ == | 629 account_id_ == |
| 630 user_manager::UserManager::Get()->GetActiveUser()->GetAccountId(); | 630 user_manager::UserManager::Get()->GetActiveUser()->GetAccountId(); |
| 631 wallpaper_manager->SetCustomWallpaper( | 631 wallpaper_manager->SetCustomWallpaper( |
| 632 account_id_, user_id_hash_, params->file_name, layout, | 632 account_id_, user_id_hash_, params->file_name, layout, |
| 633 user_manager::User::CUSTOMIZED, image, update_wallpaper); | 633 user_manager::User::CUSTOMIZED, image, update_wallpaper); |
| 634 unsafe_wallpaper_decoder_ = NULL; | 634 unsafe_wallpaper_decoder_ = NULL; |
| 635 | 635 |
| 636 Profile* profile = Profile::FromBrowserContext(browser_context()); | 636 Profile* profile = Profile::FromBrowserContext(browser_context()); |
| 637 // This API is only available to the component wallpaper picker. We do not | 637 // TODO(xdai): This preference is unused now. For compatiblity concern, we |
| 638 // need to show the app's name if it is the component wallpaper picker. So set | 638 // need to keep it until it's safe to clean it up. |
| 639 // the pref to empty string. | |
| 640 profile->GetPrefs()->SetString(prefs::kCurrentWallpaperAppName, | 639 profile->GetPrefs()->SetString(prefs::kCurrentWallpaperAppName, |
| 641 std::string()); | 640 std::string()); |
| 642 | 641 |
| 643 if (params->generate_thumbnail) { | 642 if (params->generate_thumbnail) { |
| 644 image.EnsureRepsForSupportedScales(); | 643 image.EnsureRepsForSupportedScales(); |
| 645 scoped_ptr<gfx::ImageSkia> deep_copy(image.DeepCopy()); | 644 scoped_ptr<gfx::ImageSkia> deep_copy(image.DeepCopy()); |
| 646 // Generates thumbnail before call api function callback. We can then | 645 // Generates thumbnail before call api function callback. We can then |
| 647 // request thumbnail in the javascript callback. | 646 // request thumbnail in the javascript callback. |
| 648 task_runner->PostTask(FROM_HERE, | 647 task_runner->PostTask(FROM_HERE, |
| 649 base::Bind( | 648 base::Bind( |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 this, file_list)); | 926 this, file_list)); |
| 928 } | 927 } |
| 929 | 928 |
| 930 void WallpaperPrivateGetOfflineWallpaperListFunction::OnComplete( | 929 void WallpaperPrivateGetOfflineWallpaperListFunction::OnComplete( |
| 931 const std::vector<std::string>& file_list) { | 930 const std::vector<std::string>& file_list) { |
| 932 base::ListValue* results = new base::ListValue(); | 931 base::ListValue* results = new base::ListValue(); |
| 933 results->AppendStrings(file_list); | 932 results->AppendStrings(file_list); |
| 934 SetResult(results); | 933 SetResult(results); |
| 935 SendResponse(true); | 934 SendResponse(true); |
| 936 } | 935 } |
| OLD | NEW |