Roll src/third_party/WebKit f298044:aa8346d (svn 202628:202629)
[chromium-blink-merge.git] / content / ppapi_plugin / broker_process_dispatcher.h
blobbbdbfdcc3232d06c2187c7f574a9a8485149326c
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 "content/child/scoped_child_process_reference.h"
11 #include "ppapi/c/ppp.h"
12 #include "ppapi/proxy/broker_dispatcher.h"
13 #include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h"
15 namespace content {
17 // Wrapper around a BrokerDispatcher that provides the necessary integration
18 // for plugin process management. This class is to avoid direct dependencies
19 // from the PPAPI proxy on the Chrome multiprocess infrastructure.
20 class BrokerProcessDispatcher
21 : public ppapi::proxy::BrokerSideDispatcher,
22 public base::SupportsWeakPtr<BrokerProcessDispatcher> {
23 public:
24 BrokerProcessDispatcher(PP_GetInterface_Func get_plugin_interface,
25 PP_ConnectInstance_Func connect_instance);
26 ~BrokerProcessDispatcher() override;
28 // IPC::Listener overrides.
29 bool OnMessageReceived(const IPC::Message& msg) override;
31 void OnGetPermissionSettingsCompleted(
32 uint32 request_id,
33 bool success,
34 PP_Flash_BrowserOperations_Permission default_permission,
35 const ppapi::FlashSiteSettings& sites);
37 private:
38 void OnGetSitesWithData(uint32 request_id,
39 const base::FilePath& plugin_data_path);
40 void OnClearSiteData(uint32 request_id,
41 const base::FilePath& plugin_data_path,
42 const std::string& site,
43 uint64 flags,
44 uint64 max_age);
45 void OnDeauthorizeContentLicenses(uint32 request_id,
46 const base::FilePath& plugin_data_path);
47 void OnGetPermissionSettings(
48 uint32 request_id,
49 const base::FilePath& plugin_data_path,
50 PP_Flash_BrowserOperations_SettingType setting_type);
51 void OnSetDefaultPermission(
52 uint32 request_id,
53 const base::FilePath& plugin_data_path,
54 PP_Flash_BrowserOperations_SettingType setting_type,
55 PP_Flash_BrowserOperations_Permission permission,
56 bool clear_site_specific);
57 void OnSetSitePermission(
58 uint32 request_id,
59 const base::FilePath& plugin_data_path,
60 PP_Flash_BrowserOperations_SettingType setting_type,
61 const ppapi::FlashSiteSettings& sites);
63 // Returns a list of sites that have data stored.
64 void GetSitesWithData(const base::FilePath& plugin_data_path,
65 std::vector<std::string>* sites);
67 // Requests that the plugin clear data, returning true on success.
68 bool ClearSiteData(const base::FilePath& plugin_data_path,
69 const std::string& site,
70 uint64 flags,
71 uint64 max_age);
73 bool DeauthorizeContentLicenses(const base::FilePath& plugin_data_path);
74 bool SetDefaultPermission(const base::FilePath& plugin_data_path,
75 PP_Flash_BrowserOperations_SettingType setting_type,
76 PP_Flash_BrowserOperations_Permission permission,
77 bool clear_site_specific);
78 bool SetSitePermission(const base::FilePath& plugin_data_path,
79 PP_Flash_BrowserOperations_SettingType setting_type,
80 const ppapi::FlashSiteSettings& sites);
82 ScopedChildProcessReference process_ref_;
84 PP_GetInterface_Func get_plugin_interface_;
86 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_0* flash_browser_operations_1_0_;
90 DISALLOW_COPY_AND_ASSIGN(BrokerProcessDispatcher);
93 } // namespace content
95 #endif // CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_