Really set URLRequestContextGetter inside CookieManager.
authorWojciech Wiśniewski <w.wisniewski@samsung.com>
Mon, 19 Jan 2015 16:44:35 +0000 (17:44 +0100)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
CookieManager has member pointer into URLRequestContextGetter (request_context_getter_),
but because of the way objects of these classes were created, this pointer was never
properly initialized (it was always set to NULL). This patch makes it initialize properly.
Reviewed by: Daniel Waślicki, Janusz Majnert, Kamil Klimek, Piotr Tworek, SeungSeop Park

Change-Id: I1b55be86288b82d34bc34edc1970c84c0a60af15
Signed-off-by: Wojciech Wiśniewski <w.wisniewski@samsung.com>
tizen_src/impl/API/ewk_cookie_manager_private.h
tizen_src/impl/cookie_manager.cc
tizen_src/impl/cookie_manager.h
tizen_src/impl/eweb_context.cc
tizen_src/impl/url_request_context_getter_efl.cc

index 171ab78..0a4d5a2 100644 (file)
@@ -7,14 +7,10 @@
 
 #include "cookie_manager.h"
 
-namespace content {
-class URLRequestCOntextGetterEfl;
-}
-
 class Ewk_Cookie_Manager {
  public:
-  static Ewk_Cookie_Manager* create(content::URLRequestContextGetterEfl* request_context_getter) {
-    return (new Ewk_Cookie_Manager(request_context_getter));
+  static Ewk_Cookie_Manager* create() {
+    return new Ewk_Cookie_Manager;
   }
 
   ~Ewk_Cookie_Manager() { }
@@ -24,8 +20,8 @@ class Ewk_Cookie_Manager {
   }
 
  private:
-  explicit Ewk_Cookie_Manager(content::URLRequestContextGetterEfl* request_context_getter)
-    : cookie_manager_(new CookieManager(request_context_getter)) {
+  Ewk_Cookie_Manager()
+    : cookie_manager_(new CookieManager) {
   }
 
   scoped_refptr<CookieManager> cookie_manager_;
index b368bb7..fbd5169 100644 (file)
@@ -74,13 +74,16 @@ class CookieManager::EwkGetHostCallback {
     void* user_data_;
 };
 
-CookieManager::CookieManager(content::URLRequestContextGetterEfl* request_context_getter)
+CookieManager::CookieManager()
     : is_clearing_(false),
-      request_context_getter_(request_context_getter),
       cookie_policy_(TW_COOKIE_ACCEPT_POLICY_ALWAYS)
 {
 }
 
+void CookieManager::SetRequestContextGetter(content::URLRequestContextGetterEfl* getter) {
+  request_context_getter_ = getter;
+}
+
 void CookieManager::DeleteCookiesAsync(const std::string& url,
                                                        const std::string& cookie_name)
 {
index c13ecaf..6f5a155 100644 (file)
@@ -32,8 +32,7 @@ class CookieManager : public base::RefCountedThreadSafe<CookieManager> {
                                    void *);
   typedef void (*AsyncHostnamesGetCb)(Eina_List*, _Ewk_Error*, void *);
 
-  explicit CookieManager(
-      content::URLRequestContextGetterEfl* request_context_getter);
+  CookieManager();
   // Delete all cookies that match the specified parameters. If both |url| and
   // values |cookie_name| are specified all host and domain cookies matching
   // both will be deleted. If only |url| is specified all host cookies (but not
@@ -87,7 +86,7 @@ class CookieManager : public base::RefCountedThreadSafe<CookieManager> {
   bool ShouldBlockThirdPartyCookies();
   //This is synchronous call
   std::string GetCookiesForURL(const std::string& url);
-
+  void SetRequestContextGetter(content::URLRequestContextGetterEfl* getter);
  private:
   struct EwkGetHostCallback;
 
index 69e3024..4d9d9cf 100644 (file)
@@ -335,7 +335,7 @@ EwkDidStartDownloadCallback* EWebContext::DidStartDownloadCallback() {
 
 Ewk_Cookie_Manager* EWebContext::ewkCookieManager() {
   if (!ewk_cookie_manager_)
-    ewk_cookie_manager_.reset(Ewk_Cookie_Manager::create(browser_context_->GetRequestContextEfl()));
+    ewk_cookie_manager_.reset(Ewk_Cookie_Manager::create());
   return ewk_cookie_manager_.get();
 }
 
index 8164bfc..f092282 100644 (file)
@@ -76,6 +76,8 @@ URLRequestContextGetterEfl::URLRequestContextGetterEfl(
   // Must first be created on the UI thread.
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
 
+  cookie_manager_->SetRequestContextGetter(this);
+
   if (protocol_handlers)
     std::swap(protocol_handlers_, *protocol_handlers);