Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: chrome/browser/extensions/api/media_galleries/media_galleries_api.cc

Issue 11196007: Fix media galleries crash when the window is closed with config dialog open. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698