SandboxBrokerPolicyFactory.h (1147B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_SandboxBrokerPolicyFactory_h 8 #define mozilla_SandboxBrokerPolicyFactory_h 9 10 #include "mozilla/SandboxBroker.h" 11 12 #include <mutex> 13 14 namespace mozilla { 15 16 class SandboxBrokerPolicyFactory { 17 public: 18 SandboxBrokerPolicyFactory() = default; 19 20 UniquePtr<SandboxBroker::Policy> GetContentPolicy(int aPid, 21 bool aFileProcess); 22 23 static UniquePtr<SandboxBroker::Policy> GetRDDPolicy(int aPid); 24 static UniquePtr<SandboxBroker::Policy> GetSocketProcessPolicy(int aPid); 25 static UniquePtr<SandboxBroker::Policy> GetUtilityProcessPolicy(int aPid); 26 27 private: 28 UniquePtr<const SandboxBroker::Policy> mCommonContentPolicy; 29 std::once_flag mContentInited; 30 31 void InitContentPolicy(); 32 }; 33 34 } // namespace mozilla 35 36 #endif // mozilla_SandboxBrokerPolicyFactory_h