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

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

Issue 10871049: Connect MediaFileSystemRegistry with MediaGalleriesPreferences (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
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 <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 error_ = kInvalidInteractive; 64 error_ = kInvalidInteractive;
65 return false; 65 return false;
66 } 66 }
67 67
68 void MediaGalleriesGetMediaFileSystemsFunction::ReturnGalleries() { 68 void MediaGalleriesGetMediaFileSystemsFunction::ReturnGalleries() {
69 const content::RenderProcessHost* rph = render_view_host()->GetProcess(); 69 const content::RenderProcessHost* rph = render_view_host()->GetProcess();
70 chrome::MediaFileSystemRegistry* media_fs_registry = 70 chrome::MediaFileSystemRegistry* media_fs_registry =
71 MediaFileSystemRegistry::GetInstance(); 71 MediaFileSystemRegistry::GetInstance();
72 const std::vector<MediaFileSystemRegistry::MediaFSInfo> filesystems = 72 const std::vector<MediaFileSystemRegistry::MediaFSInfo> filesystems =
73 media_fs_registry->GetMediaFileSystemsForExtension(rph, *GetExtension()); 73 media_fs_registry->GetMediaFileSystemsForExtension(rph, *GetExtension());
Lei Zhang 2012/08/24 04:39:04 Don't you need to pass in a rvh instead of a rph?
vandebo (ex-Chrome) 2012/09/04 21:02:20 Done.
74 74
75 const int child_id = rph->GetID(); 75 const int child_id = rph->GetID();
76 base::ListValue* list = new base::ListValue(); 76 base::ListValue* list = new base::ListValue();
77 for (size_t i = 0; i < filesystems.size(); i++) { 77 for (size_t i = 0; i < filesystems.size(); i++) {
78 base::DictionaryValue* dict_value = new base::DictionaryValue(); 78 base::DictionaryValue* dict_value = new base::DictionaryValue();
79 dict_value->SetWithoutPathExpansion( 79 dict_value->SetWithoutPathExpansion(
80 "fsid", Value::CreateStringValue(filesystems[i].fsid)); 80 "fsid", Value::CreateStringValue(filesystems[i].fsid));
81 // The directory name is not exposed to the js layer. 81 // The directory name is not exposed to the js layer.
82 dict_value->SetWithoutPathExpansion( 82 dict_value->SetWithoutPathExpansion(
83 "name", Value::CreateStringValue(filesystems[i].name)); 83 "name", Value::CreateStringValue(filesystems[i].name));
84 list->Append(dict_value); 84 list->Append(dict_value);
85 85
86 if (GetExtension()->HasAPIPermission( 86 if (!filesystems[i].path.empty() && GetExtension()->HasAPIPermission(
87 extensions::APIPermission::kMediaGalleriesRead)) { 87 extensions::APIPermission::kMediaGalleriesRead)) {
88 content::ChildProcessSecurityPolicy* policy = 88 content::ChildProcessSecurityPolicy* policy =
89 ChildProcessSecurityPolicy::GetInstance(); 89 ChildProcessSecurityPolicy::GetInstance();
90 if (!policy->CanReadFile(child_id, filesystems[i].path)) 90 if (!policy->CanReadFile(child_id, filesystems[i].path))
91 policy->GrantReadFile(child_id, filesystems[i].path); 91 policy->GrantReadFile(child_id, filesystems[i].path);
92 policy->GrantReadFileSystem(child_id, filesystems[i].fsid); 92 policy->GrantReadFileSystem(child_id, filesystems[i].fsid);
93 } 93 }
94 // TODO(vandebo) Handle write permission. 94 // TODO(vandebo) Handle write permission.
95 } 95 }
96 96
(...skipping 24 matching lines...) Expand all
121 MediaGalleriesAssembleMediaFileFunction:: 121 MediaGalleriesAssembleMediaFileFunction::
122 ~MediaGalleriesAssembleMediaFileFunction() {} 122 ~MediaGalleriesAssembleMediaFileFunction() {}
123 123
124 bool MediaGalleriesAssembleMediaFileFunction::RunImpl() { 124 bool MediaGalleriesAssembleMediaFileFunction::RunImpl() {
125 // TODO(vandebo) Update the metadata and return the new file. 125 // TODO(vandebo) Update the metadata and return the new file.
126 SetResult(Value::CreateNullValue()); 126 SetResult(Value::CreateNullValue());
127 return true; 127 return true;
128 } 128 }
129 129
130 } // namespace extensions 130 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698