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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 int index = -1; | 578 int index = -1; |
579 if (pref_id != kInvalidMediaGalleryPrefId) { | 579 if (pref_id != kInvalidMediaGalleryPrefId) { |
580 for (size_t i = 0; i < filesystems.size(); ++i) { | 580 for (size_t i = 0; i < filesystems.size(); ++i) { |
581 if (filesystems[i].pref_id == pref_id) { | 581 if (filesystems[i].pref_id == pref_id) { |
582 index = i; | 582 index = i; |
583 break; | 583 break; |
584 } | 584 } |
585 } | 585 } |
586 } | 586 } |
587 std::unique_ptr<base::DictionaryValue> results(new base::DictionaryValue); | 587 std::unique_ptr<base::DictionaryValue> results(new base::DictionaryValue); |
588 results->SetWithoutPathExpansion("mediaFileSystems", list.release()); | 588 results->SetWithoutPathExpansion("mediaFileSystems", std::move(list)); |
589 results->SetIntegerWithoutPathExpansion("selectedFileSystemIndex", index); | 589 results->SetIntegerWithoutPathExpansion("selectedFileSystemIndex", index); |
590 SetResult(std::move(results)); | 590 SetResult(std::move(results)); |
591 SendResponse(true); | 591 SendResponse(true); |
592 } | 592 } |
593 | 593 |
594 void | 594 void |
595 MediaGalleriesAddUserSelectedFolderFunction::GetMediaFileSystemsForExtension( | 595 MediaGalleriesAddUserSelectedFolderFunction::GetMediaFileSystemsForExtension( |
596 const MediaFileSystemsCallback& cb) { | 596 const MediaFileSystemsCallback& cb) { |
597 if (!render_frame_host()) { | 597 if (!render_frame_host()) { |
598 cb.Run(std::vector<MediaFileSystemInfo>()); | 598 cb.Run(std::vector<MediaFileSystemInfo>()); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 SendResponse(false); | 907 SendResponse(false); |
908 return; | 908 return; |
909 } | 909 } |
910 | 910 |
911 gallery_watch_manager()->RemoveWatch( | 911 gallery_watch_manager()->RemoveWatch( |
912 GetProfile(), extension_id(), gallery_pref_id); | 912 GetProfile(), extension_id(), gallery_pref_id); |
913 SendResponse(true); | 913 SendResponse(true); |
914 } | 914 } |
915 | 915 |
916 } // namespace extensions | 916 } // namespace extensions |
OLD | NEW |