| 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 CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_ | 5 #ifndef CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_ |
| 6 #define CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_ | 6 #define CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 10 #include "content/child/scoped_child_process_reference.h" | 12 #include "content/child/scoped_child_process_reference.h" |
| 11 #include "ppapi/c/ppp.h" | 13 #include "ppapi/c/ppp.h" |
| 12 #include "ppapi/proxy/broker_dispatcher.h" | 14 #include "ppapi/proxy/broker_dispatcher.h" |
| 13 #include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h" | 15 #include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h" |
| 14 | 16 |
| 15 namespace content { | 17 namespace content { |
| 16 | 18 |
| 17 // Wrapper around a BrokerDispatcher that provides the necessary integration | 19 // Wrapper around a BrokerDispatcher that provides the necessary integration |
| 18 // for plugin process management. This class is to avoid direct dependencies | 20 // for plugin process management. This class is to avoid direct dependencies |
| 19 // from the PPAPI proxy on the Chrome multiprocess infrastructure. | 21 // from the PPAPI proxy on the Chrome multiprocess infrastructure. |
| 20 class BrokerProcessDispatcher | 22 class BrokerProcessDispatcher |
| 21 : public ppapi::proxy::BrokerSideDispatcher, | 23 : public ppapi::proxy::BrokerSideDispatcher, |
| 22 public base::SupportsWeakPtr<BrokerProcessDispatcher> { | 24 public base::SupportsWeakPtr<BrokerProcessDispatcher> { |
| 23 public: | 25 public: |
| 24 BrokerProcessDispatcher(PP_GetInterface_Func get_plugin_interface, | 26 BrokerProcessDispatcher(PP_GetInterface_Func get_plugin_interface, |
| 25 PP_ConnectInstance_Func connect_instance); | 27 PP_ConnectInstance_Func connect_instance); |
| 26 ~BrokerProcessDispatcher() override; | 28 ~BrokerProcessDispatcher() override; |
| 27 | 29 |
| 28 // IPC::Listener overrides. | 30 // IPC::Listener overrides. |
| 29 bool OnMessageReceived(const IPC::Message& msg) override; | 31 bool OnMessageReceived(const IPC::Message& msg) override; |
| 30 | 32 |
| 31 void OnGetPermissionSettingsCompleted( | 33 void OnGetPermissionSettingsCompleted( |
| 32 uint32 request_id, | 34 uint32_t request_id, |
| 33 bool success, | 35 bool success, |
| 34 PP_Flash_BrowserOperations_Permission default_permission, | 36 PP_Flash_BrowserOperations_Permission default_permission, |
| 35 const ppapi::FlashSiteSettings& sites); | 37 const ppapi::FlashSiteSettings& sites); |
| 36 | 38 |
| 37 private: | 39 private: |
| 38 void OnGetSitesWithData(uint32 request_id, | 40 void OnGetSitesWithData(uint32_t request_id, |
| 39 const base::FilePath& plugin_data_path); | 41 const base::FilePath& plugin_data_path); |
| 40 void OnClearSiteData(uint32 request_id, | 42 void OnClearSiteData(uint32_t request_id, |
| 41 const base::FilePath& plugin_data_path, | 43 const base::FilePath& plugin_data_path, |
| 42 const std::string& site, | 44 const std::string& site, |
| 43 uint64 flags, | 45 uint64_t flags, |
| 44 uint64 max_age); | 46 uint64_t max_age); |
| 45 void OnDeauthorizeContentLicenses(uint32 request_id, | 47 void OnDeauthorizeContentLicenses(uint32_t request_id, |
| 46 const base::FilePath& plugin_data_path); | 48 const base::FilePath& plugin_data_path); |
| 47 void OnGetPermissionSettings( | 49 void OnGetPermissionSettings( |
| 48 uint32 request_id, | 50 uint32_t request_id, |
| 49 const base::FilePath& plugin_data_path, | 51 const base::FilePath& plugin_data_path, |
| 50 PP_Flash_BrowserOperations_SettingType setting_type); | 52 PP_Flash_BrowserOperations_SettingType setting_type); |
| 51 void OnSetDefaultPermission( | 53 void OnSetDefaultPermission( |
| 52 uint32 request_id, | 54 uint32_t request_id, |
| 53 const base::FilePath& plugin_data_path, | 55 const base::FilePath& plugin_data_path, |
| 54 PP_Flash_BrowserOperations_SettingType setting_type, | 56 PP_Flash_BrowserOperations_SettingType setting_type, |
| 55 PP_Flash_BrowserOperations_Permission permission, | 57 PP_Flash_BrowserOperations_Permission permission, |
| 56 bool clear_site_specific); | 58 bool clear_site_specific); |
| 57 void OnSetSitePermission( | 59 void OnSetSitePermission(uint32_t request_id, |
| 58 uint32 request_id, | 60 const base::FilePath& plugin_data_path, |
| 59 const base::FilePath& plugin_data_path, | 61 PP_Flash_BrowserOperations_SettingType setting_type, |
| 60 PP_Flash_BrowserOperations_SettingType setting_type, | 62 const ppapi::FlashSiteSettings& sites); |
| 61 const ppapi::FlashSiteSettings& sites); | |
| 62 | 63 |
| 63 // Returns a list of sites that have data stored. | 64 // Returns a list of sites that have data stored. |
| 64 void GetSitesWithData(const base::FilePath& plugin_data_path, | 65 void GetSitesWithData(const base::FilePath& plugin_data_path, |
| 65 std::vector<std::string>* sites); | 66 std::vector<std::string>* sites); |
| 66 | 67 |
| 67 // Requests that the plugin clear data, returning true on success. | 68 // Requests that the plugin clear data, returning true on success. |
| 68 bool ClearSiteData(const base::FilePath& plugin_data_path, | 69 bool ClearSiteData(const base::FilePath& plugin_data_path, |
| 69 const std::string& site, | 70 const std::string& site, |
| 70 uint64 flags, | 71 uint64_t flags, |
| 71 uint64 max_age); | 72 uint64_t max_age); |
| 72 | 73 |
| 73 bool DeauthorizeContentLicenses(const base::FilePath& plugin_data_path); | 74 bool DeauthorizeContentLicenses(const base::FilePath& plugin_data_path); |
| 74 bool SetDefaultPermission(const base::FilePath& plugin_data_path, | 75 bool SetDefaultPermission(const base::FilePath& plugin_data_path, |
| 75 PP_Flash_BrowserOperations_SettingType setting_type, | 76 PP_Flash_BrowserOperations_SettingType setting_type, |
| 76 PP_Flash_BrowserOperations_Permission permission, | 77 PP_Flash_BrowserOperations_Permission permission, |
| 77 bool clear_site_specific); | 78 bool clear_site_specific); |
| 78 bool SetSitePermission(const base::FilePath& plugin_data_path, | 79 bool SetSitePermission(const base::FilePath& plugin_data_path, |
| 79 PP_Flash_BrowserOperations_SettingType setting_type, | 80 PP_Flash_BrowserOperations_SettingType setting_type, |
| 80 const ppapi::FlashSiteSettings& sites); | 81 const ppapi::FlashSiteSettings& sites); |
| 81 | 82 |
| 82 ScopedChildProcessReference process_ref_; | 83 ScopedChildProcessReference process_ref_; |
| 83 | 84 |
| 84 PP_GetInterface_Func get_plugin_interface_; | 85 PP_GetInterface_Func get_plugin_interface_; |
| 85 | 86 |
| 86 const PPP_Flash_BrowserOperations_1_3* flash_browser_operations_1_3_; | 87 const PPP_Flash_BrowserOperations_1_3* flash_browser_operations_1_3_; |
| 87 const PPP_Flash_BrowserOperations_1_2* flash_browser_operations_1_2_; | 88 const PPP_Flash_BrowserOperations_1_2* flash_browser_operations_1_2_; |
| 88 const PPP_Flash_BrowserOperations_1_0* flash_browser_operations_1_0_; | 89 const PPP_Flash_BrowserOperations_1_0* flash_browser_operations_1_0_; |
| 89 | 90 |
| 90 DISALLOW_COPY_AND_ASSIGN(BrokerProcessDispatcher); | 91 DISALLOW_COPY_AND_ASSIGN(BrokerProcessDispatcher); |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 } // namespace content | 94 } // namespace content |
| 94 | 95 |
| 95 #endif // CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_ | 96 #endif // CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_ |
| OLD | NEW |