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 "base/basictypes.h" |
9 #include "base/memory/weak_ptr.h" | |
10 #include "ppapi/c/ppp.h" | 9 #include "ppapi/c/ppp.h" |
11 #include "ppapi/proxy/broker_dispatcher.h" | 10 #include "ppapi/proxy/broker_dispatcher.h" |
12 #include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h" | |
13 | 11 |
14 // Wrapper around a BrokerDispatcher that provides the necessary integration | 12 // Wrapper around a BrokerDispatcher that provides the necessary integration |
15 // for plugin process management. This class is to avoid direct dependencies | 13 // for plugin process management. This class is to avoid direct dependencies |
16 // from the PPAPI proxy on the Chrome multiprocess infrastructure. | 14 // from the PPAPI proxy on the Chrome multiprocess infrastructure. |
17 class BrokerProcessDispatcher | 15 class BrokerProcessDispatcher : public ppapi::proxy::BrokerSideDispatcher { |
18 : public ppapi::proxy::BrokerSideDispatcher, | |
19 public base::SupportsWeakPtr<BrokerProcessDispatcher> { | |
20 public: | 16 public: |
21 BrokerProcessDispatcher(PP_GetInterface_Func get_plugin_interface, | 17 BrokerProcessDispatcher(PP_GetInterface_Func get_plugin_interface, |
22 PP_ConnectInstance_Func connect_instance); | 18 PP_ConnectInstance_Func connect_instance); |
23 virtual ~BrokerProcessDispatcher(); | 19 virtual ~BrokerProcessDispatcher(); |
24 | 20 |
25 // IPC::Channel::Listener overrides. | 21 // IPC::Channel::Listener overrides. |
26 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 22 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
27 | 23 |
28 void OnGetPermissionSettingsCompleted( | |
29 uint32 request_id, | |
30 bool success, | |
31 PP_Flash_BrowserOperations_Permission default_permission, | |
32 const ppapi::FlashSiteSettings& sites); | |
33 | |
34 private: | 24 private: |
35 void OnMsgClearSiteData(const FilePath& plugin_data_path, | 25 void OnMsgClearSiteData(const FilePath& plugin_data_path, |
36 const std::string& site, | 26 const std::string& site, |
37 uint64 flags, | 27 uint64 flags, |
38 uint64 max_age); | 28 uint64 max_age); |
| 29 |
39 void OnMsgDeauthorizeContentLicenses(uint32 request_id, | 30 void OnMsgDeauthorizeContentLicenses(uint32 request_id, |
40 const FilePath& plugin_data_path); | 31 const FilePath& plugin_data_path); |
41 void OnMsgGetPermissionSettings( | |
42 uint32 request_id, | |
43 const FilePath& plugin_data_path, | |
44 PP_Flash_BrowserOperations_SettingType setting_type); | |
45 void OnMsgSetDefaultPermission( | |
46 uint32 request_id, | |
47 const FilePath& plugin_data_path, | |
48 PP_Flash_BrowserOperations_SettingType setting_type, | |
49 PP_Flash_BrowserOperations_Permission permission, | |
50 bool clear_site_specific); | |
51 void OnMsgSetSitePermission( | |
52 uint32 request_id, | |
53 const FilePath& plugin_data_path, | |
54 PP_Flash_BrowserOperations_SettingType setting_type, | |
55 const ppapi::FlashSiteSettings& sites); | |
56 | 32 |
57 // Requests that the plugin clear data, returning true on success. | 33 // Requests that the plugin clear data, returning true on success. |
58 bool ClearSiteData(const FilePath& plugin_data_path, | 34 bool ClearSiteData(const FilePath& plugin_data_path, |
59 const std::string& site, | 35 const std::string& site, |
60 uint64 flags, | 36 uint64 flags, |
61 uint64 max_age); | 37 uint64 max_age); |
62 bool DeauthorizeContentLicenses(const FilePath& plugin_data_path); | 38 bool DeauthorizeContentLicenses(const FilePath& plugin_data_path); |
63 bool SetDefaultPermission(const FilePath& plugin_data_path, | |
64 PP_Flash_BrowserOperations_SettingType setting_type, | |
65 PP_Flash_BrowserOperations_Permission permission, | |
66 bool clear_site_specific); | |
67 bool SetSitePermission(const FilePath& plugin_data_path, | |
68 PP_Flash_BrowserOperations_SettingType setting_type, | |
69 const ppapi::FlashSiteSettings& sites); | |
70 | 39 |
71 PP_GetInterface_Func get_plugin_interface_; | 40 PP_GetInterface_Func get_plugin_interface_; |
72 | 41 |
73 const PPP_Flash_BrowserOperations_1_1* flash_browser_operations_1_1_; | |
74 const PPP_Flash_BrowserOperations_1_0* flash_browser_operations_1_0_; | |
75 | |
76 DISALLOW_COPY_AND_ASSIGN(BrokerProcessDispatcher); | 42 DISALLOW_COPY_AND_ASSIGN(BrokerProcessDispatcher); |
77 }; | 43 }; |
78 | 44 |
79 #endif // CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_ | 45 #endif // CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_ |
OLD | NEW |