ewk_security_policy.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. Copyright (C) 2012 ProFUSION embedded systems
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public
  5. License as published by the Free Software Foundation; either
  6. version 2 of the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public License
  12. along with this library; see the file COPYING.LIB. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  14. Boston, MA 02110-1301, USA.
  15. */
  16. #include "config.h"
  17. #include "ewk_security_policy.h"
  18. #include "KURL.h"
  19. #include "SecurityOrigin.h"
  20. #include "SecurityPolicy.h"
  21. using namespace WebCore;
  22. void ewk_security_policy_whitelist_origin_add(const char* sourceUrl, const char* destinationUrl, Eina_Bool allowSubdomains)
  23. {
  24. const RefPtr<SecurityOrigin> source = SecurityOrigin::createFromString(sourceUrl);
  25. const KURL destination(KURL(), destinationUrl);
  26. SecurityPolicy::addOriginAccessWhitelistEntry(*source, destination.protocol(), destination.host(), allowSubdomains);
  27. }
  28. void ewk_security_policy_whitelist_origin_del(const char* sourceUrl, const char* destinationUrl, Eina_Bool allowSubdomains)
  29. {
  30. const RefPtr<SecurityOrigin> source = SecurityOrigin::createFromString(sourceUrl);
  31. const KURL destination(KURL(), destinationUrl);
  32. SecurityPolicy::removeOriginAccessWhitelistEntry(*source, destination.protocol(), destination.host(), allowSubdomains);
  33. }
  34. void ewk_security_policy_whitelist_origin_reset()
  35. {
  36. SecurityPolicy::resetOriginAccessWhitelists();
  37. }