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

Side by Side Diff: content/browser/blob_storage/blob_dispatcher_host.h

Issue 2214293002: [BlobStorage] Added back security policy for files in blobs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: forgot filesystem Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 14 matching lines...) Expand all
25 namespace IPC { 25 namespace IPC {
26 class Sender; 26 class Sender;
27 } 27 }
28 28
29 namespace storage { 29 namespace storage {
30 class DataElement; 30 class DataElement;
31 class BlobDataBuilder; 31 class BlobDataBuilder;
32 struct BlobItemBytesRequest; 32 struct BlobItemBytesRequest;
33 struct BlobItemBytesResponse; 33 struct BlobItemBytesResponse;
34 class BlobStorageContext; 34 class BlobStorageContext;
35 class FileSystemContext;
35 } 36 }
36 37
37 namespace content { 38 namespace content {
39 class ChildProcessSecurityPolicyImpl;
38 class ChromeBlobStorageContext; 40 class ChromeBlobStorageContext;
39 41
40 // This class's responsibility is to listen for and dispatch blob storage 42 // This class's responsibility is to listen for and dispatch blob storage
41 // messages and handle logistics of blob storage for a single child process. 43 // messages and handle logistics of blob storage for a single child process.
42 // When the child process terminates all blob references attributable to 44 // When the child process terminates all blob references attributable to
43 // that process go away upon destruction of the instance. 45 // that process go away upon destruction of the instance.
44 // This lives in the browser process, is single threaded (IO thread), and there 46 // This lives in the browser process, is single threaded (IO thread), and there
45 // is one per child process. 47 // is one per child process.
46 class CONTENT_EXPORT BlobDispatcherHost : public BrowserMessageFilter { 48 class CONTENT_EXPORT BlobDispatcherHost : public BrowserMessageFilter {
47 public: 49 public:
48 explicit BlobDispatcherHost(ChromeBlobStorageContext* blob_storage_context); 50 BlobDispatcherHost(int process_id,
51 storage::FileSystemContext* file_system_context,
52 ChromeBlobStorageContext* blob_storage_context);
kinuko 2016/08/05 15:27:31 nit: I'd place file_system_context parameter after
dmurph 2016/08/05 19:12:45 Done.
49 53
50 // BrowserMessageFilter implementation. 54 // BrowserMessageFilter implementation.
51 void OnChannelClosing() override; 55 void OnChannelClosing() override;
52 bool OnMessageReceived(const IPC::Message& message) override; 56 bool OnMessageReceived(const IPC::Message& message) override;
53 57
54 protected: 58 protected:
55 ~BlobDispatcherHost() override; 59 ~BlobDispatcherHost() override;
56 60
57 // For testing use only. 61 // For testing use only.
58 void SetMemoryConstantsForTesting(size_t max_ipc_memory_size, 62 void SetMemoryConstantsForTesting(size_t max_ipc_memory_size,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // Send the appropriate IPC response to the renderer for the given result. 129 // Send the appropriate IPC response to the renderer for the given result.
126 void SendIPCResponse(const std::string& uuid, 130 void SendIPCResponse(const std::string& uuid,
127 storage::BlobTransportResult result); 131 storage::BlobTransportResult result);
128 132
129 bool IsInUseInHost(const std::string& uuid); 133 bool IsInUseInHost(const std::string& uuid);
130 bool IsUrlRegisteredInHost(const GURL& blob_url); 134 bool IsUrlRegisteredInHost(const GURL& blob_url);
131 135
132 // Unregisters all blobs and urls that were registered in this host. 136 // Unregisters all blobs and urls that were registered in this host.
133 void ClearHostFromBlobStorageContext(); 137 void ClearHostFromBlobStorageContext();
134 138
139 int process_id_;
kinuko 2016/08/05 15:27:31 const
dmurph 2016/08/05 19:12:45 Done.
140 storage::FileSystemContext* file_system_context_;
kinuko 2016/08/05 15:27:31 nit: I think this'd be safe, but maybe we'd better
dmurph 2016/08/05 19:12:45 The FileApiMessageFilter just stores the raw point
kinuko 2016/08/08 15:52:28 Either works for me as far as we don't crash/leak,
dmurph 2016/08/15 18:25:04 Done.
141 ChildProcessSecurityPolicyImpl* security_policy_;
142
135 // Collection of blob ids and a count of how many usages 143 // Collection of blob ids and a count of how many usages
136 // of that id are attributable to this consumer. 144 // of that id are attributable to this consumer.
137 BlobReferenceMap blobs_inuse_map_; 145 BlobReferenceMap blobs_inuse_map_;
138 146
139 // The set of public blob urls coined by this consumer. 147 // The set of public blob urls coined by this consumer.
140 std::set<GURL> public_blob_urls_; 148 std::set<GURL> public_blob_urls_;
141 149
142 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; 150 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
143 storage::BlobAsyncBuilderHost async_builder_; 151 storage::BlobAsyncBuilderHost async_builder_;
144 152
145 DISALLOW_COPY_AND_ASSIGN(BlobDispatcherHost); 153 DISALLOW_COPY_AND_ASSIGN(BlobDispatcherHost);
146 }; 154 };
147 } // namespace content 155 } // namespace content
148 #endif // CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_ 156 #endif // CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698