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 19#ifndef WebCookieJar_h 20#define WebCookieJar_h 21 22#include "BlackBerryGlobal.h" 23 24#include <vector> 25 26namespace BlackBerry { 27namespace Platform { 28class String; 29} 30 31namespace WebKit { 32 33class WebPage; 34 35/** 36 * Represents the cookie database. 37 * 38 * You can obtain an instance of WebCookieJar by calling WebPage::cookieJar(). 39 */ 40class BLACKBERRY_EXPORT WebCookieJar { 41public: 42 /** 43 * Returns a list of cookies for the URL specified. 44 * 45 * All cookies whose domain and path match the provided URL will be returned. 46 */ 47 std::vector<BlackBerry::Platform::String> cookies(const BlackBerry::Platform::String& url); 48 49 /** 50 * This will add the cookies provided in the list to the cookie database. 51 * If a cookie with the same name and domain+path as one of the cookies 52 * provided already exists, it will be replaced. Other cookies that already 53 * existed will remain. 54 * 55 * If no domain and/or path is provided in a cookie, the domain and/or path 56 * will be inferred from the provided URL. 57 */ 58 void setCookies(const BlackBerry::Platform::String& url, const std::vector<BlackBerry::Platform::String>& cookies); 59 60private: 61 friend class WebPage; 62 63 WebCookieJar(); 64 65 // Disable copy constructor and operator=. 66 WebCookieJar(const WebCookieJar&); 67 WebCookieJar& operator=(const WebCookieJar&); 68}; 69 70} 71} 72 73#endif // WebCookieJar_h 74