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 <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 114 } |
115 | 115 |
116 void MediaGalleriesGetMediaFileSystemsFunction::GetAndReturnGalleries() { | 116 void MediaGalleriesGetMediaFileSystemsFunction::GetAndReturnGalleries() { |
117 MediaFileSystemRegistry::GetInstance()->GetMediaFileSystemsForExtension( | 117 MediaFileSystemRegistry::GetInstance()->GetMediaFileSystemsForExtension( |
118 render_view_host(), GetExtension(), base::Bind( | 118 render_view_host(), GetExtension(), base::Bind( |
119 &MediaGalleriesGetMediaFileSystemsFunction::ReturnGalleries, this)); | 119 &MediaGalleriesGetMediaFileSystemsFunction::ReturnGalleries, this)); |
120 } | 120 } |
121 | 121 |
122 void MediaGalleriesGetMediaFileSystemsFunction::ReturnGalleries( | 122 void MediaGalleriesGetMediaFileSystemsFunction::ReturnGalleries( |
123 const std::vector<MediaFileSystemInfo>& filesystems) { | 123 const std::vector<MediaFileSystemInfo>& filesystems) { |
124 const int child_id = render_view_host()->GetProcess()->GetID(); | 124 content::RenderViewHost* rvh = render_view_host(); |
| 125 if (!rvh) { |
| 126 SendResponse(false); |
| 127 return; |
| 128 } |
| 129 const int child_id = rvh->GetProcess()->GetID(); |
125 std::set<std::string> file_system_names; | 130 std::set<std::string> file_system_names; |
126 base::ListValue* list = new base::ListValue(); | 131 base::ListValue* list = new base::ListValue(); |
127 for (size_t i = 0; i < filesystems.size(); i++) { | 132 for (size_t i = 0; i < filesystems.size(); i++) { |
128 scoped_ptr<base::DictionaryValue> file_system_dict_value( | 133 scoped_ptr<base::DictionaryValue> file_system_dict_value( |
129 new base::DictionaryValue()); | 134 new base::DictionaryValue()); |
130 | 135 |
131 // Send the file system id so the renderer can create a valid FileSystem | 136 // Send the file system id so the renderer can create a valid FileSystem |
132 // object. | 137 // object. |
133 file_system_dict_value->SetWithoutPathExpansion( | 138 file_system_dict_value->SetWithoutPathExpansion( |
134 "fsid", Value::CreateStringValue(filesystems[i].fsid)); | 139 "fsid", Value::CreateStringValue(filesystems[i].fsid)); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 bool MediaGalleriesAssembleMediaFileFunction::RunImpl() { | 194 bool MediaGalleriesAssembleMediaFileFunction::RunImpl() { |
190 if (!ApiIsAccessible(&error_)) | 195 if (!ApiIsAccessible(&error_)) |
191 return false; | 196 return false; |
192 | 197 |
193 // TODO(vandebo) Update the metadata and return the new file. | 198 // TODO(vandebo) Update the metadata and return the new file. |
194 SetResult(Value::CreateNullValue()); | 199 SetResult(Value::CreateNullValue()); |
195 return true; | 200 return true; |
196 } | 201 } |
197 | 202 |
198 } // namespace extensions | 203 } // namespace extensions |
OLD | NEW |