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

Side by Side Diff: content/browser/fileapi/fileapi_message_filter.cc

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 #include "content/browser/fileapi/fileapi_message_filter.h" 5 #include "content/browser/fileapi/fileapi_message_filter.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 int process_id, 63 int process_id,
64 net::URLRequestContextGetter* request_context_getter, 64 net::URLRequestContextGetter* request_context_getter,
65 fileapi::FileSystemContext* file_system_context, 65 fileapi::FileSystemContext* file_system_context,
66 ChromeBlobStorageContext* blob_storage_context) 66 ChromeBlobStorageContext* blob_storage_context)
67 : process_id_(process_id), 67 : process_id_(process_id),
68 context_(file_system_context), 68 context_(file_system_context),
69 request_context_getter_(request_context_getter), 69 request_context_getter_(request_context_getter),
70 request_context_(NULL), 70 request_context_(NULL),
71 blob_storage_context_(blob_storage_context) { 71 blob_storage_context_(blob_storage_context) {
72 DCHECK(context_); 72 DCHECK(context_);
73 DCHECK(request_context_getter_); 73 DCHECK(request_context_getter_.get());
74 DCHECK(blob_storage_context); 74 DCHECK(blob_storage_context);
75 } 75 }
76 76
77 FileAPIMessageFilter::FileAPIMessageFilter( 77 FileAPIMessageFilter::FileAPIMessageFilter(
78 int process_id, 78 int process_id,
79 net::URLRequestContext* request_context, 79 net::URLRequestContext* request_context,
80 fileapi::FileSystemContext* file_system_context, 80 fileapi::FileSystemContext* file_system_context,
81 ChromeBlobStorageContext* blob_storage_context) 81 ChromeBlobStorageContext* blob_storage_context)
82 : process_id_(process_id), 82 : process_id_(process_id),
83 context_(file_system_context), 83 context_(file_system_context),
84 request_context_(request_context), 84 request_context_(request_context),
85 blob_storage_context_(blob_storage_context) { 85 blob_storage_context_(blob_storage_context) {
86 DCHECK(context_); 86 DCHECK(context_);
87 DCHECK(request_context_); 87 DCHECK(request_context_);
88 DCHECK(blob_storage_context); 88 DCHECK(blob_storage_context);
89 } 89 }
90 90
91 void FileAPIMessageFilter::OnChannelConnected(int32 peer_pid) { 91 void FileAPIMessageFilter::OnChannelConnected(int32 peer_pid) {
92 BrowserMessageFilter::OnChannelConnected(peer_pid); 92 BrowserMessageFilter::OnChannelConnected(peer_pid);
93 93
94 if (request_context_getter_) { 94 if (request_context_getter_.get()) {
95 DCHECK(!request_context_); 95 DCHECK(!request_context_);
96 request_context_ = request_context_getter_->GetURLRequestContext(); 96 request_context_ = request_context_getter_->GetURLRequestContext();
97 request_context_getter_ = NULL; 97 request_context_getter_ = NULL;
98 DCHECK(request_context_); 98 DCHECK(request_context_);
99 } 99 }
100 } 100 }
101 101
102 void FileAPIMessageFilter::OnChannelClosing() { 102 void FileAPIMessageFilter::OnChannelClosing() {
103 BrowserMessageFilter::OnChannelClosing(); 103 BrowserMessageFilter::OnChannelClosing();
104 104
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 // that the renderer can read the file's platform path. If this is the case 750 // that the renderer can read the file's platform path. If this is the case
751 // the renderer should be granted read permission for the file's platform 751 // the renderer should be granted read permission for the file's platform
752 // path. This can happen in the following situations: 752 // path. This can happen in the following situations:
753 // - the file comes from sandboxed filesystem. Reading sandboxed files is 753 // - the file comes from sandboxed filesystem. Reading sandboxed files is
754 // always permitted, but only implicitly. 754 // always permitted, but only implicitly.
755 // - the underlying filesystem returned newly created snapshot file. 755 // - the underlying filesystem returned newly created snapshot file.
756 // - the nominal path differs from the platform path. This can happen even 756 // - the nominal path differs from the platform path. This can happen even
757 // when the filesystem has been granted permissions. This happens with: 757 // when the filesystem has been granted permissions. This happens with:
758 // - Drive filesystems 758 // - Drive filesystems
759 // - Picasa filesystems 759 // - Picasa filesystems
760 DCHECK(snapshot_file || 760 DCHECK(snapshot_file.get() ||
761 fileapi::SandboxMountPointProvider::IsSandboxType(url.type()) || 761 fileapi::SandboxMountPointProvider::IsSandboxType(url.type()) ||
762 url.type() == fileapi::kFileSystemTypeDrive || 762 url.type() == fileapi::kFileSystemTypeDrive ||
763 url.type() == fileapi::kFileSystemTypePicasa); 763 url.type() == fileapi::kFileSystemTypePicasa);
764 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( 764 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
765 process_id_, platform_path); 765 process_id_, platform_path);
766 if (snapshot_file) { 766 if (snapshot_file.get()) {
767 // This will revoke all permissions for the file when the last ref 767 // This will revoke all permissions for the file when the last ref
768 // of the file is dropped (assuming it's ok). 768 // of the file is dropped (assuming it's ok).
769 snapshot_file->AddFinalReleaseCallback( 769 snapshot_file->AddFinalReleaseCallback(
770 base::Bind(&RevokeFilePermission, process_id_)); 770 base::Bind(&RevokeFilePermission, process_id_));
771 } 771 }
772 } 772 }
773 773
774 if (snapshot_file) { 774 if (snapshot_file.get()) {
775 // This ref is held until OnDidReceiveSnapshotFile is called. 775 // This ref is held until OnDidReceiveSnapshotFile is called.
776 in_transit_snapshot_files_[request_id] = snapshot_file; 776 in_transit_snapshot_files_[request_id] = snapshot_file;
777 } 777 }
778 778
779 // Return the file info and platform_path. 779 // Return the file info and platform_path.
780 Send(new FileSystemMsg_DidCreateSnapshotFile( 780 Send(new FileSystemMsg_DidCreateSnapshotFile(
781 request_id, info, platform_path)); 781 request_id, info, platform_path));
782 } 782 }
783 783
784 bool FileAPIMessageFilter::HasPermissionsForFile( 784 bool FileAPIMessageFilter::HasPermissionsForFile(
(...skipping 12 matching lines...) Expand all
797 Send(new FileSystemMsg_DidFail(request_id, error_code)); 797 Send(new FileSystemMsg_DidFail(request_id, error_code));
798 return NULL; 798 return NULL;
799 } 799 }
800 800
801 DCHECK(operation); 801 DCHECK(operation);
802 operations_.AddWithID(operation, request_id); 802 operations_.AddWithID(operation, request_id);
803 return operation; 803 return operation;
804 } 804 }
805 805
806 } // namespace content 806 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/chrome_blob_storage_context.cc ('k') | content/browser/geolocation/device_data_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698