| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_PLUGINS_PLUGIN_INFO_MESSAGE_FILTER_H_ | 5 #ifndef CHROME_BROWSER_PLUGINS_PLUGIN_INFO_MESSAGE_FILTER_H_ |
| 6 #define CHROME_BROWSER_PLUGINS_PLUGIN_INFO_MESSAGE_FILTER_H_ | 6 #define CHROME_BROWSER_PLUGINS_PLUGIN_INFO_MESSAGE_FILTER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 | 38 |
| 39 namespace extensions { | 39 namespace extensions { |
| 40 class ExtensionRegistry; | 40 class ExtensionRegistry; |
| 41 } | 41 } |
| 42 | 42 |
| 43 namespace component_updater { | 43 namespace component_updater { |
| 44 struct ComponentInfo; | 44 struct ComponentInfo; |
| 45 } | 45 } |
| 46 | 46 |
| 47 namespace url { |
| 48 class Origin; |
| 49 } |
| 50 |
| 47 // This class filters out incoming IPC messages requesting plugin information. | 51 // This class filters out incoming IPC messages requesting plugin information. |
| 48 class PluginInfoMessageFilter : public content::BrowserMessageFilter { | 52 class PluginInfoMessageFilter : public content::BrowserMessageFilter { |
| 49 public: | 53 public: |
| 50 struct GetPluginInfo_Params; | 54 struct GetPluginInfo_Params; |
| 51 | 55 |
| 52 // Contains all the information needed by the PluginInfoMessageFilter. | 56 // Contains all the information needed by the PluginInfoMessageFilter. |
| 53 class Context { | 57 class Context { |
| 54 public: | 58 public: |
| 55 Context(int render_process_id, Profile* profile); | 59 Context(int render_process_id, Profile* profile); |
| 56 | 60 |
| 57 ~Context(); | 61 ~Context(); |
| 58 | 62 |
| 59 void DecidePluginStatus( | 63 void DecidePluginStatus( |
| 60 const GetPluginInfo_Params& params, | 64 const GetPluginInfo_Params& params, |
| 61 const content::WebPluginInfo& plugin, | 65 const content::WebPluginInfo& plugin, |
| 62 const PluginMetadata* plugin_metadata, | 66 const PluginMetadata* plugin_metadata, |
| 63 ChromeViewHostMsg_GetPluginInfo_Status* status) const; | 67 ChromeViewHostMsg_GetPluginInfo_Status* status) const; |
| 64 bool FindEnabledPlugin( | 68 bool FindEnabledPlugin( |
| 65 int render_frame_id, | 69 int render_frame_id, |
| 66 const GURL& url, | 70 const GURL& url, |
| 67 const GURL& top_origin_url, | 71 const url::Origin& main_frame_origin, |
| 68 const std::string& mime_type, | 72 const std::string& mime_type, |
| 69 ChromeViewHostMsg_GetPluginInfo_Status* status, | 73 ChromeViewHostMsg_GetPluginInfo_Status* status, |
| 70 content::WebPluginInfo* plugin, | 74 content::WebPluginInfo* plugin, |
| 71 std::string* actual_mime_type, | 75 std::string* actual_mime_type, |
| 72 std::unique_ptr<PluginMetadata>* plugin_metadata) const; | 76 std::unique_ptr<PluginMetadata>* plugin_metadata) const; |
| 73 void MaybeGrantAccess(ChromeViewHostMsg_GetPluginInfo_Status status, | 77 void MaybeGrantAccess(ChromeViewHostMsg_GetPluginInfo_Status status, |
| 74 const base::FilePath& path) const; | 78 const base::FilePath& path) const; |
| 75 bool IsPluginEnabled(const content::WebPluginInfo& plugin) const; | 79 bool IsPluginEnabled(const content::WebPluginInfo& plugin) const; |
| 76 | 80 |
| 77 private: | 81 private: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 95 | 99 |
| 96 private: | 100 private: |
| 97 friend struct content::BrowserThread::DeleteOnThread< | 101 friend struct content::BrowserThread::DeleteOnThread< |
| 98 content::BrowserThread::UI>; | 102 content::BrowserThread::UI>; |
| 99 friend class base::DeleteHelper<PluginInfoMessageFilter>; | 103 friend class base::DeleteHelper<PluginInfoMessageFilter>; |
| 100 | 104 |
| 101 ~PluginInfoMessageFilter() override; | 105 ~PluginInfoMessageFilter() override; |
| 102 | 106 |
| 103 void OnGetPluginInfo(int render_frame_id, | 107 void OnGetPluginInfo(int render_frame_id, |
| 104 const GURL& url, | 108 const GURL& url, |
| 105 const GURL& top_origin_url, | 109 const url::Origin& main_frame_origin, |
| 106 const std::string& mime_type, | 110 const std::string& mime_type, |
| 107 IPC::Message* reply_msg); | 111 IPC::Message* reply_msg); |
| 108 | 112 |
| 109 // |params| wraps the parameters passed to |OnGetPluginInfo|, because | 113 // |params| wraps the parameters passed to |OnGetPluginInfo|, because |
| 110 // |base::Bind| doesn't support the required arity <http://crbug.com/98542>. | 114 // |base::Bind| doesn't support the required arity <http://crbug.com/98542>. |
| 111 void PluginsLoaded(const GetPluginInfo_Params& params, | 115 void PluginsLoaded(const GetPluginInfo_Params& params, |
| 112 IPC::Message* reply_msg, | 116 IPC::Message* reply_msg, |
| 113 const std::vector<content::WebPluginInfo>& plugins); | 117 const std::vector<content::WebPluginInfo>& plugins); |
| 114 | 118 |
| 115 void ComponentPluginLookupDone( | 119 void ComponentPluginLookupDone( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 142 | 146 |
| 143 Context context_; | 147 Context context_; |
| 144 | 148 |
| 145 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 149 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 146 base::WeakPtrFactory<PluginInfoMessageFilter> weak_ptr_factory_; | 150 base::WeakPtrFactory<PluginInfoMessageFilter> weak_ptr_factory_; |
| 147 | 151 |
| 148 DISALLOW_COPY_AND_ASSIGN(PluginInfoMessageFilter); | 152 DISALLOW_COPY_AND_ASSIGN(PluginInfoMessageFilter); |
| 149 }; | 153 }; |
| 150 | 154 |
| 151 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_INFO_MESSAGE_FILTER_H_ | 155 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_INFO_MESSAGE_FILTER_H_ |
| OLD | NEW |