OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_RENDERER_HOST_BLOB_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BLOB_MESSAGE_FILTER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_BLOB_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_BLOB_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include "base/hash_tables.h" | 8 #include "base/hash_tables.h" |
9 #include "content/browser/browser_message_filter.h" | 9 #include "content/browser/browser_message_filter.h" |
10 | 10 |
11 class ChromeBlobStorageContext; | 11 class ChromeBlobStorageContext; |
12 class GURL; | 12 class GURL; |
13 | 13 |
14 namespace IPC { | 14 namespace IPC { |
15 class Message; | 15 class Message; |
16 } | 16 } |
17 | 17 |
18 namespace webkit_blob { | 18 namespace webkit_blob { |
19 class BlobData; | 19 class BlobData; |
20 } | 20 } |
21 | 21 |
22 class BlobMessageFilter : public BrowserMessageFilter { | 22 class BlobMessageFilter : public BrowserMessageFilter { |
23 public: | 23 public: |
24 BlobMessageFilter(int process_id, | 24 BlobMessageFilter(int process_id, |
25 ChromeBlobStorageContext* blob_storage_context); | 25 ChromeBlobStorageContext* blob_storage_context); |
26 ~BlobMessageFilter(); | 26 virtual ~BlobMessageFilter(); |
27 | 27 |
28 // BrowserMessageFilter implementation. | 28 // BrowserMessageFilter implementation. |
29 virtual void OnChannelClosing(); | 29 virtual void OnChannelClosing(); |
30 virtual bool OnMessageReceived(const IPC::Message& message, | 30 virtual bool OnMessageReceived(const IPC::Message& message, |
31 bool* message_was_ok); | 31 bool* message_was_ok); |
32 | 32 |
33 private: | 33 private: |
34 void OnRegisterBlobUrl(const GURL& url, | 34 void OnRegisterBlobUrl(const GURL& url, |
35 const scoped_refptr<webkit_blob::BlobData>& blob_data); | 35 const scoped_refptr<webkit_blob::BlobData>& blob_data); |
36 void OnRegisterBlobUrlFrom(const GURL& url, const GURL& src_url); | 36 void OnRegisterBlobUrlFrom(const GURL& url, const GURL& src_url); |
37 void OnUnregisterBlobUrl(const GURL& url); | 37 void OnUnregisterBlobUrl(const GURL& url); |
38 | 38 |
39 bool CheckPermission(webkit_blob::BlobData* blob_data) const; | 39 bool CheckPermission(webkit_blob::BlobData* blob_data) const; |
40 | 40 |
41 int process_id_; | 41 int process_id_; |
42 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; | 42 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; |
43 | 43 |
44 // Keep track of blob URLs registered in this process. Need to unregister | 44 // Keep track of blob URLs registered in this process. Need to unregister |
45 // all of them when the renderer process dies. | 45 // all of them when the renderer process dies. |
46 base::hash_set<std::string> blob_urls_; | 46 base::hash_set<std::string> blob_urls_; |
47 | 47 |
48 DISALLOW_IMPLICIT_CONSTRUCTORS(BlobMessageFilter); | 48 DISALLOW_IMPLICIT_CONSTRUCTORS(BlobMessageFilter); |
49 }; | 49 }; |
50 | 50 |
51 #endif // CONTENT_BROWSER_RENDERER_HOST_BLOB_MESSAGE_FILTER_H_ | 51 #endif // CONTENT_BROWSER_RENDERER_HOST_BLOB_MESSAGE_FILTER_H_ |
OLD | NEW |