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 } | 26 } |
26 | 27 |
27 namespace extensions { | 28 namespace extensions { |
28 | 29 |
29 class InfoMap; | 30 class InfoMap; |
30 | 31 |
31 // This class filters out incoming extension-specific IPC messages from the | 32 // This class filters out incoming extension-specific IPC messages from the |
32 // renderer process. It is created on the UI thread. Messages may be handled on | 33 // renderer process. It is created on the UI thread. Messages may be handled on |
33 // the IO thread or the UI thread. | 34 // the IO thread or the UI thread. |
34 class ExtensionMessageFilter : public content::BrowserMessageFilter { | 35 class ExtensionMessageFilter : public content::BrowserMessageFilter { |
(...skipping 22 matching lines...) Expand all Loading... |
57 const std::string& event_name); | 58 const std::string& event_name); |
58 void OnExtensionRemoveListener(const std::string& extension_id, | 59 void OnExtensionRemoveListener(const std::string& extension_id, |
59 const GURL& listener_url, | 60 const GURL& listener_url, |
60 const std::string& event_name); | 61 const std::string& event_name); |
61 void OnExtensionAddLazyListener(const std::string& extension_id, | 62 void OnExtensionAddLazyListener(const std::string& extension_id, |
62 const std::string& event_name); | 63 const std::string& event_name); |
63 void OnExtensionAttachGuest(int routing_id, | 64 void OnExtensionAttachGuest(int routing_id, |
64 int element_instance_id, | 65 int element_instance_id, |
65 int guest_instance_id, | 66 int guest_instance_id, |
66 const base::DictionaryValue& attach_params); | 67 const base::DictionaryValue& attach_params); |
| 68 void OnExtensionCreateMimeHandlerViewGuest(int render_frame_id, |
| 69 const std::string& url, |
| 70 const std::string& mime_type, |
| 71 int element_instance_id); |
67 void OnExtensionRemoveLazyListener(const std::string& extension_id, | 72 void OnExtensionRemoveLazyListener(const std::string& extension_id, |
68 const std::string& event_name); | 73 const std::string& event_name); |
69 void OnExtensionAddFilteredListener(const std::string& extension_id, | 74 void OnExtensionAddFilteredListener(const std::string& extension_id, |
70 const std::string& event_name, | 75 const std::string& event_name, |
71 const base::DictionaryValue& filter, | 76 const base::DictionaryValue& filter, |
72 bool lazy); | 77 bool lazy); |
73 void OnExtensionRemoveFilteredListener(const std::string& extension_id, | 78 void OnExtensionRemoveFilteredListener(const std::string& extension_id, |
74 const std::string& event_name, | 79 const std::string& event_name, |
75 const base::DictionaryValue& filter, | 80 const base::DictionaryValue& filter, |
76 bool lazy); | 81 bool lazy); |
77 void OnExtensionShouldSuspendAck(const std::string& extension_id, | 82 void OnExtensionShouldSuspendAck(const std::string& extension_id, |
78 int sequence_id); | 83 int sequence_id); |
79 void OnExtensionSuspendAck(const std::string& extension_id); | 84 void OnExtensionSuspendAck(const std::string& extension_id); |
80 void OnExtensionTransferBlobsAck(const std::vector<std::string>& blob_uuids); | 85 void OnExtensionTransferBlobsAck(const std::vector<std::string>& blob_uuids); |
81 | 86 |
82 // Message handlers on the IO thread. | 87 // Message handlers on the IO thread. |
83 void OnExtensionGenerateUniqueID(int* unique_id); | 88 void OnExtensionGenerateUniqueID(int* unique_id); |
84 void OnExtensionResumeRequests(int route_id); | 89 void OnExtensionResumeRequests(int route_id); |
85 void OnExtensionRequestForIOThread( | 90 void OnExtensionRequestForIOThread( |
86 int routing_id, | 91 int routing_id, |
87 const ExtensionHostMsg_Request_Params& params); | 92 const ExtensionHostMsg_Request_Params& params); |
88 | 93 |
| 94 // Runs on UI thread. |
| 95 void MimeHandlerViewGuestCreatedCallback(int element_instance_id, |
| 96 int embedder_render_process_id, |
| 97 int embedder_render_frame_id, |
| 98 const std::string& src, |
| 99 content::WebContents* web_contents); |
| 100 |
89 const int render_process_id_; | 101 const int render_process_id_; |
90 | 102 |
91 // Should only be accessed on the UI thread. | 103 // Should only be accessed on the UI thread. |
92 content::BrowserContext* browser_context_; | 104 content::BrowserContext* browser_context_; |
93 | 105 |
94 scoped_refptr<extensions::InfoMap> extension_info_map_; | 106 scoped_refptr<extensions::InfoMap> extension_info_map_; |
95 | 107 |
96 // Weak pointers produced by this factory are bound to the IO thread. | 108 // Weak pointers produced by this factory are bound to the IO thread. |
97 base::WeakPtrFactory<ExtensionMessageFilter> weak_ptr_factory_; | 109 base::WeakPtrFactory<ExtensionMessageFilter> weak_ptr_factory_; |
98 | 110 |
99 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageFilter); | 111 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageFilter); |
100 }; | 112 }; |
101 | 113 |
102 } // namespace extensions | 114 } // namespace extensions |
103 | 115 |
104 #endif // EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ | 116 #endif // EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ |
OLD | NEW |