blob: 95401dd02375dd06bbc284807d8705c15d047bb3 [file] [log] [blame]
[email protected]f0ecb552012-05-11 22:09:111// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]e2614c62011-04-16 22:12:452// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_
6#define CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_
7
avi66a07722015-12-25 23:38:128#include <stdint.h>
9
10#include "base/macros.h"
[email protected]ee4dd682012-06-12 15:49:3311#include "base/memory/weak_ptr.h"
[email protected]1673caf2013-11-12 20:15:5412#include "content/child/scoped_child_process_reference.h"
[email protected]f6cfd83e2012-04-20 21:30:3513#include "ppapi/c/ppp.h"
[email protected]e2614c62011-04-16 22:12:4514#include "ppapi/proxy/broker_dispatcher.h"
[email protected]ee4dd682012-06-12 15:49:3315#include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h"
[email protected]e2614c62011-04-16 22:12:4516
[email protected]91355a82012-10-21 19:52:4717namespace content {
18
[email protected]e2614c62011-04-16 22:12:4519// Wrapper around a BrokerDispatcher that provides the necessary integration
20// for plugin process management. This class is to avoid direct dependencies
21// from the PPAPI proxy on the Chrome multiprocess infrastructure.
[email protected]ee4dd682012-06-12 15:49:3322class BrokerProcessDispatcher
23 : public ppapi::proxy::BrokerSideDispatcher,
24 public base::SupportsWeakPtr<BrokerProcessDispatcher> {
[email protected]e2614c62011-04-16 22:12:4525 public:
[email protected]f0ecb552012-05-11 22:09:1126 BrokerProcessDispatcher(PP_GetInterface_Func get_plugin_interface,
yzshen92cad452016-06-17 20:40:0927 PP_ConnectInstance_Func connect_instance,
28 bool peer_is_browser);
dchenge933b3e2014-10-21 11:44:0929 ~BrokerProcessDispatcher() override;
[email protected]e2614c62011-04-16 22:12:4530
[email protected]d84effeb2012-06-25 17:03:1031 // IPC::Listener overrides.
dchenge933b3e2014-10-21 11:44:0932 bool OnMessageReceived(const IPC::Message& msg) override;
[email protected]f6cfd83e2012-04-20 21:30:3533
[email protected]ee4dd682012-06-12 15:49:3334 void OnGetPermissionSettingsCompleted(
avi66a07722015-12-25 23:38:1235 uint32_t request_id,
[email protected]ee4dd682012-06-12 15:49:3336 bool success,
37 PP_Flash_BrowserOperations_Permission default_permission,
38 const ppapi::FlashSiteSettings& sites);
39
[email protected]e2614c62011-04-16 22:12:4540 private:
avi66a07722015-12-25 23:38:1241 void OnGetSitesWithData(uint32_t request_id,
[email protected]d30a36f2013-02-07 04:16:2642 const base::FilePath& plugin_data_path);
avi66a07722015-12-25 23:38:1243 void OnClearSiteData(uint32_t request_id,
[email protected]d30a36f2013-02-07 04:16:2644 const base::FilePath& plugin_data_path,
[email protected]3d9ec5052013-01-02 22:05:2545 const std::string& site,
avi66a07722015-12-25 23:38:1246 uint64_t flags,
47 uint64_t max_age);
48 void OnDeauthorizeContentLicenses(uint32_t request_id,
[email protected]d30a36f2013-02-07 04:16:2649 const base::FilePath& plugin_data_path);
[email protected]3d9ec5052013-01-02 22:05:2550 void OnGetPermissionSettings(
avi66a07722015-12-25 23:38:1251 uint32_t request_id,
[email protected]d30a36f2013-02-07 04:16:2652 const base::FilePath& plugin_data_path,
[email protected]ee4dd682012-06-12 15:49:3353 PP_Flash_BrowserOperations_SettingType setting_type);
[email protected]3d9ec5052013-01-02 22:05:2554 void OnSetDefaultPermission(
avi66a07722015-12-25 23:38:1255 uint32_t request_id,
[email protected]d30a36f2013-02-07 04:16:2656 const base::FilePath& plugin_data_path,
[email protected]ee4dd682012-06-12 15:49:3357 PP_Flash_BrowserOperations_SettingType setting_type,
58 PP_Flash_BrowserOperations_Permission permission,
59 bool clear_site_specific);
avi66a07722015-12-25 23:38:1260 void OnSetSitePermission(uint32_t request_id,
61 const base::FilePath& plugin_data_path,
62 PP_Flash_BrowserOperations_SettingType setting_type,
63 const ppapi::FlashSiteSettings& sites);
[email protected]1a559442012-05-27 07:18:4664
[email protected]951ef0b2012-07-27 22:46:5365 // Returns a list of sites that have data stored.
[email protected]d30a36f2013-02-07 04:16:2666 void GetSitesWithData(const base::FilePath& plugin_data_path,
[email protected]951ef0b2012-07-27 22:46:5367 std::vector<std::string>* sites);
68
[email protected]f6cfd83e2012-04-20 21:30:3569 // Requests that the plugin clear data, returning true on success.
[email protected]d30a36f2013-02-07 04:16:2670 bool ClearSiteData(const base::FilePath& plugin_data_path,
[email protected]f6cfd83e2012-04-20 21:30:3571 const std::string& site,
avi66a07722015-12-25 23:38:1272 uint64_t flags,
73 uint64_t max_age);
[email protected]951ef0b2012-07-27 22:46:5374
[email protected]d30a36f2013-02-07 04:16:2675 bool DeauthorizeContentLicenses(const base::FilePath& plugin_data_path);
76 bool SetDefaultPermission(const base::FilePath& plugin_data_path,
[email protected]ee4dd682012-06-12 15:49:3377 PP_Flash_BrowserOperations_SettingType setting_type,
78 PP_Flash_BrowserOperations_Permission permission,
79 bool clear_site_specific);
[email protected]d30a36f2013-02-07 04:16:2680 bool SetSitePermission(const base::FilePath& plugin_data_path,
[email protected]ee4dd682012-06-12 15:49:3381 PP_Flash_BrowserOperations_SettingType setting_type,
82 const ppapi::FlashSiteSettings& sites);
[email protected]f6cfd83e2012-04-20 21:30:3583
[email protected]1673caf2013-11-12 20:15:5484 ScopedChildProcessReference process_ref_;
85
[email protected]f6cfd83e2012-04-20 21:30:3586 PP_GetInterface_Func get_plugin_interface_;
87
[email protected]951ef0b2012-07-27 22:46:5388 const PPP_Flash_BrowserOperations_1_3* flash_browser_operations_1_3_;
[email protected]4f932f72012-06-18 05:17:5489 const PPP_Flash_BrowserOperations_1_2* flash_browser_operations_1_2_;
[email protected]ee4dd682012-06-12 15:49:3390 const PPP_Flash_BrowserOperations_1_0* flash_browser_operations_1_0_;
91
yzshen92cad452016-06-17 20:40:0992 bool peer_is_browser_;
93
[email protected]e2614c62011-04-16 22:12:4594 DISALLOW_COPY_AND_ASSIGN(BrokerProcessDispatcher);
95};
96
[email protected]91355a82012-10-21 19:52:4797} // namespace content
98
[email protected]e2614c62011-04-16 22:12:4599#endif // CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_