OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Implements the Chrome Extensions Media Galleries API. | 5 // Implements the Chrome Extensions Media Galleries API. |
6 | 6 |
7 #include "chrome/browser/extensions/api/media_galleries/media_galleries_api.h" | 7 #include "chrome/browser/extensions/api/media_galleries/media_galleries_api.h" |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 // For the newly constructed Blob, store its image's metadata and Blob UUID. | 736 // For the newly constructed Blob, store its image's metadata and Blob UUID. |
737 base::ListValue* attached_images_list = NULL; | 737 base::ListValue* attached_images_list = NULL; |
738 result_dictionary->GetList(kAttachedImagesBlobInfoKey, &attached_images_list); | 738 result_dictionary->GetList(kAttachedImagesBlobInfoKey, &attached_images_list); |
739 DCHECK(attached_images_list); | 739 DCHECK(attached_images_list); |
740 DCHECK_LT(attached_images_list->GetSize(), attached_images->size()); | 740 DCHECK_LT(attached_images_list->GetSize(), attached_images->size()); |
741 | 741 |
742 metadata::AttachedImage* current_image = | 742 metadata::AttachedImage* current_image = |
743 &(*attached_images)[blob_uuids->size()]; | 743 &(*attached_images)[blob_uuids->size()]; |
744 std::unique_ptr<base::DictionaryValue> attached_image( | 744 std::unique_ptr<base::DictionaryValue> attached_image( |
745 new base::DictionaryValue); | 745 new base::DictionaryValue); |
746 attached_image->Set(kBlobUUIDKey, new base::StringValue( | 746 attached_image->Set(kBlobUUIDKey, new base::Value(current_blob->GetUUID())); |
747 current_blob->GetUUID())); | 747 attached_image->Set(kTypeKey, new base::Value(current_image->type)); |
748 attached_image->Set(kTypeKey, new base::StringValue( | |
749 current_image->type)); | |
750 attached_image->Set( | 748 attached_image->Set( |
751 kSizeKey, | 749 kSizeKey, |
752 new base::Value(base::checked_cast<int>(current_image->data.size()))); | 750 new base::Value(base::checked_cast<int>(current_image->data.size()))); |
753 attached_images_list->Append(std::move(attached_image)); | 751 attached_images_list->Append(std::move(attached_image)); |
754 | 752 |
755 blob_uuids->push_back(current_blob->GetUUID()); | 753 blob_uuids->push_back(current_blob->GetUUID()); |
756 | 754 |
757 content::RenderProcessHost* render_process_host = | 755 content::RenderProcessHost* render_process_host = |
758 render_frame_host()->GetProcess(); | 756 render_frame_host()->GetProcess(); |
759 if (!render_process_host) { | 757 if (!render_process_host) { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 SendResponse(false); | 907 SendResponse(false); |
910 return; | 908 return; |
911 } | 909 } |
912 | 910 |
913 gallery_watch_manager()->RemoveWatch( | 911 gallery_watch_manager()->RemoveWatch( |
914 GetProfile(), extension_id(), gallery_pref_id); | 912 GetProfile(), extension_id(), gallery_pref_id); |
915 SendResponse(true); | 913 SendResponse(true); |
916 } | 914 } |
917 | 915 |
918 } // namespace extensions | 916 } // namespace extensions |
OLD | NEW |