OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_IN_PROCESS_WEBKIT_DOM_STORAGE_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_MESSAGE_FILTER_H_ |
6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_MESSAGE_FILTER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/process.h" | 10 #include "base/process.h" |
11 #include "content/browser/browser_message_filter.h" | 11 #include "content/browser/browser_message_filter.h" |
12 #include "content/browser/in_process_webkit/dom_storage_area.h" | 12 #include "content/browser/in_process_webkit/dom_storage_area.h" |
13 #include "content/browser/in_process_webkit/webkit_context.h" | 13 #include "content/browser/in_process_webkit/webkit_context.h" |
14 #include "content/common/dom_storage_common.h" | 14 #include "content/common/dom_storage_common.h" |
15 | 15 |
16 class DOMStorageContext; | 16 class DOMStorageContext; |
17 class GURL; | 17 class GURL; |
18 struct DOMStorageMsg_Event_Params; | 18 struct DOMStorageMsg_Event_Params; |
19 | 19 |
20 // This class handles the logistics of DOM Storage within the browser process. | 20 // This class handles the logistics of DOM Storage within the browser process. |
21 // It mostly ferries information between IPCs and the WebKit implementations, | 21 // It mostly ferries information between IPCs and the WebKit implementations, |
22 // but it also handles some special cases like when renderer processes die. | 22 // but it also handles some special cases like when renderer processes die. |
23 class DOMStorageMessageFilter : public BrowserMessageFilter { | 23 class DOMStorageMessageFilter : public BrowserMessageFilter { |
24 public: | 24 public: |
25 // Only call the constructor from the UI thread. | 25 // Only call the constructor from the UI thread. |
26 DOMStorageMessageFilter(int process_id, WebKitContext* webkit_context); | 26 DOMStorageMessageFilter(int process_id, WebKitContext* webkit_context); |
27 | 27 |
28 // BrowserMessageFilter implementation | 28 // BrowserMessageFilter implementation |
29 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 29 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
30 virtual void OverrideThreadForMessage(const IPC::Message& message, | 30 virtual void OverrideThreadForMessage( |
31 BrowserThread::ID* thread) OVERRIDE; | 31 const IPC::Message& message, |
| 32 content::BrowserThread::ID* thread) OVERRIDE; |
32 virtual bool OnMessageReceived(const IPC::Message& message, | 33 virtual bool OnMessageReceived(const IPC::Message& message, |
33 bool* message_was_ok) OVERRIDE; | 34 bool* message_was_ok) OVERRIDE; |
34 virtual void OnDestruct() const OVERRIDE; | 35 virtual void OnDestruct() const OVERRIDE; |
35 | 36 |
36 // Only call on the WebKit thread. | 37 // Only call on the WebKit thread. |
37 static void DispatchStorageEvent(const NullableString16& key, | 38 static void DispatchStorageEvent(const NullableString16& key, |
38 const NullableString16& old_value, const NullableString16& new_value, | 39 const NullableString16& old_value, const NullableString16& new_value, |
39 const string16& origin, const GURL& url, bool is_local_storage); | 40 const string16& origin, const GURL& url, bool is_local_storage); |
40 | 41 |
41 private: | 42 private: |
42 friend class BrowserThread; | 43 friend class content::BrowserThread; |
43 friend class DeleteTask<DOMStorageMessageFilter>; | 44 friend class DeleteTask<DOMStorageMessageFilter>; |
44 virtual ~DOMStorageMessageFilter(); | 45 virtual ~DOMStorageMessageFilter(); |
45 | 46 |
46 // Message Handlers. | 47 // Message Handlers. |
47 void OnStorageAreaId(int64 namespace_id, const string16& origin, | 48 void OnStorageAreaId(int64 namespace_id, const string16& origin, |
48 int64* storage_area_id); | 49 int64* storage_area_id); |
49 void OnLength(int64 storage_area_id, unsigned* length); | 50 void OnLength(int64 storage_area_id, unsigned* length); |
50 void OnKey(int64 storage_area_id, unsigned index, NullableString16* key); | 51 void OnKey(int64 storage_area_id, unsigned index, NullableString16* key); |
51 void OnGetItem(int64 storage_area_id, const string16& key, | 52 void OnGetItem(int64 storage_area_id, const string16& key, |
52 NullableString16* value); | 53 NullableString16* value); |
(...skipping 29 matching lines...) Expand all Loading... |
82 // Data shared between renderer processes with the same browser context. | 83 // Data shared between renderer processes with the same browser context. |
83 scoped_refptr<WebKitContext> webkit_context_; | 84 scoped_refptr<WebKitContext> webkit_context_; |
84 | 85 |
85 // Used to dispatch messages to the correct view host. | 86 // Used to dispatch messages to the correct view host. |
86 int process_id_; | 87 int process_id_; |
87 | 88 |
88 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageMessageFilter); | 89 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageMessageFilter); |
89 }; | 90 }; |
90 | 91 |
91 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_MESSAGE_FILTER_H_ | 92 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_MESSAGE_FILTER_H_ |
OLD | NEW |