WebCookieJar.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef WebCookieJar_h
  19. #define WebCookieJar_h
  20. #include "BlackBerryGlobal.h"
  21. #include <vector>
  22. namespace BlackBerry {
  23. namespace Platform {
  24. class String;
  25. }
  26. namespace WebKit {
  27. class WebPage;
  28. /**
  29. * Represents the cookie database.
  30. *
  31. * You can obtain an instance of WebCookieJar by calling WebPage::cookieJar().
  32. */
  33. class BLACKBERRY_EXPORT WebCookieJar {
  34. public:
  35. /**
  36. * Returns a list of cookies for the URL specified.
  37. *
  38. * All cookies whose domain and path match the provided URL will be returned.
  39. */
  40. std::vector<BlackBerry::Platform::String> cookies(const BlackBerry::Platform::String& url);
  41. /**
  42. * This will add the cookies provided in the list to the cookie database.
  43. * If a cookie with the same name and domain+path as one of the cookies
  44. * provided already exists, it will be replaced. Other cookies that already
  45. * existed will remain.
  46. *
  47. * If no domain and/or path is provided in a cookie, the domain and/or path
  48. * will be inferred from the provided URL.
  49. */
  50. void setCookies(const BlackBerry::Platform::String& url, const std::vector<BlackBerry::Platform::String>& cookies);
  51. private:
  52. friend class WebPage;
  53. WebCookieJar();
  54. // Disable copy constructor and operator=.
  55. WebCookieJar(const WebCookieJar&);
  56. WebCookieJar& operator=(const WebCookieJar&);
  57. };
  58. }
  59. }
  60. #endif // WebCookieJar_h