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"
16 // Wrapper around a BrokerDispatcher that provides the necessary integration
17 // for plugin process management. This class is to avoid direct dependencies
18 // from the PPAPI proxy on the Chrome multiprocess infrastructure.
19 class BrokerProcessDispatcher
20 : public ppapi::proxy::BrokerSideDispatcher
,
21 public base::SupportsWeakPtr
<BrokerProcessDispatcher
> {
23 BrokerProcessDispatcher(PP_GetInterface_Func get_plugin_interface
,
24 PP_ConnectInstance_Func connect_instance
);
25 virtual ~BrokerProcessDispatcher();
27 // IPC::Listener overrides.
28 virtual bool OnMessageReceived(const IPC::Message
& msg
) OVERRIDE
;
30 void OnGetPermissionSettingsCompleted(
33 PP_Flash_BrowserOperations_Permission default_permission
,
34 const ppapi::FlashSiteSettings
& sites
);
37 void OnGetSitesWithData(uint32 request_id
,
38 const base::FilePath
& plugin_data_path
);
39 void OnClearSiteData(uint32 request_id
,
40 const base::FilePath
& plugin_data_path
,
41 const std::string
& site
,
44 void OnDeauthorizeContentLicenses(uint32 request_id
,
45 const base::FilePath
& plugin_data_path
);
46 void OnGetPermissionSettings(
48 const base::FilePath
& plugin_data_path
,
49 PP_Flash_BrowserOperations_SettingType setting_type
);
50 void OnSetDefaultPermission(
52 const base::FilePath
& plugin_data_path
,
53 PP_Flash_BrowserOperations_SettingType setting_type
,
54 PP_Flash_BrowserOperations_Permission permission
,
55 bool clear_site_specific
);
56 void OnSetSitePermission(
58 const base::FilePath
& plugin_data_path
,
59 PP_Flash_BrowserOperations_SettingType setting_type
,
60 const ppapi::FlashSiteSettings
& sites
);
62 // Returns a list of sites that have data stored.
63 void GetSitesWithData(const base::FilePath
& plugin_data_path
,
64 std::vector
<std::string
>* sites
);
66 // Requests that the plugin clear data, returning true on success.
67 bool ClearSiteData(const base::FilePath
& plugin_data_path
,
68 const std::string
& site
,
72 bool DeauthorizeContentLicenses(const base::FilePath
& plugin_data_path
);
73 bool SetDefaultPermission(const base::FilePath
& plugin_data_path
,
74 PP_Flash_BrowserOperations_SettingType setting_type
,
75 PP_Flash_BrowserOperations_Permission permission
,
76 bool clear_site_specific
);
77 bool SetSitePermission(const base::FilePath
& plugin_data_path
,
78 PP_Flash_BrowserOperations_SettingType setting_type
,
79 const ppapi::FlashSiteSettings
& sites
);
81 PP_GetInterface_Func get_plugin_interface_
;
83 const PPP_Flash_BrowserOperations_1_3
* flash_browser_operations_1_3_
;
84 const PPP_Flash_BrowserOperations_1_2
* flash_browser_operations_1_2_
;
85 const PPP_Flash_BrowserOperations_1_0
* flash_browser_operations_1_0_
;
87 DISALLOW_COPY_AND_ASSIGN(BrokerProcessDispatcher
);
90 } // namespace content
92 #endif // CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_