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
3 // found in the LICENSE file.
5 #ifndef CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_
6 #define CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h"
10 #include "ppapi/c/ppp.h"
11 #include "ppapi/proxy/broker_dispatcher.h"
12 #include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h"
14 // Wrapper around a BrokerDispatcher that provides the necessary integration
15 // for plugin process management. This class is to avoid direct dependencies
16 // from the PPAPI proxy on the Chrome multiprocess infrastructure.
17 class BrokerProcessDispatcher
18 : public ppapi::proxy::BrokerSideDispatcher
,
19 public base::SupportsWeakPtr
<BrokerProcessDispatcher
> {
21 BrokerProcessDispatcher(PP_GetInterface_Func get_plugin_interface
,
22 PP_ConnectInstance_Func connect_instance
);
23 virtual ~BrokerProcessDispatcher();
25 // IPC::Listener overrides.
26 virtual bool OnMessageReceived(const IPC::Message
& msg
) OVERRIDE
;
28 void OnGetPermissionSettingsCompleted(
31 PP_Flash_BrowserOperations_Permission default_permission
,
32 const ppapi::FlashSiteSettings
& sites
);
35 void OnMsgGetSitesWithData(uint32 request_id
,
36 const FilePath
& plugin_data_path
);
37 void OnMsgClearSiteData(uint32 request_id
,
38 const FilePath
& plugin_data_path
,
39 const std::string
& site
,
42 void OnMsgDeauthorizeContentLicenses(uint32 request_id
,
43 const FilePath
& plugin_data_path
);
44 void OnMsgGetPermissionSettings(
46 const FilePath
& plugin_data_path
,
47 PP_Flash_BrowserOperations_SettingType setting_type
);
48 void OnMsgSetDefaultPermission(
50 const FilePath
& plugin_data_path
,
51 PP_Flash_BrowserOperations_SettingType setting_type
,
52 PP_Flash_BrowserOperations_Permission permission
,
53 bool clear_site_specific
);
54 void OnMsgSetSitePermission(
56 const FilePath
& plugin_data_path
,
57 PP_Flash_BrowserOperations_SettingType setting_type
,
58 const ppapi::FlashSiteSettings
& sites
);
60 // Returns a list of sites that have data stored.
61 void GetSitesWithData(const FilePath
& plugin_data_path
,
62 std::vector
<std::string
>* sites
);
64 // Requests that the plugin clear data, returning true on success.
65 bool ClearSiteData(const FilePath
& plugin_data_path
,
66 const std::string
& site
,
70 bool DeauthorizeContentLicenses(const FilePath
& plugin_data_path
);
71 bool SetDefaultPermission(const FilePath
& plugin_data_path
,
72 PP_Flash_BrowserOperations_SettingType setting_type
,
73 PP_Flash_BrowserOperations_Permission permission
,
74 bool clear_site_specific
);
75 bool SetSitePermission(const FilePath
& plugin_data_path
,
76 PP_Flash_BrowserOperations_SettingType setting_type
,
77 const ppapi::FlashSiteSettings
& sites
);
79 PP_GetInterface_Func get_plugin_interface_
;
81 const PPP_Flash_BrowserOperations_1_3
* flash_browser_operations_1_3_
;
82 const PPP_Flash_BrowserOperations_1_2
* flash_browser_operations_1_2_
;
83 const PPP_Flash_BrowserOperations_1_0
* flash_browser_operations_1_0_
;
85 DISALLOW_COPY_AND_ASSIGN(BrokerProcessDispatcher
);
88 #endif // CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_