1 /*
   2  * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
   3  */
   4 
   5 #include "config.h"
   6 #include "ResourceHandle.h"
   7 #include "ResourceHandleInternal.h"
   8 
   9 #include "NotImplemented.h"
  10 
  11 namespace WebCore {
  12 
  13 ResourceHandleInternal::~ResourceHandleInternal()
  14 {
  15 }
  16 
  17 ResourceHandle::~ResourceHandle()
  18 {
  19 }
  20 
  21 bool ResourceHandle::start()
  22 {
  23     ASSERT(!d->m_loader);
  24     d->m_loader = URLLoader::loadAsynchronously(context(), this);
  25     return d->m_loader != nullptr;
  26 }
  27 
  28 void ResourceHandle::cancel()
  29 {
  30     if (d->m_loader) {
  31         d->m_loader->cancel();
  32     }
  33 }
  34 
  35 //utatodo: merge artifact
  36 void ResourceHandle::platformLoadResourceSynchronously(NetworkingContext* context,
  37                                                const ResourceRequest& request,
  38                                                StoredCredentialsPolicy,
  39                                                ResourceError& error,
  40                                                ResourceResponse& response,
  41                                                Vector<char>& data)
  42 {
  43     URLLoader::loadSynchronously(context, request, error, response, data);
  44 }
  45 
  46 
  47 void ResourceHandle::platformSetDefersLoading(bool)
  48 {
  49     notImplemented();
  50 }
  51 
  52 void ResourceHandle::receivedCredential(const AuthenticationChallenge&, const Credential&)
  53 {
  54     // Implement like ResourceHandleCurl
  55     notImplemented();
  56 }
  57 
  58 void ResourceHandle::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&)
  59 {
  60     // Implement like ResourceHandleCurl
  61     notImplemented();
  62 }
  63 
  64 void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challenge)
  65 {
  66     if (challenge != d->m_currentWebChallenge)
  67         return;
  68 
  69     if (client())
  70         client()->receivedCancellation(this, challenge);
  71 }
  72 
  73 void ResourceHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&)
  74 {
  75     ASSERT_NOT_REACHED();
  76 }
  77 
  78 void ResourceHandle::receivedChallengeRejection(const AuthenticationChallenge&)
  79 {
  80     ASSERT_NOT_REACHED();
  81 }
  82 
  83 } // namespace WebCore