OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ |
6 #define EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "content/public/browser/browser_message_filter.h" | 14 #include "content/public/browser/browser_message_filter.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
17 struct ExtensionHostMsg_Request_Params; | 17 struct ExtensionHostMsg_Request_Params; |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class DictionaryValue; | 20 class DictionaryValue; |
21 } | 21 } |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 class BrowserContext; | 24 class BrowserContext; |
25 class WebContents; | 25 class WebContents; |
26 } | 26 } |
27 | 27 |
28 namespace gfx { | |
29 class Size; | |
30 } | |
31 | |
28 namespace extensions { | 32 namespace extensions { |
29 | 33 |
30 class InfoMap; | 34 class InfoMap; |
31 | 35 |
32 // This class filters out incoming extension-specific IPC messages from the | 36 // This class filters out incoming extension-specific IPC messages from the |
33 // renderer process. It is created on the UI thread. Messages may be handled on | 37 // renderer process. It is created on the UI thread. Messages may be handled on |
34 // the IO thread or the UI thread. | 38 // the IO thread or the UI thread. |
35 class ExtensionMessageFilter : public content::BrowserMessageFilter { | 39 class ExtensionMessageFilter : public content::BrowserMessageFilter { |
36 public: | 40 public: |
37 ExtensionMessageFilter(int render_process_id, | 41 ExtensionMessageFilter(int render_process_id, |
(...skipping 19 matching lines...) Expand all Loading... | |
57 const std::string& event_name); | 61 const std::string& event_name); |
58 void OnExtensionRemoveListener(const std::string& extension_id, | 62 void OnExtensionRemoveListener(const std::string& extension_id, |
59 const GURL& listener_url, | 63 const GURL& listener_url, |
60 const std::string& event_name); | 64 const std::string& event_name); |
61 void OnExtensionAddLazyListener(const std::string& extension_id, | 65 void OnExtensionAddLazyListener(const std::string& extension_id, |
62 const std::string& event_name); | 66 const std::string& event_name); |
63 void OnExtensionAttachGuest(int routing_id, | 67 void OnExtensionAttachGuest(int routing_id, |
64 int element_instance_id, | 68 int element_instance_id, |
65 int guest_instance_id, | 69 int guest_instance_id, |
66 const base::DictionaryValue& attach_params); | 70 const base::DictionaryValue& attach_params); |
67 void OnExtensionCreateMimeHandlerViewGuest(int render_frame_id, | 71 void OnExtensionCreateMimeHandlerViewGuest( |
68 const std::string& url, | 72 int render_frame_id, |
69 const std::string& content_url, | 73 int element_instance_id, |
70 const std::string& mime_type, | 74 const base::DictionaryValue& create_params); |
71 int element_instance_id); | |
72 void OnExtensionRemoveLazyListener(const std::string& extension_id, | 75 void OnExtensionRemoveLazyListener(const std::string& extension_id, |
73 const std::string& event_name); | 76 const std::string& event_name); |
74 void OnExtensionAddFilteredListener(const std::string& extension_id, | 77 void OnExtensionAddFilteredListener(const std::string& extension_id, |
75 const std::string& event_name, | 78 const std::string& event_name, |
76 const base::DictionaryValue& filter, | 79 const base::DictionaryValue& filter, |
77 bool lazy); | 80 bool lazy); |
78 void OnExtensionRemoveFilteredListener(const std::string& extension_id, | 81 void OnExtensionRemoveFilteredListener(const std::string& extension_id, |
79 const std::string& event_name, | 82 const std::string& event_name, |
80 const base::DictionaryValue& filter, | 83 const base::DictionaryValue& filter, |
81 bool lazy); | 84 bool lazy); |
82 void OnExtensionShouldSuspendAck(const std::string& extension_id, | 85 void OnExtensionShouldSuspendAck(const std::string& extension_id, |
83 int sequence_id); | 86 int sequence_id); |
84 void OnExtensionSuspendAck(const std::string& extension_id); | 87 void OnExtensionSuspendAck(const std::string& extension_id); |
85 void OnExtensionTransferBlobsAck(const std::vector<std::string>& blob_uuids); | 88 void OnExtensionTransferBlobsAck(const std::vector<std::string>& blob_uuids); |
86 | 89 |
87 // Message handlers on the IO thread. | 90 // Message handlers on the IO thread. |
88 void OnExtensionGenerateUniqueID(int* unique_id); | 91 void OnExtensionGenerateUniqueID(int* unique_id); |
89 void OnExtensionResumeRequests(int route_id); | 92 void OnExtensionResumeRequests(int route_id); |
90 void OnExtensionRequestForIOThread( | 93 void OnExtensionRequestForIOThread( |
91 int routing_id, | 94 int routing_id, |
92 const ExtensionHostMsg_Request_Params& params); | 95 const ExtensionHostMsg_Request_Params& params); |
93 | 96 |
94 // Runs on UI thread. | 97 // Runs on UI thread. |
95 void MimeHandlerViewGuestCreatedCallback(int element_instance_id, | 98 void MimeHandlerViewGuestCreatedCallback(int element_instance_id, |
96 int embedder_render_process_id, | 99 int embedder_render_process_id, |
97 int embedder_render_frame_id, | 100 int embedder_render_frame_id, |
98 const std::string& src, | 101 std::string src, |
Fady Samuel
2015/01/15 21:40:12
you can safely make this a reference
paulmeyer
2015/01/19 23:45:35
Done.
| |
102 gfx::Size element_size, | |
Fady Samuel
2015/01/15 21:40:12
you can safely make this a reference.
paulmeyer
2015/01/19 23:45:35
Done.
| |
99 content::WebContents* web_contents); | 103 content::WebContents* web_contents); |
100 | 104 |
101 const int render_process_id_; | 105 const int render_process_id_; |
102 | 106 |
103 // Should only be accessed on the UI thread. | 107 // Should only be accessed on the UI thread. |
104 content::BrowserContext* browser_context_; | 108 content::BrowserContext* browser_context_; |
105 | 109 |
106 scoped_refptr<extensions::InfoMap> extension_info_map_; | 110 scoped_refptr<extensions::InfoMap> extension_info_map_; |
107 | 111 |
108 // Weak pointers produced by this factory are bound to the IO thread. | 112 // Weak pointers produced by this factory are bound to the IO thread. |
109 base::WeakPtrFactory<ExtensionMessageFilter> weak_ptr_factory_; | 113 base::WeakPtrFactory<ExtensionMessageFilter> weak_ptr_factory_; |
110 | 114 |
111 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageFilter); | 115 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageFilter); |
112 }; | 116 }; |
113 | 117 |
114 } // namespace extensions | 118 } // namespace extensions |
115 | 119 |
116 #endif // EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ | 120 #endif // EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ |
OLD | NEW |