1635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project/* 28f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian * Copyright (C) 2009 Google Inc. All rights reserved. 38f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian * 4635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * Redistribution and use in source and binary forms, with or without 5635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * modification, are permitted provided that the following conditions are 6635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * met: 78f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian * 8635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * * Redistributions of source code must retain the above copyright 9635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * notice, this list of conditions and the following disclaimer. 10635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * * Redistributions in binary form must reproduce the above 11635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * copyright notice, this list of conditions and the following disclaimer 12635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * in the documentation and/or other materials provided with the 13635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * distribution. 14635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * * Neither the name of Google Inc. nor the names of its 15635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * contributors may be used to endorse or promote products derived from 16635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * this software without specific prior written permission. 178f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian * 18635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project */ 30635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 31643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#ifndef WebURLLoaderClient_h 32643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#define WebURLLoaderClient_h 33635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 34643ca7872b450ea4efacab6188849e5aac2ba161Steve Blocknamespace WebKit { 35635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 36643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebURLLoader; 37643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebURLRequest; 38643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebURLResponse; 39643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstruct WebURLError; 40635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 41643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebURLLoaderClient { 42643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockpublic: 43643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Called when following a redirect. |newRequest| contains the request 44643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // generated by the redirect. The client may modify |newRequest|. 45643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void willSendRequest( 46967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch WebURLLoader*, WebURLRequest& newRequest, const WebURLResponse& redirectResponse) { } 478f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian 48643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Called to report upload progress. The bytes reported correspond to 49643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // the HTTP message body. 50643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void didSendData( 51967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) { } 52635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 53643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Called when response headers are received. 54967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) { } 55967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch 56967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch // Called when a chunk of response data is downloaded. This is only called 57967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch // if WebURLRequest's downloadToFile flag was set to true. 58967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch virtual void didDownloadData(WebURLLoader*, int dataLength) { } 59643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 60643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Called when a chunk of response data is received. 612daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength, int encodedDataLength) { } 62643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 636c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen // Called when a chunk of renderer-generated metadata is received from the cache. 646c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen virtual void didReceiveCachedMetadata(WebURLLoader*, const char* data, int dataLength) { } 656c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen 66643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Called when the load completes successfully. 6768513a70bcd92384395513322f1b801e7bf9c729Steve Block virtual void didFinishLoading(WebURLLoader*, double finishTime) { } 6868513a70bcd92384395513322f1b801e7bf9c729Steve Block 69643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Called when the load completes with an error. 70967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch virtual void didFail(WebURLLoader*, const WebURLError&) { } 71635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 72643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockprotected: 73643ca7872b450ea4efacab6188849e5aac2ba161Steve Block ~WebURLLoaderClient() { } 74643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}; 75643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 76643ca7872b450ea4efacab6188849e5aac2ba161Steve Block} // namespace WebKit 77643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 78643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#endif 79