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 <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 &data, NULL); | 709 &data, NULL); |
710 BrowserThread::PostTask( | 710 BrowserThread::PostTask( |
711 BrowserThread::UI, FROM_HERE, | 711 BrowserThread::UI, FROM_HERE, |
712 base::Bind( | 712 base::Bind( |
713 &WallpaperPrivateSetCustomWallpaperFunction::ThumbnailGenerated, this, | 713 &WallpaperPrivateSetCustomWallpaperFunction::ThumbnailGenerated, this, |
714 base::RetainedRef(data))); | 714 base::RetainedRef(data))); |
715 } | 715 } |
716 | 716 |
717 void WallpaperPrivateSetCustomWallpaperFunction::ThumbnailGenerated( | 717 void WallpaperPrivateSetCustomWallpaperFunction::ThumbnailGenerated( |
718 base::RefCountedBytes* data) { | 718 base::RefCountedBytes* data) { |
719 BinaryValue* result = BinaryValue::CreateWithCopiedBuffer( | 719 SetResult(BinaryValue::CreateWithCopiedBuffer( |
720 reinterpret_cast<const char*>(data->front()), data->size()); | 720 reinterpret_cast<const char*>(data->front()), data->size())); |
721 SetResult(base::WrapUnique(result)); | |
722 SendResponse(true); | 721 SendResponse(true); |
723 } | 722 } |
724 | 723 |
725 WallpaperPrivateSetCustomWallpaperLayoutFunction:: | 724 WallpaperPrivateSetCustomWallpaperLayoutFunction:: |
726 WallpaperPrivateSetCustomWallpaperLayoutFunction() {} | 725 WallpaperPrivateSetCustomWallpaperLayoutFunction() {} |
727 | 726 |
728 WallpaperPrivateSetCustomWallpaperLayoutFunction:: | 727 WallpaperPrivateSetCustomWallpaperLayoutFunction:: |
729 ~WallpaperPrivateSetCustomWallpaperLayoutFunction() {} | 728 ~WallpaperPrivateSetCustomWallpaperLayoutFunction() {} |
730 | 729 |
731 bool WallpaperPrivateSetCustomWallpaperLayoutFunction::RunAsync() { | 730 bool WallpaperPrivateSetCustomWallpaperLayoutFunction::RunAsync() { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 file_name.c_str())); | 834 file_name.c_str())); |
836 SendResponse(false); | 835 SendResponse(false); |
837 } | 836 } |
838 | 837 |
839 void WallpaperPrivateGetThumbnailFunction::FileNotLoaded() { | 838 void WallpaperPrivateGetThumbnailFunction::FileNotLoaded() { |
840 SendResponse(true); | 839 SendResponse(true); |
841 } | 840 } |
842 | 841 |
843 void WallpaperPrivateGetThumbnailFunction::FileLoaded( | 842 void WallpaperPrivateGetThumbnailFunction::FileLoaded( |
844 const std::string& data) { | 843 const std::string& data) { |
845 BinaryValue* thumbnail = BinaryValue::CreateWithCopiedBuffer(data.c_str(), | 844 SetResult(BinaryValue::CreateWithCopiedBuffer(data.c_str(), data.size())); |
846 data.size()); | |
847 SetResult(base::WrapUnique(thumbnail)); | |
848 SendResponse(true); | 845 SendResponse(true); |
849 } | 846 } |
850 | 847 |
851 void WallpaperPrivateGetThumbnailFunction::Get(const base::FilePath& path) { | 848 void WallpaperPrivateGetThumbnailFunction::Get(const base::FilePath& path) { |
852 DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread( | 849 DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread( |
853 sequence_token_)); | 850 sequence_token_)); |
854 std::string data; | 851 std::string data; |
855 if (GetData(path, &data)) { | 852 if (GetData(path, &data)) { |
856 if (data.empty()) { | 853 if (data.empty()) { |
857 BrowserThread::PostTask( | 854 BrowserThread::PostTask( |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 bool WallpaperPrivateRecordWallpaperUMAFunction::RunSync() { | 976 bool WallpaperPrivateRecordWallpaperUMAFunction::RunSync() { |
980 std::unique_ptr<record_wallpaper_uma::Params> params( | 977 std::unique_ptr<record_wallpaper_uma::Params> params( |
981 record_wallpaper_uma::Params::Create(*args_)); | 978 record_wallpaper_uma::Params::Create(*args_)); |
982 EXTENSION_FUNCTION_VALIDATE(params); | 979 EXTENSION_FUNCTION_VALIDATE(params); |
983 | 980 |
984 user_manager::User::WallpaperType source = getWallpaperType(params->source); | 981 user_manager::User::WallpaperType source = getWallpaperType(params->source); |
985 UMA_HISTOGRAM_ENUMERATION("Ash.Wallpaper.Source", source, | 982 UMA_HISTOGRAM_ENUMERATION("Ash.Wallpaper.Source", source, |
986 user_manager::User::WALLPAPER_TYPE_COUNT); | 983 user_manager::User::WALLPAPER_TYPE_COUNT); |
987 return true; | 984 return true; |
988 } | 985 } |
OLD | NEW |