sandboxTarget.cpp (1267B)
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 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #include "sandboxTarget.h" 8 9 #include "sandbox/win/src/sandbox.h" 10 11 namespace mozilla { 12 13 // We need to define this function out of line so that clang-cl doesn't inline 14 // it. 15 /* static */ 16 SandboxTarget* SandboxTarget::Instance() { 17 static SandboxTarget sb; 18 return &sb; 19 } 20 21 void SandboxTarget::StartSandbox() { 22 if (mTargetServices) { 23 mTargetServices->LowerToken(); 24 NotifyStartObservers(); 25 } 26 } 27 28 void SandboxTarget::NotifyStartObservers() { 29 for (auto&& obs : mStartObservers) { 30 if (!obs) { 31 continue; 32 } 33 34 obs(); 35 } 36 37 mStartObservers.clear(); 38 } 39 40 bool SandboxTarget::GetComplexLineBreaks(const WCHAR* text, uint32_t length, 41 uint8_t* break_before) { 42 if (!mTargetServices) { 43 return false; 44 } 45 46 sandbox::ResultCode result = 47 mTargetServices->GetComplexLineBreaks(text, length, break_before); 48 return (sandbox::SBOX_ALL_OK == result); 49 } 50 51 } // namespace mozilla