[email protected] | f0ecb55 | 2012-05-11 22:09:11 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | e2614c6 | 2011-04-16 22:12:45 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_ |
| 6 | #define CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_ |
| 7 | |
avi | 66a0772 | 2015-12-25 23:38:12 | [diff] [blame] | 8 | #include <stdint.h> |
| 9 | |
| 10 | #include "base/macros.h" |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 11 | #include "base/memory/weak_ptr.h" |
[email protected] | 1673caf | 2013-11-12 20:15:54 | [diff] [blame] | 12 | #include "content/child/scoped_child_process_reference.h" |
[email protected] | f6cfd83e | 2012-04-20 21:30:35 | [diff] [blame] | 13 | #include "ppapi/c/ppp.h" |
[email protected] | e2614c6 | 2011-04-16 22:12:45 | [diff] [blame] | 14 | #include "ppapi/proxy/broker_dispatcher.h" |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 15 | #include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h" |
[email protected] | e2614c6 | 2011-04-16 22:12:45 | [diff] [blame] | 16 | |
[email protected] | 91355a8 | 2012-10-21 19:52:47 | [diff] [blame] | 17 | namespace content { |
| 18 | |
[email protected] | e2614c6 | 2011-04-16 22:12:45 | [diff] [blame] | 19 | // Wrapper around a BrokerDispatcher that provides the necessary integration |
| 20 | // for plugin process management. This class is to avoid direct dependencies |
| 21 | // from the PPAPI proxy on the Chrome multiprocess infrastructure. |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 22 | class BrokerProcessDispatcher |
| 23 | : public ppapi::proxy::BrokerSideDispatcher, |
| 24 | public base::SupportsWeakPtr<BrokerProcessDispatcher> { |
[email protected] | e2614c6 | 2011-04-16 22:12:45 | [diff] [blame] | 25 | public: |
[email protected] | f0ecb55 | 2012-05-11 22:09:11 | [diff] [blame] | 26 | BrokerProcessDispatcher(PP_GetInterface_Func get_plugin_interface, |
yzshen | 92cad45 | 2016-06-17 20:40:09 | [diff] [blame] | 27 | PP_ConnectInstance_Func connect_instance, |
| 28 | bool peer_is_browser); |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 29 | ~BrokerProcessDispatcher() override; |
[email protected] | e2614c6 | 2011-04-16 22:12:45 | [diff] [blame] | 30 | |
[email protected] | d84effeb | 2012-06-25 17:03:10 | [diff] [blame] | 31 | // IPC::Listener overrides. |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 32 | bool OnMessageReceived(const IPC::Message& msg) override; |
[email protected] | f6cfd83e | 2012-04-20 21:30:35 | [diff] [blame] | 33 | |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 34 | void OnGetPermissionSettingsCompleted( |
avi | 66a0772 | 2015-12-25 23:38:12 | [diff] [blame] | 35 | uint32_t request_id, |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 36 | bool success, |
| 37 | PP_Flash_BrowserOperations_Permission default_permission, |
| 38 | const ppapi::FlashSiteSettings& sites); |
| 39 | |
[email protected] | e2614c6 | 2011-04-16 22:12:45 | [diff] [blame] | 40 | private: |
avi | 66a0772 | 2015-12-25 23:38:12 | [diff] [blame] | 41 | void OnGetSitesWithData(uint32_t request_id, |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 42 | const base::FilePath& plugin_data_path); |
avi | 66a0772 | 2015-12-25 23:38:12 | [diff] [blame] | 43 | void OnClearSiteData(uint32_t request_id, |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 44 | const base::FilePath& plugin_data_path, |
[email protected] | 3d9ec505 | 2013-01-02 22:05:25 | [diff] [blame] | 45 | const std::string& site, |
avi | 66a0772 | 2015-12-25 23:38:12 | [diff] [blame] | 46 | uint64_t flags, |
| 47 | uint64_t max_age); |
| 48 | void OnDeauthorizeContentLicenses(uint32_t request_id, |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 49 | const base::FilePath& plugin_data_path); |
[email protected] | 3d9ec505 | 2013-01-02 22:05:25 | [diff] [blame] | 50 | void OnGetPermissionSettings( |
avi | 66a0772 | 2015-12-25 23:38:12 | [diff] [blame] | 51 | uint32_t request_id, |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 52 | const base::FilePath& plugin_data_path, |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 53 | PP_Flash_BrowserOperations_SettingType setting_type); |
[email protected] | 3d9ec505 | 2013-01-02 22:05:25 | [diff] [blame] | 54 | void OnSetDefaultPermission( |
avi | 66a0772 | 2015-12-25 23:38:12 | [diff] [blame] | 55 | uint32_t request_id, |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 56 | const base::FilePath& plugin_data_path, |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 57 | PP_Flash_BrowserOperations_SettingType setting_type, |
| 58 | PP_Flash_BrowserOperations_Permission permission, |
| 59 | bool clear_site_specific); |
avi | 66a0772 | 2015-12-25 23:38:12 | [diff] [blame] | 60 | void OnSetSitePermission(uint32_t request_id, |
| 61 | const base::FilePath& plugin_data_path, |
| 62 | PP_Flash_BrowserOperations_SettingType setting_type, |
| 63 | const ppapi::FlashSiteSettings& sites); |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 64 | |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 65 | // Returns a list of sites that have data stored. |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 66 | void GetSitesWithData(const base::FilePath& plugin_data_path, |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 67 | std::vector<std::string>* sites); |
| 68 | |
[email protected] | f6cfd83e | 2012-04-20 21:30:35 | [diff] [blame] | 69 | // Requests that the plugin clear data, returning true on success. |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 70 | bool ClearSiteData(const base::FilePath& plugin_data_path, |
[email protected] | f6cfd83e | 2012-04-20 21:30:35 | [diff] [blame] | 71 | const std::string& site, |
avi | 66a0772 | 2015-12-25 23:38:12 | [diff] [blame] | 72 | uint64_t flags, |
| 73 | uint64_t max_age); |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 74 | |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 75 | bool DeauthorizeContentLicenses(const base::FilePath& plugin_data_path); |
| 76 | bool SetDefaultPermission(const base::FilePath& plugin_data_path, |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 77 | PP_Flash_BrowserOperations_SettingType setting_type, |
| 78 | PP_Flash_BrowserOperations_Permission permission, |
| 79 | bool clear_site_specific); |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 80 | bool SetSitePermission(const base::FilePath& plugin_data_path, |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 81 | PP_Flash_BrowserOperations_SettingType setting_type, |
| 82 | const ppapi::FlashSiteSettings& sites); |
[email protected] | f6cfd83e | 2012-04-20 21:30:35 | [diff] [blame] | 83 | |
[email protected] | 1673caf | 2013-11-12 20:15:54 | [diff] [blame] | 84 | ScopedChildProcessReference process_ref_; |
| 85 | |
[email protected] | f6cfd83e | 2012-04-20 21:30:35 | [diff] [blame] | 86 | PP_GetInterface_Func get_plugin_interface_; |
| 87 | |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 88 | const PPP_Flash_BrowserOperations_1_3* flash_browser_operations_1_3_; |
[email protected] | 4f932f7 | 2012-06-18 05:17:54 | [diff] [blame] | 89 | const PPP_Flash_BrowserOperations_1_2* flash_browser_operations_1_2_; |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 90 | const PPP_Flash_BrowserOperations_1_0* flash_browser_operations_1_0_; |
| 91 | |
yzshen | 92cad45 | 2016-06-17 20:40:09 | [diff] [blame] | 92 | bool peer_is_browser_; |
| 93 | |
[email protected] | e2614c6 | 2011-04-16 22:12:45 | [diff] [blame] | 94 | DISALLOW_COPY_AND_ASSIGN(BrokerProcessDispatcher); |
| 95 | }; |
| 96 | |
[email protected] | 91355a8 | 2012-10-21 19:52:47 | [diff] [blame] | 97 | } // namespace content |
| 98 | |
[email protected] | e2614c6 | 2011-04-16 22:12:45 | [diff] [blame] | 99 | #endif // CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_ |